Beginning Programming - Language

No replies
Kayin
Offline
SX Retired
Joined: 2008/10/09

Whenever I talk to someone who wants to start programming they inevitably ask - what language should I start with.

So I'm going to answer that publically here.

Note: Other programmers may disagree. Those half-baked programmers would be stupid, ugly, and fat Smile (I'm kidding - but really others may disagree)

Assembly
------------
Starting with Assembly will benefit you greatly later but drive you completely insane at first. All languages are basically short hand for assembly anyway but the difference is staggering.

C was invented so that you didn't have to write Assembly by hand anymore.

Scripting Languages (Perl, Python, Ruby, PHP, Javascript, Applescript, Actionscript... anything with script after it)
-------------------------
These are not programming languages. These REALLY should be called 'extension languages'. The reason is that they are interpreted and run by another application. Scripting languages are for the purpose of controlling the behavior of another application. Programming languages are the application. This is a little more confusing when you get to Perl, Python, PHP, and Ruby. Those are far more robust scripting languages that sometimes can be specially compiled as any other programming language. Often times I'd rather write an application in Python than I would in C#... simply because it's easier and there's less bullshit. STILL I wouldn't recommend beginning with it though.

Reasons why I don't recommend you start there:
1. Loose Typing. Sometimes even no types. If you're going to be a half way decent programmer, you need to know what Types are - and what they are with some level of depth. You need to be familiar with an int, char, long, and the difference between them. If you don't start off in a strongly typed system then you'll overlook the importance of them and produce inefficent code as well as encounter MUCH frustration when moving in to lower level languages like C.

2. Hand holding. This is true of some more than others. Python is pretty good at not holding your hand. Javascript on the other hand is f'king terrible. What I mean by hand holding is that the languages reads into your code and tries to figure out what you're trying to do and account for YOUR error INSTEAD of just breaking with an error. If you're learning to program than you need to learn to do it right - not half right. Not to mention the errors you do encounter can be very fuzzy.

ADVANCED NOTE: Scripting languages are notorious for this just by their nature. The code is being interpreted by other code rather than being run by statically defined machine instructions. Compilers are also guilty of doing this but compiler designers are a bit more conscientious of this and tend to prevent it.

3. Lack of Good Error Reporting / debugger. When you're learning to program you make mistakes. A lot of them. Duh. It's good to know what those mistakes are. Scripting languages are notorious for bad error reporting. The perfect example of this. Javascript I consider javascript one of the hardest languages to use simply because the error reporting is HORRIBLE. You HAVE to resort to using special tools which enhance the error reporting. Firefox has half way decent built in javascript reporting. Firebug is also a good extension. IE actually has a debugger for javascript but it sucks ass in terms of other debuggers.

C
--
C is a solid language that will still be used for generations. If you're going to be a good programmer then I would even say you HAVE to learn C at some point in your life. Every other major language out there has been influenced by C in some way or another.

With that said. I wouldn't recommend it to start with for the following reasons, and it ultimately boils down to just being old with an old api.

1. C requires you to be a little extra aware of computer memory. This isn't a bad thing - in fact it's one of its strengths and definitely one of the reasons it's still used. You can do things faster than you can in other languages. However - memory management isn't really a beginner concept. Older programmers will disagree with me. It USED TO BE a beginner concept because IT HAD TO BE. Now a days - it doesn't have to be, so it isn't.

2. Forced use of pointers. Pointers are not a bad thing. It's a REALLY good idea to learn about pointers. If you're going to write a program over 500 lines of code - you pretty much have to know the concept of pointers. However - just because I know what a pointer (reference) is, doesn't mean I want to explicitly use it. The reason is that I may accidentally dereference a pointer and the resulting error is really confusing.

3. Platform and compiler dependence. How your program compiles on GCC 3, may not be the same as it compiles on GCC 4 or even on Borland C on Windows. Errors resulting from compiler stupidity is a huge pain in the ass that you'd much rather avoid until you understand what a seg fault really is and what the compiler really does. I was trying to learn C on a custom Slackware system with the unstable version of gcc. This was a mistake.

4. Procedural Paradigm. Programming paradigms are important to learn. The most popular is Object Oriented Programming. There's a reason we do Object Oriented Programming these days and it's best to learn to do it the better way first. Object Oriented Programming is also a "Paradigm" which means a "way of thinking". It's good to learn the OO way of programming first as its easier to move back to a procedural, functional way later. It's good to note also that you can always do procedure programming in an OO language - but not OO programming from a procedural language. Smile

C++
-----
I also don't recommend it for starting. The reasons are similar arguments to C but I'm going to add a couple

1. Horrible Documentation - Come on C++ programmers.. you know I'm right. When you're learning to program it's good to know what the function you're calling is actually doing.

2. Object Oriented features in a half way OO language. This is personal opinion and I'll catch flak for it but I'll defend this position. C++ is NOT an Object Oriented Language. It's no more OO than Perl is. They both have OO features but they API and the language itself is NOT OO.

VB (.NET)
-------------
VB.NET is functionally identical to C#. You can easily convert from one to the other. There are many programs to do that. The only reason I don't recommend VB.NET is it's syntax. A majority of code out there uses the C-style Syntax. You may as well learn that syntax from the start because I guarantee you'll have to learn it later.

- VB 6 and before was loosely typed and of course I don't recommend that as I explained earlier. VB.NET is strongly typed but the types are not as apparent due to the VB syntax. So I don't consider it as healthy to start on as something like C#.

What I do recommend
----------------------------
Java - It's strongly typed, it's OO in every way shape and form - even to the point where it hinders you at times, it has Extermely good documentation with access to very well defined libraries. Java is also the academic standard which means everybody's learning to program in Java. That doesn't make it the best choice but DOES mean it has the most examples Smile Java was really created to make up for the annoyances of programming in C++ and it does so quite well. Java is not a perfect language but it does provide all the necessary programming fundamentals to introduce you to programming without wanting you to go crazy. Java was written by OO purists so it's quite consistent with it's APIs.

C# - This is very similar to java. Most people think microsoft ripped java off - and to some extent they did. But they also improved on Java quite a bit. C# is more powerful than people realize - did you know you can do pointers in C# if you need to? even in a managed environment? - That's all irrelevant to new programmers though. C# provides a very similar experience to programming that Java does and is equally acceptable to learn on.

These 2 languages are 'managed' languages. That means there is a runtime environment that manages all the low level details (like memory management). This takes care of a lot of annoyance WITHOUT holding your hand. This is good.

Another bonus of these 2 is that they're well designed which encourages and in some cases forces your code to be well designed. Good design is MAJORLY IMPORTANT when it comes to software. Your software WILL BE SHIT if it's not well designed. Period. This has been proven time and time again. A language that encourages good design is a very good starting point. Get this into your blood early and you'll benefit from it for the rest of your programming life.

-K