Hacker News new | ask | show | jobs
Ask HN: I want to start programming - Should I start BASIC?
12 points by Spock 5457 days ago
I have tried hundreds of times to learn how to code and I fail everytime. You name the language and I've probably had a go. My question is, should I dig out my Sinclair Spectrum and start with BASIC and work my way up? Where should I begin?

The problem I face is remembering what I read in tutorials/books and/or putting what I've learned into practice!

13 comments

One of the best ways to learn programming is to start a project and just follow through with it. Start with something small; I began making my own Pong clones in Java. Also, Stack Overflow should be your best friend.

If you want some solid beginner reference materials, I'd suggest Learning Python the Hard Way (http://learnpythonthehardway.org/). I'm a strong proponent of teaching introductory programming with Python. Others are just a Google query away.

It'll be a long and arduous (and ultimately rewarding) journey. Best of luck!

I'm repeating some of my advice given on another post that was pulled down due to a downmodded parent.

If you want to do something a little different you can also try subsetting Haskell as per in most of the courses found in http://www.haskell.org/haskellwiki/Haskell_in_education#Hask... That is the approach they take in the University I studied CS, and it's an interesting one to combine with learning Python as a fist language.

Everyone has an opinion on what language to start with, and I suspect that there is no clear answer. However, I would recommend you start with Scheme/Lisp and read "The Structure and Interpretation of Computer Programs" (http://mitpress.mit.edu/sicp/full-text/book/book.html).

This book is a classic and outlines various fundamentals of computer science and programming. Scheme is the type of language that lets you just code without worrying about all the unnecessary things that hinder the beginner.

From there you should move to C++ so you can get used to object oriented programming and have a better idea of what "modern" languages are like, but I contest that SICP is the best book to use to start programming.

+1 for SICP, but I cannot really recommend C++, since it does only pseudo object orientation (plus it has a syntax jungle from hell).

I would recommend to learn Common Lisp instead.

Basic is really not terribly relavent or useful at this point. I'd consider good old Javascript. Its syntax is derived from C and gives you a foot in the web-world. It's also easy to get started as you can start with any text editor, a browser and there is no compiling or development environment to configure (a huge obstacle I think other programs forget btw - setting up and getting your IDE working is not so simply for a beginner).

From Javascript you can use your knowledge and move to just about any other langauge (C/C++, Java, C#, Actionscript are examples of other 'C' derived languages). Plus, Javascript's popularity is on the rise and it's a good skill for any programmer to have in his toolbelt (you are bound to run into it at some point in your programming experience down the road).

As far as putting programming skills to practice, I agree with the sentiment of others - come up with a pet project, even a simply one to learn the ropes. For example I use to always start by writing a simple contact/address book program; it contain all the elements you'd need to know for most business apps (a list of records (addresses), the ability to view 'details', add new records, delete records and edit existing data).

You should also consider taking a computer programming class at your local community college. That way you are assigned simply programs, have other classmates to work with and talk about sticking points with; of course the teacher is always an option to get some real feedback when you are stuck which is something a book alone can't provide.

I don't want to be too prescriptive about which language to use but I do suggest first making useful command line programs rather than graphical interface applications. The problem with GUI apps is that you have to learn too many orthogonal concepts at once (plus a lot of GUI programming involves writing tedious boilerplate code). Python is a good modern language.

Also avoid (for now) any project that requires a relational database and instead opt for saving things to files. You'll end up learning a bunch of bad habits if you try to learn a general purpose language and an RDBMS at the same time; you might start to think that an RDBMS is the only option for storing and retrieving data even when simple reads and writes to the file system will suffice (the hacker news website does not use a relational database for instance).

Some suggestions for projects:

* Some kind of light accounting program.

* Something that reads RSS feeds, looks for keywords and notifies you of relevant links.

* Something that manages your media library.

* A TODO list (this is popular among even experienced programmers, you can easily add a GUI part later as well as graduate to using an RDBMS).

As someone else mentioned, use Stackoverflow.com. I especially enjoy helping new programmers there, my contact info is in my profile.

I agree completely with this answer, especially every word of the first paragraph.

I'm teaching programming to my 13 year old son, using Python. He's doing well with it.

Python is a good language to start. You should definitely avoid BASIC. Quoting E. Dijkstra:

"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."

Iwould also definitely give Python a try, I have personally seen Python as a basic language to start learning how to code in action and it is very effective to teach the basics of program. Zed Shaw's book is a very interesting way to learn progamming with Python, though I don't have any references about it's effectiveness... http://learnpythonthehardway.org/

If you want to do something a little different you can also try subsetting Haskell as per in most of the courses found in http://www.haskell.org/haskellwiki/Haskell_in_education#Hask... That is the approach they take in the University I studied CS, and it's an interesting one to combine with learning Python as a fist language.

Also, be wary of EWD quotes about teaching computer science, since they are sometimes a bit cocky.

youtube.com has some great classes by Google on python. search for 'google python class'.
Earlier in my career I concentrated learning how to construct software irrespective of language. I remember a good book I read probably 10 years ago, called "Code Complete". Its still on my shelf.

I also don't recommend copying other people's code until you are familiar with the language in question and can debug and enhance the code.

Choose a language - nothing wrong with Basic for learning purposes - get a book that takes you from Hello World to building a small app and read it cover to cover. And be patient. Don't copy other people's code for now. I think you'll get more reward this way and will be able to build upon your learnings instead of spending your time trying to make your current mashups work.

This reminds me of me and calculus. I used to read the book and then get super frustrated on assignment questions. I read the book, so was I not able to solve the problems?

It was because I didn't do examples thoroughly. Soon I realized that doing examples was actually more important than reading the book.

By the sounds of it, you are in the same boat!

Start by figuring out how to compile/run a hello world program. Then figure out what all the code means. Do that a couple of times with a couple of different (and small!) examples before you can expect yourself to come with the code.

Practice, practice, practice!

There are many dialects of BASIC and many old ones on old micro-computers had poor features like GOTO or 2-character variable names...

Nevertheless, for as long as you do grow out of it and move on... Why not! Don't forget to move on, that's important.

It's possible to find really old books with like scientific/financial calculations in BASIC, but don't get under the illusion that you can easily do anything "practical". For play/practice, go ahead! But please do move on it you keep at it.

I wouldn't bother learning a language that isn't of general use, I also wouldn't learn an odd/heavily-non-standard language within the first or five (so you don't learn bad habits). As I understand VB and Basic are common examples of this. There are a lot of ways to improve on what you already know, e.g. lua would build on your javascript knowledge.

If you've failed so often, don't keep trying, but read some motivational/self-improvement books. Ask HN for them, I haven't read any.

From what you've said you have a good command of syntax. So the second half you are missing is general CS knowledge - how to make algorithms and data structures work for you. From there it's just a matter of finding resources to work on CS-type problems; you could work through TAOCP, Project Euler, a college CS 101's posted exercises...
Ruby: http://pine.fm/LearnToProgram/ Python: http://learnpythonthehardway.org/

Pick one and jump in. Branch out from there.

What do you mean by "fail"?
Well I sort of get 'writers block'. For example I set out learning PHP a few months ago and created a meme site which would store image locations in MySQL, pull them out in ascending order and have arrow buttons to flick between the images. A random button for an image at random, an upload script, a login script, and a crappy admin area. Doing all tha took me weeks of trail and error and a lot of copying other people's code then all of a sudden I hit a brick wall and couldn't progress. For a month or two I get a rush of enthusiasm and motivation, I start off great and start thinking logically in my everyday life and I start thinking about how something is coded; I even start thinking algorithms for everyday life. But then I just stop dead and can't progress; anything better than command line input/output apps just eludes me!
What were you working on when you hit the brick wall?

Was there a specific problem or just a feeling that you should be able to do more but didn't know what to do?

Probably the latter. A friend of mine was sort of encouraging me with ideas and he bugged me to add a comments box to each image so people could add and read comments. I failed at that after days of attempting it. I also wanted titles above the images but couldn't integrate it into my admin script because how the script was setup was to iterate through the "uploaded" table of the database and display the results. Basically once things got a bit more complicated than just merely echoing images to the screen, I crashed and burned. This is the case with pretty much any language I use. I've made Space Invader clones with Python (using tutorials, understanding what was going on) but when it came to keeping scores, title screens and stuff, again I'd crash and burn. And today for instance, I've been reading up on C# and I've attempted to create Pong but I can't even get sprites to draw lol.
I've been programming for years, and I probably couldn't make Pong in C#. Game programming is a very different beast. If you want to do games, I would look for a specific framework (maybe PyGame) and tutorial.

If you just want to learn to program, I would stay away from games for now.

Either way, it sounds like you just need someone who can give you hints when you get stuck. If you go the gaming route, any of the major frameworks should have a message board and people willing to help. Ask for their help. Be specific in where you're getting stuck, and most people will be plenty helpful.

If you ever want some to look over some non-game code (like I said, I don't do games), feel free to send me an email. My email address is in my HN profile.

If you want to train your logic skills as well as basic programming concepts, I would go with c++.