I’ve been enjoying working with C++ and Python for 6 months now in a very interesting project that might change the way people look at storage in data-centers and the mix of using such extremes is because sometime you want fine control over memory and CPU instructions and sometime you just want to get things to work with less headache.
I’ve also been using Java for quite sometime now and I’m using java these days in my project CAT-SCMP that I’m really happy with it and with its progress, and I was thinking about the differences between python and java and when/where to use any of them, after some thoughtful thinking and practical experience, I’ll tell you
Java is quite amazing and I like lots of things in Java as a C++ programmer, the language has small vocabulary and consistent thinking in almost all of its API and the performance is stunning even if you are writing I/O programming you can still achieve performance that can really compete with what you can do with C++, especially, while using Java NIO.
Also, it’s platform independent so compile-once, run-any-where is a bless specially for people like me who take care of the differences between operating systems behaviour and different system calls / API. Java is excellent in portability and does lots of healthy emulation for things that are not available in the operating systems and uses the direct calls to the system calls if they are available.
Python is really amazing too but for different reasons, it’s an amazing language for prototyping in general, so you can get something that can really work in one third the time you will spend on Java doing the same thing, and the dynamic typing is really cool, you don’t have to worry much about types and you can hackingly use the duck-typing that is pythonic, easy, and fast.
However, python will really encourage you to break the rules and does encourage design-less programming which I don’t really like, some people say that iterative programming means that you don’t have to design before you start, this is WRONG, you might want to read the legendary article from Martin Fowler (Is Design Dead?)first before you say that again.
Python will also help you to do more while typing less, but the performance is 1/50 of java, it’s not bad if you are writing something that is small but I really can’t see that it’s good for large systems, Java is really superior in the overall performance compared to python.
Also, python is not so much compile-once, run any-where thing, because some of its standard library methods are not even available on all platforms, so you have to be sure that you write code that is portable (it’s your responsibility) or you may want to involve a continuous integration system to make sure that you have your system running all the time on all the systems that you are targeting.
Conclusion:
- Java is for larger, well designed, portable, and highly scalable systems.
- Java achieves excellent performance for overall system performance.
- Python provide much faster development and allows less thoughtful designs.
- Python is really excellent for small systems, Gui’s, system administrators.
- You can still do some enterprise work with python, but you have to create your own boundaries and enough documentation.
- Java is not very good in GUI and generally slower than python in that particular area because of the platform independent windowing it’s using, while Python is much faster because it has no windowing and it uses whatever native library you choose like PyQt, or PyGTK for example.










