Page 1 of 3

Learning 'Programming'

Posted: Sat Oct 18, 2008 5:25 pm
by Christopher
Hey guys.

I was wondering if anyone could give me some advice/pointers. I’m looking to start learning some basic form/s of programming and I’m looking for some good resources or hints/tips to help me start out. I know there are some keen programmers within our ranks, so I thought it would be worth asking here.

I know it’s a pretty vague request because there are so many different forms of programming, different languages, different pieces of software, etc. I’m looking to learn some general stuff… not so much anything specific, I just want to get a general feel for it so I’ll be able to jump more readily into more specific programs/languages in the future when it’s required of me.

My current level of expertise is spending a semester or two in high school learning some basic HTML and Javascript stuff.

I want to get into this sort of stuff because I’m going to need it in the coming years for university and career related stuff. The more uni stuff I do, the more I get told how important it is to be able to program. As an aside, we had a lecturer on Friday talking about how important it was even back when he was at uni – when they still used punch cards. He even showed us a punch card program he had written years ago. For some reason, there aren’t any programming classes in my unit outlines. And I can’t select any without adding at least an extra semester or two onto my study. So I’ll have to work on it in my free time.

So, does anyone have any tips or good resources for me to try? Like I said, I’m quite a noob at this, so I’m not sure how realistic the idea of ‘getting a general feel for it’ is. If I understand correctly though, there are some languages that attempt to do this?

Thanks in advance. :)

Re: Learning 'Programming'

Posted: Sat Oct 18, 2008 5:55 pm
by Dragonlord
HTML is a Markup Language, JavaScript a Script Language. What you need to look at is:
- C/C++ for Procedural Programming
- Smalltalk/Python/Ruby for Object Oriented Programming

Once you have those two worked out all other languages are more or less a derivation thereof. What goes for C/C++ grab yourself some IDE from the net ( Dev-Cpp is good for starters or KDevelop and company for Linux users ) and just google for C/C++ beginner tutorials. Smalltalk ( squeak.org ) is the mother of OO languages but could be hard to get into for beginners. Python has the advantage of having an "interactive shell" hence you can play around in there to learn the ropes. Search again google for beginner tutorials.

Do not touch Java to learn OOP. It's just a brutal mess ( that should never have gotten into existence ) and teaches you only incorrect and invalid OO practices.

Good luck.

Re: Learning 'Programming'

Posted: Sun Oct 19, 2008 2:32 am
by machf
Hmmm... for someone who doesn't know programming, starting by learning C/C++ may not be such a good idea... I'd recommend some BASIC dialect (possibly FreeBASIC could be a good choice?), to get familiar with some programming concepts at first, then progressing to C/C++. Although if you have some knowledge of JavaScript, that should somewhat help in learning C/C++, as JavaScript borrows some concepts and functions from it (while BASIC and C/C++ have different origins and, as such, can handle some things in very different ways).

Re: Learning 'Programming'

Posted: Sun Oct 19, 2008 10:19 am
by Christopher
Thanks Dragonlord and machf, I've got some starting points now. :)

Also, I see this topic was moved out of smalltalk - my bad, I didn't even know we had this board (shows how much I've paid attention to this sorta stuff in the past). =P

Re: Learning 'Programming'

Posted: Sun Oct 19, 2008 1:39 pm
by Dragonlord
There's a reason for this order. First you start with pure C doing procedural programming. This is the easiest of all since you only deal with a couple of functions to get the hang on the language. Same thing can be done with Python but there you have already the notion of objects which is a next step higher. Beginning with OO is usually a bad idea since the concept of objects ( despite familiar from real life ) is usually a tougher nut to crack for beginners than procedural programming without objects.

EDIT: You can start with a BASIC type language, did this myself in fact. It's a procedural type language after all without the memory to manage yourself. Just don't use VisualBasic. This turns potential programmers into zombies :P

Re: Learning 'Programming'

Posted: Sun Oct 19, 2008 5:37 pm
by machf
Dragonlord wrote: EDIT: You can start with a BASIC type language, did this myself in fact. It's a procedural type language after all without the memory to manage yourself. Just don't use VisualBasic. This turns potential programmers into zombies :P
Hmmm, that's probably one of the most accurate descriptions I've heard...

Re: Learning 'Programming'

