Jump to content

Best language for a begginer?

spellmanuk
5 hours ago, SSL said:

 

That's an argument against weakly typed languages, though. Not Python in particular.

 

I agree that strong typing is the right way to do things, but I'd say code comprehension is a minor reason. Variable naming and documentation are much more important. Knowing the explicit type of a variable is going to tell you fuck all about what a piece of code does if it lacks good variables names, good documentation, or is just a mess regardless.

 

Really, the whole qualification "assuming the guy that wrote the code has a clue of what he is doing" also fails as an indictment of Python, since any piece of code in any language can be unintelligible if the person who wrote it is careless or incompetent.

 

If a method/procedure/function has a single responsibility (which it should if "the guy that wrote the code has a clue of what he is doing"), and follows conventions like good variable names and good documentation, it should be possible to understand it regardless of what language it is in. If you still can't figure it out easily just because of weak typing, that's your problem.

I totally get what you are saying. Documentation, variable naming etc. plays a very big role in this. My point is just that a dynamically typed language makes it more difficult for a beginner to comprehend what some piece of code does. In the context of this topic, my advice to OP is to stay way from dynamically typed languages when you are starting out. 

Sure Python is a great language with good frameworks like Django for web-dev. etc., but I think it is important to learn to deal with datatypes and specify them when you are starting out.

Running Arch with i3-gaps on a Thinkpad X1 Extreme
Data Science Postgrad

 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Claryn said:

My point is just that a dynamically typed language makes it more difficult for a beginner to comprehend what some piece of code does.

 

Does, though? If the variable name encapsulates what the data is, in what way does knowing the type help? When writing pseudocode, types are almost always omitted from what I've seen. I don't think anyone would argue that that kind of abstraction makes it more difficult to understand.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, SSL said:

 

Does, though? If the variable name encapsulates what the data is, in what way does knowing the type help? When writing pseudocode, types are almost always omitted from what I've seen. I don't think anyone would argue that that kind of abstraction makes it more difficult to understand.

Personally I am having a lot of trouble understanding certain algorithms written in Python, opposed to the same thing written in Java or C++, because of the lack of types. Just knowing that something is a tuple, or a list, or a string when looking at the definition of the method, instead of having to find a method-call somewhere and then find the use of the variables that are used as parameters, makes it way way easier to read and understand code. 

 

I live by the philosophy that if you can't look at an unknown method's name and parameters and explain what it does, then the guy that implemented it did something wrong. It is seldom that I come across a Python implementation where I can look at the header of a method and know what it does and understand what all the parameters are for. This is true for both text-book examples, other's projects at GitHub and my lecturer's examples. Everything is, in my opinion, way easier to comprehend once you KNOW what the type of the variable is. And what are you really loosing from declaring that this variable is an integer, or just casting the char to a string when you need to change it for who-knows-what reason?

Running Arch with i3-gaps on a Thinkpad X1 Extreme
Data Science Postgrad

 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Claryn said:

Personally I am having a lot of trouble understanding certain algorithms written in Python, opposed to the same thing written in Java or C++, because of the lack of types. Just knowing that something is a tuple, or a list, or a string when looking at the definition of the method, instead of having to find a method-call somewhere and then find the use of the variables that are used as parameters, makes it way way easier to read and understand code. 

 

I live by the philosophy that if you can't look at an unknown method's name and parameters and explain what it does, then the guy that implemented it did something wrong. It is seldom that I come across a Python implementation where I can look at the header of a method and know what it does and understand what all the parameters are for. This is true for both text-book examples, other's projects at GitHub and my lecturer's examples. Everything is, in my opinion, way easier to comprehend once you KNOW what the type of the variable is. And what are you really loosing from declaring that this variable is an integer, or just casting the char to a string when you need to change it for who-knows-what reason?

 

Nothing. You lose nothing. My point is that the name of the variable should have as much or more significance than the type in terms of understanding what the code does. Implementation details may be further clarified by knowing the type, but there is already a problem if you need that information just to know what the code does. 

 

You seem to be forgetting that I am in agreement that static typing is preferable. For object oriented programming, it is essential, because without it, defining interfaces is impossible. But we're not arguing whether or not static typing is beneficial, only whether it is necessary to understand code.

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, SSL said:

Nothing. You lose nothing.

You lose duck typing, which is a huge part of Python.

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, SSL said:

 

Nothing. You lose nothing. My point is that the name of the variable should have as much or more significance than the type in terms of understanding what the code does. Implementation details may be further clarified by knowing the type, but there is already a problem if you need that information just to know what the code does. 

 

You seem to be forgetting that I am in agreement that static typing is preferable. For object oriented programming, it is essential, because without it, defining interfaces is impossible. But we're not arguing whether or not static typing is beneficial, only whether it is necessary to understand code.

I think we agree, then. To OP, I just want to make the point that I believe you would shoot yourself in the foot by starting out with a dynamically typed language. At my Uni., Python is used in the intro-course to procedural programming, and then the next semester they start out with OOP in Java, with no syntax lecturing, and a lot of people are struggling because they suddenly have to think about data-types.

 