by DanDona
10 May 2009 at 15:51
i loved this article not just becoz i love comparisons w eno 7ad yegebly men el a5er all i need 2 know , but also becoz i wanted really to study something beside work and i was alittle confused wether to start wiz java or python and a second programming language , my background about java is kinda little and i need to read more about it , so i guess java wins @ least this semester
by HaTiM SuM
10 May 2009 at 18:02
It is really great post ya AHMED
I love the comparison point and Also focusing to design issue (It is really important)
because it minimize the cost whatever what the programming language that you will use to implement your work
Great Thanks for this post ya AHMED for sharing us your experience working with those awesome languages
by Ahmed Kamal
10 May 2009 at 20:39
Very well put, I totally agree
by Mohamed Elshami
12 May 2009 at 08:49
Assalmu Alykom,
, ty ahmed for sharing as usual
.
Really nice Post
by Shady Youssef
12 May 2009 at 14:46
Totally agree
Python is your everyday tongue that you use to think, talk issues out, and present and share your ideas
Following that metaphor, it won’t feel right to write a novel or a great piece of literature in such language, so here Java comes to play
so, where that leaves us with C++, guess you can consider it Italian, a beautiful language, the language of Dante still until the world map changes, it is spoken only in one country in the world … Italy
by Mohammed Azmy
12 May 2009 at 16:33
I hate this (who is better that who) comparison between programming languages and stuff like that. I always believe that different technology can live together happly.
what I mean is that it’s better to make languages complete each others. for example we can build the core with java to gain performance, then extend the core with python or even javascript. so we can gain the best of both.
a great example of this is Blender 3D, you know this amazing 3d studio it’s heavily extendable with python although it’s core is built with C and/or C++
by Ahmed S. Farghal
12 May 2009 at 16:43
well, it’s a win-win ya mohamed, I mean those comparisons are very important to help and assist newbies to choose the right language for the right purpose, every language is good in some area and provide features that the others can’t so you need to quickly decided which language to be used on which projects.
and yes, I’m really fond of doing things on top of each other specially if the core is C/C++ or Java and the upper layers are in anything that is quick and easy like python.
so, you should stop hating this
because it’s not who is better that who, but it’s who is good in what.
by Sinar
12 May 2009 at 17:34
I love the comparison, I believe it’s very useful for the beginners, Python is awesome, it’s a tongue language I didn’t use it so much yet, but it amazes me each and every time I do so, how simple and easy it’s, which on the other hand makes it reasonable that it’s not for large or highly scalable systems and projects.
My knowledge about Java isn’t so strong, but i always have this feeling that it’s a real powerful language.
thanks for the nice conclusion
by gorlok
12 May 2009 at 19:41
Why not Groovy?
by alex
12 May 2009 at 23:58
I’m not sure why you say that Java is bad at GUI. Swing is awesome to my liking. Python is great on Google App Engine.
by Dino Kasem
13 May 2009 at 08:41
@GORLOK : I guess you are using your mind !!! .. Sorry ( For everyone else !!! ) …
Guys .. you need to read more about new technologies !!!!! … Groovy is JAVA .. yet it is loosly typed !! means .. it compines the power of ( Python, Ruby ) syntax and the power of java portability, huge API ,, and performance !!!!! …
Groovy is a syntax ( scripted and/or compiled ) – ( structured and/or ObjectOriented )
I guess you need to read more about groovy …
by Ahmed S. Farghal
13 May 2009 at 09:54
@alex: Swing is too slow on most platforms, look at netbeans and compare it to SWT like eclipse
@Dino: Python is generally more mature than groovy and groovy is actually more ruby than python and I don’t like ruby
but maybe later I’ll put them both under heavy tests and see….
by Dino Kasem
13 May 2009 at 10:11
Actually .. I don’t know .. wheather Groovy is more of python or ruby !? .. I know neither !! but … I know that Groovy and Python .. both are using very compact syntax … comparing them at this point .. put them in equality …
But, the asuumption of python being more mature than groovy !! is not True !!!… Yes groovy is a newer language but uses all the old nice mature features of java !!! makes it as powerful as java which is way mature than python !!! … ( Add Grails framework to the talk !!
)
Moreover, for Swing and PyQt or PyGtk Libs !!! Its totally up to you to make your application Platfrom DEPENDANT !! … But, you can consider using a gui platform that makes life easier .. like netbeans platform or eclipse’s ( which I dunno any about !! ) .. to speed up your GUI dev time, making your application pluggable and componentised .. and allows u to put more focus on your business code !!! I don’t think there is a platform like those .. in python ( I really didn’t hear of one .. if u know just tell !!! ) !!!!!
I Don’t think [ You do choose a language because of its easy syntax only !!!! right ? ]
by Ahmed S. Farghal
13 May 2009 at 11:01
well, seems like I need to re-declare that Groovy isn’t the topic of that article. about the GUI thing, I don’t understand your point here? I didn’t say that Java is tied to Swing, you still can use SWT that uses the native implementations as possible and is very fast indeed. (btw, SWT is platform independent as well, and also Qt and GTK runs on almost all platforms including Unix/Linux/Windows/Mac)
Anyway, I’m not a GUI programmer anyhow and by putting Groovy/Ruby/etc. out of the comparison, python is more robust and allows you to write less to do more so it really helps you to focus only on the business logic.
by Hend Awad
13 May 2009 at 15:07
Nice article Ahmed
Regarding the comparison,
I did not see it like who is better than who, I believe that different programming languages are just like different persons, each has it’s own personality, Strengths, and Weaknesses ,
So, knowing the strengths areas of each language gives us the Maximum benefit of each of them …
Thanks
by Mahmoud Tantawy
09 Jun 2009 at 14:54
nice share and great comparison really..
thanx 4 yr time writing this