Comments on: First Programming Language – Python/Ruby? http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/ I will not fix your computer. Tue, 04 Aug 2020 22:34:33 +0000 hourly 1 https://wordpress.org/?v=4.7.26 By: Jason Aren http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10801 Mon, 24 Nov 2008 20:42:23 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10801

Thanks Luke.

Given that I don’t have a firm foundation in any programming language yet and have just hacked around with Java, PHP, and Python, with which would you start? I don’t expect to work seriously on a big project at this point – I realize I have a lot to learn – but would like to set myself up to start doing some (minor) work on the project ASAP.

Basically, I want a good language to learn from, that will be a good stepping stone to other languages, and that will be useful for AI / Natural Language, some data analysis, and web/network (though I know a decent amount of php, so can use this for web stuff that is not performance critical).

Reply  |  Quote
]]>
By: Paddy3118 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10793 Mon, 24 Nov 2008 16:01:32 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10793

Python lags behind a bit, but if you use Psyco you can pretty much compete on speed with Ruby

I think you mean compete with Java. Normal Python is faster than Ruby.

Reply  |  Quote
]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10792 Mon, 24 Nov 2008 14:51:37 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10792

Only if you are terribly worried about performance issues since these days Java ships with a better JIT compiler and performs better under most circumstances.

Here is another benchmark which shows that to beat unoptimized Java, you actually need to put some thought into your C code. Python lags behind a bit, but if you use Psyco you can pretty much compete on speed with Ruby.

The thing about Java is that it is a forest of syntax compared to Python. It is statically typed, and loooves boilerplate code.

Here is my thing: I think it is good to learn new languages. I’d suggest picking up Java, and messing around with C++ just to see how they work. Do few small projects with them and see how you like them. Since you know Python fairly well you should probably stick with it while you are learning new concepts since it won’t take much effort for you to “think” in that language. Trying to learn something new in an unfamiliar language can be a bit overwhelming. Besides, most of these things are universal and you can easily translate algorithms and pattens between languages.

I guess what I’m trying to say is not to commit to a single language. A lot of people make this mistake and box themselves in as Java developers or C developers and they never branch out. The truth is that a programming language is a tool – and you need the right tool for the right job. Some things are done best with Java, some should be done with C and some should be approached with a highly dynamic language such as Python or Ruby. It depends. A good programmer can switch languages like gloves.

If you are fairly proficient with Python then it might only take you 2-3 weeks to become “fluent” in Java. Same goes for C++ – if you commit yourself to a project and you work on it for few weeks you will notice that you can suddenly think in that language fairly well.

So I’d say, learn both C++ and Java and see which one you like better. Ok, here is the list of languages you should definitely dabble in at least a bit before you die:

– C++ (low level stuff)
– D (to see C done right)
– Java (high level, static typing, OO madness)
– Lisp (the be all and end all in functional languages)
– C# (just to see how the .NET ecosystem works)
– Perl/PHP (for the shits and giggles)

So…. Um.. Yeah, I’m not much for advice here, eh? I’d say stick with Python if you are about to start a new huge project. If you think that C++ or Java will give you better performance, then try them. Java might be easier to pick up because you have garbage collection and no pointers.

And again, if you already know a programming language, learning another one is just a matter of few weeks. :)

Reply  |  Quote
]]>
By: Jason Aren http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10785 Sun, 23 Nov 2008 21:42:21 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10785

So would you go Java over Python for my purposes?

Reply  |  Quote
]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10784 Sun, 23 Nov 2008 20:25:00 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10784

@Jason Aren: C is not really a language for doing web stuff. You are best to stick with Python and/or Ruby for that. Or pick up Jython (python that runs on JVM). I think it is quite fast now, and will allow you to work inside of a Java based ecosystem.

For data analysis, language processing and all that stuff it is really a tossup. The whole “C is faster because it is compiled” thing is a myth. It used to be true back in the day, but the technology grew by leaps and bounds these days. The truth is that a JIT compiler can optimize stuff at run time – it can actually see what is going on, what kind of data you work with and choose the most optimal way to compile it. A traditional compiler does not have access to this information at compile time. So interpreted languages can be as fast as compiled ones these days – if not faster.

If you use C for language/list/data processing you are going to have to write a lot of code to test for array bounds, make sure your memory is allocated and released properly. To me this is more work than it is worth. If you stick with python it will make your life much easier.

The only area where I would recommend using C would be writing operating systems and/or compilers where you actually do want to be anal with memory location.

Reply  |  Quote
]]>
By: Jason Aren http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10783 Sun, 23 Nov 2008 05:59:55 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10783

Luke Maciak –

Thanks for the advice. Since my life is serial right now and not parallel, I need to chose one over the other at this point.

My interests: AI, natural language processing, data analysis (financial, economic) and web/network (for pulling / pushing data and text).

Will going from Python to C put me at any disadvantage than doing the reverse? My thought is to do Python, and when a situation where I need better performance, start working on C.

Thanks again!

Reply  |  Quote
]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10782 Sun, 23 Nov 2008 03:24:35 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10782

@Jason Aren: Well, I’d say it depends on where you want to go with this stuff. You should definitely mess around with C for the low level but there is other stuff you want to learn.

For example, buy yourself few books on patterns and algorithms. Algorithms especially can probably be better understood when working with a language such as Python. They just have a nicer syntax so you can actually see the logic of your code past the boilerplate!

So C will let you become a better programmer teaching you about memory management and different ways to optimize your code at the lower level.

A higher level language will help you learn the high level programming stuff – you know, the knapsacks, traveling salesmen, graphs (graphs are important!), trees and etc..

Reply  |  Quote
]]>
By: Jason Aren http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10775 Sat, 22 Nov 2008 03:57:13 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10775

I am not a complete “newbie” to programming- I have done some basic programming in java (I finished one of those “21 day” books doing all of the examples, and yes, I know they don’t make you a programmer!) and I have hacked together several web sites using PHP and wordpress. I understand the concepts of constants, variables, if/then statements, for loops, etc. and OO programming.

Now I want to master a language. I am leaning towards C, as I understand it will give me a good foundation as a programmer (learning about memory management and lower level computing) and make other languages easier to learn. My concern with Python is that I already know the basics of programming so it might be a better use of my time to learn something lower level as a foundation.

Thoughts?

Reply  |  Quote
]]>
By: Paddy3118 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10671 Wed, 12 Nov 2008 04:46:53 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10671

With Python first and not dropping it, you get an easy intro to programming – proceedural, OO and functional styles.

move on briefly to assembler, then C (not C++), so you can teach about computers from the ‘lower-levels’ i.e. what’s under the hood. You can switch back to Python for those wanting to program things like games, GUI’s, CGI, databases, concurrency, data munging, …

– Paddy.

Reply  |  Quote
]]>
By: IceBrain http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10667 Tue, 11 Nov 2008 20:06:41 +0000 http://www.terminally-incoherent.com/blog/2008/11/10/first-programming-language-pythonruby/#comment-10667

I started using BASIC aswell and learned Javascript, C, PHP, Python and some other languages for 7 years before going to college and having my first programming classes.
My first BASIC interpreter was a chinese video game which couldn’t even save the code, so I would write it on paper and rewrite it every time, and loved it! :P

But yes, Python is much better as a learning language, although I like the strict and controlled memory consuption of C.

Reply  |  Quote
]]>