Another issue with Python, that I forgot before you brought it up here, is that it is object-oriented. Whenever you are dealing with objects, its gonna get messy because it is difficult for someone that needs to read the code to understand that the third parameter there is an object that you have created. I get your point SSL and I agree as I said: If you write a piece of code and you name your variables and methods correctly, it should be crystal clear what they are and what their purpose is. However, that is not always too easy for beginners. So as I said, I think we agree. 

And again to OP: Don't start out with a dynamically typed language. Other than that: figure out what you want to use programming for, then pick the best language to do exactly that. The language is just a tool, as someone said earlier, you wouldn't use a spanner to hit a nail into a piece of wood. 

Running Arch with i3-gaps on a Thinkpad X1 Extreme
Data Science Postgrad

 

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, Claryn said:

I think we agree, then. To OP, I just want to make the point that I believe you would shoot yourself in the foot by starting out with a dynamically typed language. At my Uni., Python is used in the intro-course to procedural programming, and then the next semester they start out with OOP in Java, with no syntax lecturing, and a lot of people are struggling because they suddenly have to think about data-types.

 

Another issue with Python, that I forgot before you brought it up here, is that it is object-oriented. Whenever you are dealing with objects, its gonna get messy because it is difficult for someone that needs to read the code to understand that the third parameter there is an object that you have created. I get your point SSL and I agree as I said: If you write a piece of code and you name your variables and methods correctly, it should be crystal clear what they are and what their purpose is. However, that is not always too easy for beginners. So as I said, I think we agree. 

And again to OP: Don't start out with a dynamically typed language. Other than that: figure out what you want to use programming for, then pick the best language to do exactly that. The language is just a tool, as someone said earlier, you wouldn't use a spanner to hit a nail into a piece of wood. 

 

Sure. Poor implementation of objects (Python is not OOP even if it wants to be) is a legitimate criticism of Python. It's also a good criticism of Java.

 

7 minutes ago, fizzlesticks said:

You lose duck typing, which is a huge part of Python.

 

Is that really a loss, though. 

Link to comment
Share on other sites

Link to post
Share on other sites

22 hours ago, fizzlesticks said:

Python is strongly typed though. Are you thinking of statically typed?

This has been bugging me a bit...but I figured bringing up weak-strong vs static-dynamic might be a bit of a derail.

 

Other than that @SSL has said my thoughts far better than I could have.

Link to comment
Share on other sites

Link to post
Share on other sites

The way my Uni does it's CS classes is the first actual required class is in C which teaches the fundamentals of programming (arrays, loops, recursion, files, etc). If some people need an introduction to computing and programming concepts, there is an introductory class in Python that is used to explain broad concepts.

 

The next class moves to C++ in order to teach data structures, search and sorting algorithms. 

 

There are a few other classes that are advanced electives that teach Java, COBOL, and a few others I think (I'm not entirely sure what they are since I'm a NetSec major).

[Out-of-date] Want to learn how to make your own custom Windows 10 image?

 

Desktop: AMD R9 3900X | ASUS ROG Strix X570-F | Radeon RX 5700 XT | EVGA GTX 1080 SC | 32GB Trident Z Neo 3600MHz | 1TB 970 EVO | 256GB 840 EVO | 960GB Corsair Force LE | EVGA G2 850W | Phanteks P400S

Laptop: Intel M-5Y10c | Intel HD Graphics | 8GB RAM | 250GB Micron SSD | Asus UX305FA

Server 01: Intel Xeon D 1541 | ASRock Rack D1541D4I-2L2T | 32GB Hynix ECC DDR4 | 4x8TB Western Digital HDDs | 32TB Raw 16TB Usable

Server 02: Intel i7 7700K | Gigabye Z170N Gaming5 | 16GB Trident Z 3200MHz

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, Yamoto42 said:

This has been bugging me a bit...but I figured bringing up weak-strong vs static-dynamic might be a bit of a derail.

 

@fizzlesticks is correct here. Python is dynamically typed because it performs type checking at runtime. And it is strongly typed because it will never automatically convert one data type to another (such as adding a string and integer together automagically resulting in conversion of one of the terms to produce a single result).

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, Yamoto42 said:

This has been bugging me a bit...but I figured bringing up weak-strong vs static-dynamic might be a bit of a derail.

It was a side argument that Python and similar languages promote bad programming practices because they don't have static typing.

Link to comment
Share on other sites

Link to post
Share on other sites

Yeah, @SSL, I wasn't disagreeing with @fizzlesticks.

 

I was stating that confusing the static-dynamic with strong-weak is a pet peeve of mine...a bit of CDO on my part.

 

 

9 minutes ago, M.Yurizaki said:

It was a side argument that Python and similar languages promote bad programming practices because they don't have s

And yeah, if you know what you're doing that's not a problem.   I will say, though, the python standard library's' documentation could use a bit of work on that front.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Yamoto42 said:

And yeah, if you know what you're doing that's not a problem.   I will say, though, the python standard library's' documentation could use a bit of work on that front.

The one major issue I see with dynamic typing is if the variable name isn't clear enough, you don't know what data type it is... but that just goes full circle to what SSL was saying about meaningful variable names to begin with.

 

Or you could be everyone's enemy and do Hungarian Notation.

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, SSL said:

it will never automatically convert one data type to another (such as adding a string and integer together automagically resulting in conversion of one of the terms to produce a single result).

both a blessing and curse xD 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×