- dotTech - http://dottech.org -
Programming for newbies, Part 1: Python
Posted By Stephen On August 11, 2011 @ 6:20 AM In Computer Programming,Tips 'n Tricks | 11 Comments
Hi all, this is my first post here at dotTech. There have been many common question when one decides to dive into “world of programming”. These questions includes but not limited to “which language should I learn?” or for those who want a lot of fun, will ask “which language should I learn first?”.
I cannot guarantee you that the answer I’ll provide here is the only and absolute answer, but you if you are going to treat it as starter, then congratulate yourself, you got it right. :)
I came to programming world wondering where I should start. I was having dim knowledge in HTML and almost nothing of CSS. I didn’t know loops except in Microcontrollers/Microelectronics programming which is very low level (and isn’t fun!). So I decided to search for a path.
My first hit was Visual Basic 6. It was such an easy work to make interface (few minutes to be precise) but what useless task it was! GUI without events is really useless! On the VB way, I found a book, but then I didn’t had any VB interpreter/IDE. Buying it from such country as mine, was a tedious job I could not afford, so I dropped it. :(
Not far from there I tried C using the book by the writers of C language itself (Kernighan and Ritchie). To such a newbie as I was, it was convoluted book you don’t want to read! But it did some good stuffs in my brain. It introduced me to loops and like stuffs. After there I dropped whole “dev – geekish” things and dedicated to electronics stuffs (believe me biasing single transistor isn’t fun!). Few years after that I wanted to go back to Dev game seriously. The result of my search will save you some pain of starting from scratch.
WHICH LANGUAGE SHOULD I LEARN?
That depends on what you plan to do with language. If you plan to talk to an English man, you will be sane if you’ll learn English. Same is valid for world of computers. I will do quick review of some languages I have tried. Note that, there are many languages out there; no one language is “the best one”. Rule of thumb is use the “right tool for the right job!”
WANT FUN? PYTHON DOESN’T BITE!
The first language I recommend for beginners is Python. As I quote from their official website:
“Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.”
The key to programming, in any language, is discipline and technique. By forcing you to write code in an organized manner via indentations, Python teaches beginners discipline and technique in one go. You work more quickly and create easy-to-read code that is easy to maintain even if you have thousands of lines of code. Although the reasoning behind using Python first may sound like a “baby step”, remember you need to learn how to crawl before you can walk. You will appreciate the discipline and technique Python teaches you when (if) you decide to move onto other languages.
Don’t forget Python interpreter is open source and platform independent so you will find Python on Windows, Mac OS X, and Linux alike. Also Python is self contained in that it comes packaged with its interpreter, Integrated Development Enviroment (IDE) called IDLE, and many standard libraries including ctypes (for accessing C/C++ DLLs), and Tkinter (for creating GUIs).
If you need to add more functionality to your Python, just download and install the third part modules like wxPython for wxWidgets users, pyQT for QT users and so forth.
In most Linux systems, it comes bundled while in Windows (not sure about Mac) you have to manually download and install it. After you get Python, it is very easy to use. To just test its feel, add the Python path to Windows path (I assume you are in Windows). Then at commandline, type “python” without quotes. It will display something like this:
To do a test “hello world” program, just type:
print ‘Hello world!’
(Note this is for 2.x not 3.x; it is different in3.x).
Below is the output you should see:
Simple, isn’t it? For writing something more useful, open IDLE, or any editor of your choice (NO MS NOTEPAD!), write your code and save it in .py extension. To run and see results, just open command line and move to the directory and type the following:
Although not guaranteed, double clicking the file works also; but the method above is more reliable. If you dont like this long path, grab a different IDE of your choice and start coding! Every IDE offers a something little different than another IDE. For more on Python…continue reading!
PYTHON… IN (MORE) DETAIL
Name: Python (No snakes, from Monty Python circus)
Official Website: www.python.org 
Language type: Interpreted 
An IDE is an “integrated development environment”. In layman’s terms, it is the actual software developers develop in.
Note: Current version of Python (3.x) is NOT backward compatible with previous version (2.x). I recommend use of ver 2.5.4 for those who need very stable version. Version 2.6 is the best choice and is being improved. Version 3.x isn’t very fun due to lack of modules. But keep learning 3.x too because modules are coming out!
>>>Stay tuned for more articles on “Programming for newbies”.
Article printed from dotTech: http://dottech.org
URL to article: http://dottech.org/10377/programming-for-newbies-part-1-python/
URLs in this post:
 Image: http://dottech.org/wp-content/uploads/2009/10/python1.JPG
 Image: http://dottech.org/wp-content/uploads/2009/10/python21.JPG
 www.python.org: http://www.python.org
 Interpreted: http://en.wikipedia.org/wiki/Interpreted_language
 www.diveintopython.org: http://www.diveintopython.org
 www.swaroopch.com/notes/Python: http://www.swaroopch.com/notes/Python
 www.mindview.net/Books/TIPython: http://www.mindview.net/Books/TIPython
 www.greenteapress.com/thinkpython/: http://www.greenteapress.com/thinkpython/
 www.daniweb.com/forums/forum114.html: http://www.daniweb.com/forums/forum114.html
 www.bytes.com/topic/python/: http://bytes.com/topic/python/
 www.python-forum.org/pythonforum/index.php: http://www.python-forum.org/pythonforum/index.php
 www.docs.python.org/tutorial/index.html: http://docs.python.org/tutorial/index.html
 www.zetcode.com/tutorials/pythontutorial/: http://zetcode.com/tutorials/pythontutorial/
 www.wingware.com: http://www.wingware.com
 www.code.google.com/p/pyscripter/: http://code.google.com/p/pyscripter/
 www.pythonide.blogspot.com: http://pythonide.blogspot.com/
 www.activestate.com/komodo/: http://www.activestate.com/komodo/
 www.drpython.sourceforge.net: http://drpython.sourceforge.net/
 www.aptana.org: http://aptana.org/
 www.eclipse.org: http://eclipse.org
 www.netbeans.org: http://www.netbeans.org
 www.boa-constructor.sourceforge.net: http://boa-constructor.sourceforge.net/
 M.D. Stephen: http://dottech.org/author/evstevemd
 Ashraf: http://dottech.org/author/Ashraf
© 2008-2012 dotTech.org | All content is the property of its rightful owner.