Pages: 1 2 [3] 4
|
|
|
Author
|
Topic: Programming (Read 7704 times)
|
superbutcherx
*Many bubbles*
Offline
Posts: 116
|
I have to agree with onpon4 and Novus: Python is an excellent language for its clean, intuitive syntax and ease of use (especially when learning it as your first programming language): For example you don't have to muck around so much with different variable types as in C/C++ and it's more straightforward to manipulate files and use system command line commands. Java puts me off with its unnecessarily long-winded syntax (the likes of system.out.println vs Python's print).
I've been programming stuff for network simulators for a living a while now. My main tools have been both straight C and C++. I think those are still the "bread and butter" of programming languages in the engineering world. They tried to introduce Java in place of C in the introduction classes here in the university's computer engineering studies some years back , but have since quietly returned to teaching C.
In addition Python has been a lot of use for me when programming scripts for extracting results from tens of thousands of files. That could've been done also in C/C++, but would have been a more tardy way, with all the compilations and the quirkier format for file manipulation.
|
|
|
Logged
|
|
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
It was a serious question. The original version of the question, before I edited it away by accident, followed up, "If print does that by default, how do you not have it automatically end the line?"
Looking at the answer...
Interesting that print was demoted to function from core syntax.
|
|
« Last Edit: August 19, 2010, 10:19:09 pm by Death 999 »
|
Logged
|
|
|
|
superbutcherx
*Many bubbles*
Offline
Posts: 116
|
Java's print syntax is not unnecessarily long-winded. Flexibility and clarity come at a reasonable cost in length.
Well put! There's always pros and cons in every design choice and that's why no language can be claimed to be absolutely better than another one. For certain tasks and purposes, yes, one trumps the other, but not for every one of them.
What I meant to convey with my "unnecessarily" was that from learning-your-first programming-language point of view, it might be confusing to face a wide array of flexibility and options, when all you need for your specifc purposes is just one of them.
In that infamous basics of programming class we only used System.out.println for that one purpose -printing lines on screen-, and received quite a little in the way of explaining what is this System, why does the command come only after all those prefixes, or how it could be declared shorter as you showed in your example.
Now that I think of it, that's more a fault of the teaching being bad than the language being unwieldy. I think the teacher tried to achieve both: a) Show us students the versatility of java by demonstrating long-winded commands b) make it easy to learn by not painstakingly explaining all the details of the command, just using one instance of it in practice to see what happens.
Unfortunately, from my POV he failed in both accounts: Typing in long commands without seeing the point in the syntax just made it frustrating for a beginning programmer. This made me veer towards languages that seemed more "sensible" to me at the time.
|
|
|
Logged
|
|
|
|
onpon4
Enlightened
Offline
Gender:
Posts: 709
Sharing is good.
|
In that infamous basics of programming class we only used System.out.println for that one purpose -printing lines on screen-, and received quite a little in the way of explaining what is this System, why does the command come only after all those prefixes, or how it could be declared shorter as you showed in your example. Now that I think of it, that's more a fault of the teaching being bad than the language being unwieldy. I think the teacher tried to achieve both: a) Show us students the versatility of java by demonstrating long-winded commands b) make it easy to learn by not painstakingly explaining all the details of the command, just using one instance of it in practice to see what happens. Unfortunately, from my POV he failed in both accounts: Typing in long commands without seeing the point in the syntax just made it frustrating for a beginning programmer. This made me veer towards languages that seemed more "sensible" to me at the time. That's what I don't like about YouTube user thenewboston's ("Bucky") video tutorials. I've only seen his Python tutorials; there were a ton of things, especially in his wxPython tutorials, that he didn't explain; he just said "do it, I'll explain it later" and never explained them. This is a horrible long-term teaching strategy; it is VERY frustrating to be forced to use something you don't understand, especially because you don't understand how to properly manipulate it, yet almost every teacher seems to do this.
|
|
|
Logged
|
|
|
|
|
Novus
Enlightened
Offline
Gender:
Posts: 1938
Fot or not?
|
umm. Some languages, even serious ones, are just bad. I can't think of any reasonably modern programming language that is worse than fortran 77 at anything, except that java's 'hello world' is longer than fortran 77's. If you actually do anything more complicated than calculate the factorial of something, the balance shifts back.
A programming language doesn't get that popular without doing something right.
I take it you've never done heavy-duty numeric processing; physics simulation people tend to swear by Fortran, even FORTRAN 77. Built-in complex arithmetic, lots of opportunities for compiler optimisations that pointers and references prevent, lots of high-performance numerical libraries; these are things that e.g. the C/Java branch of languages doesn't do or doesn't do as well as even FORTRAN 77. Admittedly, FORTRAN 77 is very annoying and limited in other ways, but that's why we have Fortran 90 (and later versions), which adds a lot of things to Fortran that users of ALGOL-like languages take for granted (e.g. recursion).
|
|
|
Logged
|
|
|
|
Megagun
Enlightened
Offline
Gender:
Posts: 580
Moo
|
The problem I have with Python is that it is dynamically typed, which makes having a browser open next to your IDE almost mandatory as there'd practically zero code completion when you need it. This makes researching stuff ("I want to do X, how do I do it") hard, even more so because what some function returns is pretty arbitrary...
Unlike Java, where there is nice static typing, and documentation standards are high. This makes understanding existing code a lot easier, even though code tends to bloat up a bit.
|
|
|
Logged
|
|
|
|
onpon4
Enlightened
Offline
Gender:
Posts: 709
Sharing is good.
|
The problem I have with Python is that it is dynamically typed, which makes having a browser open next to your IDE almost mandatory as there'd practically zero code completion when you need it. This makes researching stuff ("I want to do X, how do I do it") hard, even more so because what some function returns is pretty arbitrary...
Unlike Java, where there is nice static typing, and documentation standards are high. This makes understanding existing code a lot easier, even though code tends to bloat up a bit.
You're not making much sense to me here. The big difference between static typing and dynamic typing is statically typed languages perform type checking at compile time, while dynamically typed languages perform type checking at run time. Dynamically typed languages are also much more flexible, though more resource-intensive, than statically typed languages. This has absolutely nothing to do with availability of documentation.
Ignoring that: First of all, you can easily look up information on specific topics, keywords, modules, functions, and classes by using the help() function in interactive mode. Second, Python comes with a comprehensive and easy to understand manual. Third, there is a great forum, python-forum.org, where many people are willing to answer questions, and most 3rd-party modules have a forum or mailing list you can ask questions on. Considering that Java is far more widely used than Python, it makes sense that it's easier to look up help on Java, but I personally have never had much of a problem figuring something out that I was confused about.
|
|
« Last Edit: August 21, 2010, 06:17:24 pm by onpon4 »
|
Logged
|
|
|
|
|
|
Megagun
Enlightened
Offline
Gender:
Posts: 580
Moo
|
The problem I have with Python is that it is dynamically typed, which makes having a browser open next to your IDE almost mandatory as there'd practically zero code completion when you need it. This makes researching stuff ("I want to do X, how do I do it") hard, even more so because what some function returns is pretty arbitrary...
Unlike Java, where there is nice static typing, and documentation standards are high. This makes understanding existing code a lot easier, even though code tends to bloat up a bit.
You're not making much sense to me here. The big difference between static typing and dynamic typing is statically typed languages perform type checking at compile time, while dynamically typed languages perform type checking at run time. Dynamically typed languages are also much more flexible, though more resource-intensive, than statically typed languages. This has absolutely nothing to do with availability of documentation. Since Python is dynamically typed, my IDE (Eclipse + Pydev) can't determine the type of an attribute and thus can't give me useful info when I want to do something with some value that some random function returned. Unlike my Java IDE (NetBeans, but it should be similar in Eclipse) which happily shows me information on anything I want. This is especially useful when trying to understand existing code. Place the cursor over something you don't understand, hit CONTROL+SPACE, and browse through the documentation of the class of which the selected attribute is the type.
If I get some value (integer, class instance) from a function and want to know what I can do with it in Python, I'd have to manually go through the parent function's code or documentation in order to find out what it actually returns, then go through the code for the returned class to find out what I can actually do with it. In Java, I'd just hit CONTROL-SPACE and that's it. My Python IDE sometimes gives me proper results for autocomplete (I guess whenever the codebase is tiny and it can actually determine what class a given attribute is), but mostly it doesn't.
So, indeed, typing doesn't have any direct influence on availability of documentation, but in practice I definitively noticed that documentation wasn't just on the screen whenever I wanted it quickly.
|
|
« Last Edit: August 22, 2010, 12:18:36 am by Megagun »
|
Logged
|
|
|
|
onpon4
Enlightened
Offline
Gender:
Posts: 709
Sharing is good.
|
Since Python is dynamically typed, my IDE (Eclipse + Pydev) can't determine the type of an attribute and thus can't give me useful info when I want to do something with some value that some random function returned. Unlike my Java IDE (NetBeans, but it should be similar in Eclipse) which happily shows me information on anything I want. This is especially useful when trying to understand existing code. Place the cursor over something you don't understand, hit CONTROL+SPACE, and browse through the documentation of the class of which the selected attribute is the type.
If I get some value (integer, class instance) from a function and want to know what I can do with it in Python, I'd have to manually go through the parent function's code or documentation in order to find out what it actually returns, then go through the code for the returned class to find out what I can actually do with it. In Java, I'd just hit CONTROL-SPACE and that's it. My Python IDE sometimes gives me proper results for autocomplete (I guess whenever the codebase is tiny and it can actually determine what class a given attribute is), but mostly it doesn't.
So, indeed, typing doesn't have any direct influence on availability of documentation, but in practice I definitively noticed that documentation wasn't just on the screen whenever I wanted it quickly.
It sounds to me your problem isn't the dynamic typing, but the lack of a feature that you've become used to in your Java IDE. Honestly, I am not quite understanding the problem, though. Usually I can intuitively understand what to do with a given data type; I don't need to be told what I can do with it. For example, I already know that with a string: - I can iterate through the individual characters (since it is an iterable data type) - Since it is an immutable data type, I cannot append new characters to it (but I can delete the entire string). - I can concatonate the string with another string to return a larger string (perhaps to store it in a variable) - I can pass it as a parameter for various functions and methods (i.e. print) - etc...
Perhaps I'm not understanding you correctly, but you seem to be suggesting that you need to constantly look up how to use different data types properly, and as a result, Python is difficult because it doesn't show you this information unless you look it up in the manual or search for it with help(). If I am misunderstanding, please correct me.
|
|
|
Logged
|
|
|
|
|
Pages: 1 2 [3] 4
|
|
|
|
|