Java or Python
13 12 Aug 2015 23:54 by u/Dandygram
Hey everyone,
I wanted to get some opinions about what I should consider learning. I currently work as an email developer, but I would like to branch into more programming. the easiest access I have to learn would be to make pet projects with the APIs of my email platforms. I know both Java and Python are used for these calls within my company. what are the key differences between these languages for this type of work, and why should I choose one over another.
any suggestions are helpful, thanks!
37 comments
12 u/WillyWillyBumBum 13 Aug 2015 03:11
Python all the way. It let's you get things done rather than having to worry about verbose syntax. You can't avoid Java in the long term, but Python is the best way to start. As for others recommending C, it's a terrible choice for first language. You need to know how it works, but please don't use it on a regular basis unless you're hacking kernels.
C die-hards shouldn't feel personally offended, but you can't deny that a huge chunk of bugs in all software comes from people (from newbs to pros) making silly mistakes when managing memory. Just take a look at a random sample of CVEs, I can guarantee you at least half have to do with bad memory access. I always discourage C usage unless it's for embedded or performance critical parts. C++ is a step in the right direction.
1 u/drifting 13 Aug 2015 18:35
This comment seems to boil down to take it easy at first. Some like jumping head first into the deep end...
1 u/koalakareklub 14 Aug 2015 02:53
At work we have this analogy, swimming in the shallow end or deep sea drilling. Start slow and build piece by piece or go all in. I've come to find the shallow end is always more beneficial. Its like this: You want to do 20 pull ups, but you've never done a single pull up. Its discouraging after the first or second try to keep attempting all 20. Yet, setting a smaller goal of hitting 1 pull up, than 2 pull ups the next day, and so forth. It helps break the goal down, you feel more accomplished, and much less overwhelmed. To each there own, thought. Just make sure you come up for air, you don't want to get lost down there.
0 u/alexbuzzbee 15 Aug 2015 02:12
Or kernels. Kernels usually have at least some C.
3 u/TheGuyWithFace 13 Aug 2015 21:50
Sorry I'm a bit late to the party, but here's my two cents:
If I were you, I would learn both eventually. That being said, while there's a good chance you'll want to use both at some point, each language has a very different use case.
Python is an awesome scripting language. It focuses on forcing you to write concise, very easy to read code. Python programs are some of the easiest there are to understand. It is a dynamic (but fairly strongly) typed language, meaning you can assign a number to a variable, and then overwrite that variable with something else of a different type, but it will not implicitly convert one type to another. ("1" + 1 will throw a type error, for example.) Basically, it's flexible but not too flexible, easy to read and learn, and has excellent documentation. Throw in its awesome standard library that lets you use it in almost any context, and you have an excellent language for shorter side projects and one-off scripts.
Java, on the other hand, is a much more heavy duty language. Java is a very verbose, strict, statically typed language. A good example of this is that when you declare a variable, you have to explicitly declare what type that variable will hold. If you ever try to assign anything to that variable that is another type, an error will be thrown. Now, this adds a lot of extra overhead from a new programmer's perspective, because you will write a lot more code for new, smaller projects than you would for something written in Python. (or just about any scripting language.) On the other hand, when working on a larger project, this behavior is invaluable, as the compiler can catch a lot of hidden bugs or mistakes you might make when changing the code that a scripting language couldn't catch. Also, Java is very much bound to Object Oriented Programming (OOP). If you haven't learned much about it yet, Java will take more effort to learn than something like Python, but you will learn a lot more, and OOP is another nice thing that helps to keep larger codebases maintainable irrespective of the language itself.
To sum things up:
Python:
Java
As I said, I think you should learn both at some point, but which one you learn first depends on what you currently know. What languages have you used so far, and for what?
0 u/FFX01 17 Aug 2015 18:34
I was under the impression that Python is also OOP.
1 u/TheGuyWithFace 18 Aug 2015 00:35
Python supports OOP, but it's not tied into it in the same way that Java is. You can write an OOP program in Python, but you can also write off a quick script without ever writing a single class. OOP is absolutely mandatory in Java, it is literally impossible to write a java program without writing at least 1 class.
Or in other words...
“Ah you think OOP is Python's ally? Python merely adopted Object Oriented Programming. Java was born in it, molded by it.”
0 u/FFX01 18 Aug 2015 17:04
I see, thanks for the explanation.
2 u/koalakareklub 13 Aug 2015 04:44
Javascript Developer. Python was the first language I was taught while studying Computer Science. It was quick to grasp, pretty forgiving when making mistakes, and can provide a lot of options. I work with Java sometimes when trying to communicate between platforms like Android. I find it hard to work with at times (bugs, limitations with in the language itself, a bit slow, etc), there are more robust options in everyday applications with Java though. Python has a lot of potential as well, I have friends using it to code particle systems, fluid dynamics, and plugin functionality for their company that does CGI for block buster movies. I did find it hard at first to switch from python to C/C++, yet I highly recommend Python to start and see where it takes you.
1 u/Dandygram [OP] 14 Aug 2015 20:42
Thanks, I do a bit of JS, but not as much as I'd like. Now I use mostly Ampscript, Velocity Script, and Zephyr, but I need a "real" language to move forward with this. The only reason Java is a question is because my predecessor was a Java dev so he wrote some tools in that, But it sounds like Python would be easier than trying to jump into his work and building off of that.
0 u/koalakareklub 15 Aug 2015 04:32
Are there any particular applications or areas your trying to get involved in? Maybe picking a language that revolves around that is the best option than just Python or Java. Don't know your context so just asking questions. Ive found Javascript to be one of the most universal languages so far. It has a vary easy entry level, yet provides some very complex systems. WebGL, back end with Node Js, MVC, frameworks, pipeline communication between other languages, Socket IO, etc. Ive recently began to dabble in Arduino and Rasberry Pi 2, with the help of javascript and node.js I can create a gateway to communicate with different hardware. Access the hardware over the web from any point, its quite nice the flexibility and openness Javascript brings. That being said there are tons of other languages that have multiple uses and extensions just like Javascript. Best of luck to you mate!
1 u/Tingfar 13 Aug 2015 02:11
They're both used heavily in industry, learn both. Python is probably the easier of the two to learn unless you've already got some C background in which case Java will seem more familiar.
1 u/xaric 13 Aug 2015 04:06
Python, all the way. I'm a .NET developer, and despise Java for the few times I've had to use it.
1 u/bananacakes 13 Aug 2015 17:40
What language do you know now?
As people have mentioned, Python is probably easier to start with.
1 u/synergy 13 Aug 2015 18:33
Both are good to start with. Java might have a higher learning curve but will force you to learn the basics of Object Oriented Programming early on. Python you can get away with not learning about it for a while.
I'd recommend http://learnpythonthehardway.org/ if you decide to go the python route. Python would also be more useful than Java if you want to write some scripts for automation.
1 u/moses_blimey 13 Aug 2015 18:56
Start with Python.
But first, get a GitHub account so you have a centralized location to store all of your code. Create 1 Git repository for each project including tiny projects such as "hello world!".
You won't learn anything if you're disorganized.
0 u/Dandygram [OP] 14 Aug 2015 20:38
Thanks, this is a great idea
0 u/kronal 13 Aug 2015 02:47
Python is great for small and simple prototypes or tools.
If I have to program for the Java Virtual Machine, I'd use some other language that targets it like Scala, Groovy, or even Jython for small projects (which is Python that runs on the JVM). That's because I don't see the point of Java's way of doing things, it's philosophy and the way they decided to implement it just seems backwards to me, although they have abandoned part of that and are moving to greener pastures, which places them about 10 years behind other languages, but still, better late than never.
0 u/Pawn 15 Aug 2015 06:58
Go hard like a big dog. Java, but why not both?