Posted: Thu Nov 13, 2008 5:22 pm
by Kovu
I'm surprised that nobody mentioned PHP here.

PHP is easy to learn and use, and allows you to get into the C style of programming. Further, you can do OOP with it too, while the basic way of using it would be linear. Another enormous advantage of PHP is, you can perfectly use it for web-related matter as well as for console and desktop applications... and that while your php-scripts are almost totally cross-platform compatible (hence, no matter if you run it from Linux, Windows or Mac, it would run - with no need to compile for every platform).

To be honest, today (since I ain't a professional programmer, but do it hobby-wise (and for our own book-keeping and POS software in the firm)) I almost only write my programs on PHP. Its simplicity and cross-platform compatibility won.

Another pro for PHP is its excellent online documentation, btw...

Re: Learning 'Programming'

Posted: Thu Nov 13, 2008 7:33 pm
by Dragonlord
PHP is though not a programming language but a markup script language. It has been created for creating dynamic looking web sites ( original name means Personal Home Page ). It is based on a bash like environment with managed memory but the lack of an application scope. PHP fakes this using a session variable and some other tricks but at the end of the day it's okay for learning scripting but for programming it might be a bit exotic. Furthermore you need a web-server all the time and the mixing with HTML code is something which can confuse new players in the game. Python is a better choice there since you have a VM you can tinker around with being standalone and really cross-platform. PHP is not cross platform. Functions are "compiled in" depending on the OS. Therefore using some functions you can quickly hit a wall on another platform ( or even the same OS but a different machine! ) since they are missing. It's a rather large brittle-work and I would recommend this only for those already having touched solid programming languages.

Re: Learning 'Programming'

Posted: Fri Nov 14, 2008 8:09 am
by Kovu
Dragonlord wrote:PHP is though not a programming language but a markup script language.
I have to disagree. HTML is a markup language. PHP is a scripting language. PHP's output CAN BE a markup language, but that's all about it.
Dragonlord wrote:It has been created for creating dynamic looking web sites ( original name means Personal Home Page ).
Yet it's excellent for any other type of software as well. I primarily use it for commandline and GTK applications.
Dragonlord wrote:it's okay for learning scripting but for programming it might be a bit exotic.
It's perfect for LEARNING PROGRAMMING. It's easy to get in, supports you with various excellent predefined functions, and as already mentioned... it introduces you to the C style of programming.
Dragonlord wrote:Furthermore you need a web-server all the time and the mixing with HTML code is something which can confuse new players in the game.
Wohoowhoa! Hey man... never heard about PHP-GTK and other extensions for display matters?! You don't need no webserver, not at all. Further, I assume you've never written and run a commandline script with PHP, ey?
Dragonlord wrote:PHP is not cross platform. Functions are "compiled in" depending on the OS. Therefore using some functions you can quickly hit a wall on another platform
Then explain me how I manage to write my PHP applications on Linux and can run it entirely failsafe on Windows or Mac... of course, there are aspects that are bound to the operating system, but that's easy to get around if you're clever, plus - these aspects exist in all programming languages.

Re: Learning 'Programming'

Posted: Fri Nov 14, 2008 11:02 am
by THEL1NK1N2
This thread's going to get fun now, Programmer vs. Programmer Deathmatch...

*Gets popcorn, and waits for DL to arrive*

Re: Learning 'Programming'

Posted: Fri Nov 14, 2008 4:12 pm
by Big Red
It largely depends on what level you expect to program.

Pure C is a good place to start for apps. Not perfect, but it gives you the nuts and bolts of programming and has influenced most popular languages. The biggest problem learning it is the lack of an error control mechanism, and GUI. So you should have a good IDE/debugger to learn it with. It's also a pretty low level. If you're only going to do web programming, it might be a waste of time. If you're going to make apps for windows or linux, it's a must.

Avoid C++ as first language, in all cases. It's filled with ambiguities, its own large class of issues, and you inherit all of C's particularities on top. Stick to pure C. If you must learn C++, do it much later.

There is a lot of bias against and for it, but Java is actually a good place to learn the most basic object-oriented concepts. It's conservative in features compared to C++ and C#. I would recommend it if you have trouble understanding OO, but you should always keep in mind most other languages are not as strict. It's also very easy to switch from Java to C# later on. Ignoring frameworks, C# is basically Java with more features. It's worth noting that, in most cases, people who started with Java or C# should have learned C first, in my opinion.

Python is very intuitive, easy to get into, and powerful. You can't go wrong with it. However it's a very high level language so if you're do any sort of lower-level programming, you should not learn it alone. It's easy to take its features for granted, and although it seems simple, there are plenty of them. If you're only doing web programming, this is the class of language you should be aiming for, sooner or later (python/ruby/php).

Avoid Perl.

PHP is easy to get into, for i/o. But I would avoid as a first language it for the same reasons I would avoid C++. It's best to already have some background in programming before you start these languages.

Re: Learning 'Programming'

Posted: Fri Nov 14, 2008 4:15 pm
by Shadow Wolf
well that's dropped a carnotaurus into a raptor fight Link... guess you won't be needing that popcorn :P

Re: Learning 'Programming'

Posted: Fri Nov 14, 2008 5:19 pm
by THEL1NK1N2
Shadow Wolf wrote:well that's dropped a carnotaurus into a raptor fight Link... guess you won't be needing that popcorn :P
No, kidding, didn't expect Big Red to show up. Good to see you back.

Don't worry SW, I haven't packed my popcorn away yet. Mark my words...

Re: Learning 'Programming'

Posted: Fri Nov 14, 2008 6:07 pm
by Dragonlord
Rofl... no DM over here. One reason there are so many programming and scripting languages is the same as for the number of Linux distributions: everybody has it's own taste. But there's one particular difference many forget and that makes the difference between a programmer and a hacker ( aka a very good programmer ). Each programming language has been made for a certain goal. Therefore each language is strong in one field of usage but weak in another. The true hacker knows when to use which one while common programmers try to bang their language of choice through any wall.

So to come back on the topic.

Yes PHP is a script language from the construction but it is a markup script language. The difference is as mentioned of historical nature. PHP began it's existence as a language designed to create dynamic websites. Therefore it is geared for this purpose. It has been twisted around a couple of times in it's existence and the amount of API breaks they caused doing so is not to be sneezed at. For web applications it's my language of choice but for command line or GUI applications it does not obtain my recommendation. For console work either use bash ( as this is the original and true Unix philosophy of handling things ) or Python ( ruby works too... it's mostly python with C and Perl mixed into it ). For GUI work use C++ if you can or Java if you need to be cross platform and/or you want to avoid memory hazzles. Java though is a mess, can't say it different. It's one of those "good idea - bad execution" situations. Still though if you look for easy to port applications it's a good choice and if you know how to deal with the devil properly it runs well and stable. Getting the devil to know properly though is not an easy task. Now I really never heard of PHP+GTK... and this already means that it's underground stuff without much usage. Alone the combination of the two is strange since PHP has never been designed for GUI applications. Granted it received a lot of modules geared for network applications like regular expressions, various database backends, image generation routines, encryption support and so forth but this all had been made for web purpose not GUI purpose. The second problem is GTK. I worked with GTK for quite some time before switching to FOX-Toolkit. The switch I made for a simple reason: GTK is one hell of a mess, error prone and unstable. Furthermore porting GTK over to Windows is a mess. Yes for you as developer you do not see the mess because the mess is piled onto the user which is the wrong thing to do. You have to deal with GTK Run-Time Environments and if two apps use different GTK versions ( even if the same major version ) then hell breaks loose. Therefore I would not recommend GTK if you intend to be cross platform especially if paired with PHP. I see no benefit in this except annoying the hell out of users.

I'm also a bit astonished that people follow C#. Yes the idea behind using a managed language is all nice and good but it's straight away destroyed with this "immediate mode" crap which undermines the entire VM aspect. You can directly do C++ then having more control over memory and doing all the nasty things or go up to Java and be really using a VM. It's one of those M$ hybrids let loose on the market just to be there but not solving problems in the first place. That said if you are a .NET user ( questionable license scheme: developers loose their rights to their own software! ) then C# is more or less a must but otherwise I would stay clear of it as there are better suited languages out there for specific usage scenarios.

Re: Learning 'Programming'

Posted: Fri Nov 14, 2008 11:46 pm
by hppav
I haven't seen so much text in a post in years! :O