You are not logged in.
So I'm fairly new to programming and ended up deciding to go with Python. I've been trying for the last couple months to learn the language. I've been having difficulty finishing books and usually end up getting stuck part way through the book. I usually tend to get lost on the vocabulary and not so much the actual content.
So my questions are, how did you learn to program and what got you motivated to keep going?
So far I've been reading books/online tutorials and even the ones suggested by people online tend to be very advanced in terms of vocabulary (not necessarily good for a beginner).
Offline
Find an itch to scratch and scratch it. Instead of reading n books on from beginning to end write a tool to do something, even if silly or reinventing the wheel.
The python challenge contains various tasks where using python (or another language) combined with problem solving skills find out how to get to the next level.
Project euler is another tip, various challenges of more mathematical nature.
I need a sorted list of all random numbers, so that I can retrieve a suitable one later with a binary search instead of having to iterate through the generation process every time.
Offline
IMHO, the best way to learn a programming language is using it, as simple as that. I like to do some small programs, and see how the works, see code of other people and test it. Use your creative to create a new programs, things simples, then more complex with the time.
Offline
To learn Python, I wrote just wrote a lot of little tools and scripts that I could use. Just write whatever you think up. When you don't know how to do something, search around the web and read the docs.
Offline
honestly, I went to college and took a bunch of programming classes. what I would suggest is to first find a language that you are comfortable with (python and java seem to be a good place to get started imo) then I would concentrate first on learning basic data types (ints doubles char string etc.) then learn how to manipulate more complicated data structures (arrays and objects and what not) and learn certain useful complex data structures and algorithms (linked lists, doubly linked lists, stacks, queues, sorting, searching). the good news is, once you learn the basic concepts behind all of these fundamentals, it's relatively easy to translate them into other languages. also, imho, I would learn all of the above first before jumping into GUI programming. there's no point in writing a solid GUI if you don't have a solid program for it to interface with.
as with anything, however, it's mostly going to take hard work, practice, time, and patience. I've been programming for over 4 years now, and I still consider myself a complete and utter n00b, and probably will for several more years.
Hofstadter's Law:
It always takes longer than you expect, even when you take into account Hofstadter's Law.
Offline
Find an itch to scratch and scratch it.
This.
Automate tasks you do often (download files, check TODO lists, backup stuff... maybe python is not the best tool for these though). Create simple pipe menus if you are using openbox, or notifications for conky/dzen/notifiers you might find useful, etc.
Offline
I agree with what was said above. I tend to use books as reference material. I.e. if I run into a problem or want a refresher on how to use a certain variable/built-in function, I check the book (or check online, if I don't have a book handy). I suppose you could do it all online, but I like being able to just reach up, find what you need in the index, and read what you wanted to find out about. As for how to get started, find something you want to write a script for, be it a to-do list, a google script (using the google API), a file counter, a file condenser (takes a series of files and merges all the info into a separate file), etc. As for staying motivated...I'm not sure I really do. I'll have long periods of time where I don't code at all, but once I think of something I need, I'll be back at it without much trouble. Most important thing is to learn the basics I suppose, it'll help you understand tutorials and docs online. Also, you need to keep in mind that Python isn't necessarily the best choice for every script. I know c++, python, java, bash, and a bit of perl. Python and Perl are both what people refer to as "scripting" languages, since the code isn't compiled into a separate executable (like c++), but is instead read by an interpreter and executed. This means the stuff written in a scripting language will tend to run slower than a pre-compiled script, due to the fact that the libraries are loaded every time you run the script. Once you get comfortable with Python, it may be useful to learn another language like c++ so for any projects where you'll be using the program a lot, or it will be resource-intensive from the get-go, you have an alternative to Python.
That being said, the best way to get started is to simply start. Think of a problem, think of how you'd solve it, write an algorithm (in plain english so you get a better grasp of what you need to figure out how to do), and then write the Python script. If you run into problems, you can pose the question on the forums, or google it, but it's always easiest to find the answer to a specific question than it is to get a decent answer to a subjective question like this one. For some people learning from books is the way to go, others can learn it by doing, and others again learn one in school (it was java for me), and apply what they learned for the one language to any other ones they learn, speeding up the process.
I realize it's not really an answer, more like a re-affirmation of what was stated above, but I hope it's helpful when it comes to making your decision,
Lswest
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
I'm learning Java now. But the way described above is not appropriate for java. I can't just program smthng and use books only as reference.
Is it smthng wrong with me? I'm familiar with matlab and I learned Pascal pretty well few years ago (I haven't tried to code Pascal for year or more). Am I becoming dumb? Or Java is just not that kind of "Learn programming for 11 days" language?
Offline
Is it smthng wrong with me? I'm familiar with matlab and I learned Pascal pretty well few years ago
You first need to understand the language conceptually, before jumping into writing programs. So maybe follow the exercises in a book before setting your own goals.
Also, when you're learning java, it's useful to have netbeans or eclipse.
This is my signature. If you want to read it, first you need to agree to the EULA.
Offline
I'm learning Java now. But the way described above is not appropriate for java. I can't just program smthng and use books only as reference.
Is it smthng wrong with me? I'm familiar with matlab and I learned Pascal pretty well few years ago (I haven't tried to code Pascal for year or more). Am I becoming dumb? Or Java is just not that kind of "Learn programming for 11 days" language?
I don't know, I'm struggling with Java, too. I guess that's because there are things that you need to understand about the principles of object-oriented programming and how classes and objects are used, rather than just jumping in to coding things. I found it much easier to learn what I know of C, Pascal and Perl than Java. Fortunately, the book that I'm learning from does a very good job at mixing theory with practical exercises and then testing you on it at the end of each chapter.
Offline
You first need to understand the language conceptually, before jumping into writing programs. So maybe follow the exercises in a book before setting your own goals.
That's what I'm doing. Thanks. Actually, there are many things to understand: object-oriented programing, all those classes... %)
Also, when you're learning java, it's useful to have netbeans or eclipse.
I'm using simple gedit and jdk now, as was suggested in the book. I'm going to try eclipse later.
Offline
Thanks for the tips guys. I like learning by doing so I've tried to find as many books/sites as I can with problems or 'assignments'. I usually get lost trying to accomplish a small project. Either I come up with program that doesn't do what I tell it or I just get lost on how to actually accomplish it. The more and more I've been reading/tinkering, the more I can start doing things in my head like "oh, I can totally use array's for this" or "man a tuple would be great for this".
I've been kind of stuck these last couple weeks, so finding something fresh should be nice. I just started with these videos and maybe these will help get me more familiar with the vocabulary.
http://ocw.mit.edu/OcwWeb/Electrical-En … /index.htm
I suppose it's just going to take a lot of super small projects before I can start grasping everything. I've heard it takes about 10 years to fully get in the groove of things. Better start now
Offline
I'd like to comment on Java: Basically it's not a good starting language. Others may disagree with me, and I refer them to the expertise of ESR and his always impeccable sources, but it's my firm belief that Java is something you shouldn't really bother with as an amateur or even as an intermediate programmer.
Java has tons of great features. The Collections API, Swing, JDBC, AWT, JavaBeans... the list goes on and on and on and on and on and on and on and on and on and on and on and on and on and on. And therein lies the problem. It's simply too big, hairy, and complicated to be a good beginner's tool. As an experienced programmer, there is something to be said for grabbing TreeMap out of the API and parameterizing it rather than trying to code your own ordered hash. But the very features that make it great for enterprise development make it a massive confusing mess for beginners. It just takes too much investment to learn how to use it the way it should be used.
I don't want this to be a blog post, so let me just conclude by saying that to make the most of Java, one should already be a mostly competent programmer, with understanding of under-the-hood stuff as well as abstractions like modularity, abstract data types, inheritance, polymorphism, parameterization, etc. After you are experienced at writing this kind of thing in (say) C, you can turn (back) to Java and realize how much it simplifies things, and at what expense.
I could go on, but I think I'll save it for a future blog...
Offline
I am personally a self-taught java programmer. If Trent says is true, i must have missed a whole lot. One you grasp the idea of object oriented design, java becomes much much simpler. The modularity ensures that beginners aren't over whelmed.
I think java is better as a starting language because you can focus more on the proccess of programming. Rather than creating the tools, you learn how to use them. Things like memory managment can be ignored (until you do more complex stuff anyway).
eDio, i suggest netbeans instead of eclipse. Eclipse used to be better, but now it's just a mess of memory inefficient plugins. Netbeans also has a very very good GUI builder.
Offline
Not to drift off topic here, but I agree with Trent. Java isn't the best language to start with for most people. It was actually the first language I "learned" (i.e. didn't figure it out by doing, and it was only my third language to learn after python and bash), and I was forced to learn it within the school curriculum. Many others in my class struggled with the concepts behind it. Sure, they got used to it as the year went on, but there were still some fundamental functions and ideas that just didn't stick. There's simply too much there for a beginner to comprehend and use without being forced to constantly refresh themselves on the most basic of functions. I highly recommend learning something else first, and then moving on to Java if you are so inclined (I actually haven't used Java for anything since finishing school). It's entirely up to you, but if my Computer Science class is anything to go by, having an understanding of a different OOP language will help things along greatly.
As for on-topic: If you're getting into a programming language, an IDE might be a good idea (IDLE for python, Eclipse or Netbeans for Java/C++), since they often help catch mistakes before they become a problem, allowing you to focus on understanding the concepts and tools, before worrying about good coding styles, and catching typos before you compile. Just my $0.02 on the matter.
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
This is aimed at (non-computer) scientists, but it might be a nice way to learn Python as a "getting things done" language.
http://software-carpentry.org/
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
"Python" first~
If you think is too slow and need some part faster, add a little bit C-language~
Also, write some programming contest will make you improve
http://txshon.co.cc/blog/acm-a-good-way … ogramming/
Let's work on it!
Offline
If you are programming to learn first and work later, then I think the most important thing is to have fun. Make small projects that you think would be fun doing, and try to learn as much as possible while coding that. Don't necessarily force yourself to complete the project if you find you run into something you can't solve (and begin to find it boring)... move on to something you enjoy doing, and revisit the project at a later time after your skill has increased.
If you are programming for school, you should probably stick to the curriculum
Offline
If you are programming for school, you should probably stick to the curriculum
Definitely true. But while that is the case, if your school is teaching you a course using a language that's different from the one you want to learn, you can, as long as you have some free time and don't ignore the actual work, code small parts (or the whole project, depending on how big it is), in the language you want to learn. That way you've got a template of how it should work (the class work), for your second solution. Of course, this doesn't seem to be the case for the original poster, but it's still worth noting.
Also, whatever you decide to do, work hard on your commenting skills from the moment you start, since it's harder to re-learn (i.e. actually start doing it), after you've been coding for a while. That way, if you do take a break from a problem, you can come back and still remember what you were doing
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
eDio wrote:Is it smthng wrong with me? I'm familiar with matlab and I learned Pascal pretty well few years ago
You first need to understand the language conceptually, before jumping into writing programs. So maybe follow the exercises in a book before setting your own goals.
Also, when you're learning java, it's useful to have netbeans or eclipse.
When you are doing simple stuff, like the beginning of java, it is nice to do it in a simple editor and just using the javac program and java to run it. You will learn how to compile and run java apps without having to use an IDE, which you should know imo.
alterecco wrote:If you are programming for school, you should probably stick to the curriculum
Definitely true. But while that is the case, if your school is teaching you a course using a language that's different from the one you want to learn, you can, as long as you have some free time and don't ignore the actual work, code small parts (or the whole project, depending on how big it is), in the language you want to learn. That way you've got a template of how it should work (the class work), for your second solution. Of course, this doesn't seem to be the case for the original poster, but it's still worth noting.
Also, whatever you decide to do, work hard on your commenting skills from the moment you start, since it's harder to re-learn (i.e. actually start doing it), after you've been coding for a while. That way, if you do take a break from a problem, you can come back and still remember what you were doing
I don't agree with sticking to the curriculum. Programming should be fun, and not something you just do for school. Experiment, hack, see what you can do with the language. Off course you should do what is asked off you by the curriculum but if you feel competent enough to write simple programs, and want it. Just do it!!! You will learn a language a lot better by just using it as opposed to following a text book.
Last edited by Vintendo (2010-04-14 12:37:42)
Offline
I learned most from simple examples and then right from the beginning tweaking and modifying each one to my heart's content. There always was something I wanted to have it work in my own way, or to simply experiment with some interesting feature.
Also I always look up documentation (if available) for error handling and the like. You really learn quite a lot just trying to make something simple more foolproof.
And in many cases I soon found myself deeply involved in some pet project for quite some time.
To know or not to know ...
... the questions remain forever.
Offline
Any good Python3 tutorial ? That starts from almost zero ...:P ?
Offline
I'd say try your hand at a GUI app. It's surprising how complex things can get when you have to check every user input, maintain control states, and respond properly to user and system events. Even something simple such as a (basic) vocabulary trainer can get quite complex!
Offline
Any good Python3 tutorial ? That starts from almost zero ...:P ?
I always quite liked the official python documentation: http://docs.python.org/release/3.0.1/tutorial/
No idea if you would class it as "starting from zero" though.
Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds
Offline
I agree with the people who say Java is too hairy and messy to be a good language to start with. Everything I've programmed in the past few years has been C because I started off using Java but gave up and switched to C.
On average I got just as many compiler errors with Java as I do with C but fixing them got me less of a benefit because they bytecode still has to be interpreted by the bloated JRE. And Java programs are self-contained jars that are hard to run at first... they don't integrate nicely into /usr/bin, /usr/lib, /usr/share, etc. Also the Swing UI looked annoying and having to distinguish between "string" and "String" was a nightmare. I know languages should be case sensitive but only ONE of those cases should be mandatory. In C every stdlib function I can think of uses only lowercase. I could define my own function called "PrintF" if I wanted to but that's entirely up to me.
One more thing, and everyone will disagree with me on this:
I hate garbage collection!
It makes perfect sense for a language not to free memory until you tell it to. I don't like having the JVM look over my shoulder and second guessing me... assuming it knows when I've forgotten to free something. What if I prompt the user for an integer? And the program is supposed to return what bytes are stored at that address? What if I don't want that to always print 0 if that memory was filled up earlier in the program's execution? Remembering to call "free" is not that hard and it makes things way more efficient.
6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.
Offline