Learning Programming/Logic/Algorithms by Yourself (preferably practice programs to write)?
April 24, 2008 7:34 PM   Subscribe

Im a Freshman Computer Engin. Major and I want to learn more programming/logic by myself. Any books/Resources/Sample Projects you might recommend?

In class we have projects/homeworks we do (Im doing Java now btw) and that helps us learn how to actually program instead of reading a book and letting the syntax/logic pass over our head. However i feel like I want to learn some languages by myself and everytime i try to do this I always end up giving up or just not learning anything much useful in the end to actually program. So this is kind of a multi part question:

1. Are there any resources out there that give sample projects with answers or suggested solutions out there? I don't mind paying for anything.
2. Any resources to help build programming logic? Or theory? (Maybe things like Djkstras algorithm nicely explained comes to mind)
3. Also what languages might you recommend to learn myself? I want to learn something that is actually useful, and might help my resume. (not something like pascal :D). This also fits into what resources can help me learn these languages.

Thank you!
(btw this is my first MeFi question and Im not sure if its good enough. I am glad to be part of the Hive Mind at Last!)
posted by Javed_Ahamed to Computers & Internet (22 answers total) 37 users marked this as a favorite
 
You can't go wrong reading SICP and doing as many of the exercises as you can manage. Scheme per se won't necessarily be a huge résumé point, but going through the book will definitely make you a better programmer.
posted by letourneau at 7:45 PM on April 24, 2008


2. Read Knuth's "the art of..." series. Quite good.
Honestly Wikipedia is great too. Start with "Boolean logic" or something and just keep clicking on the "See also" links (and then those pages links, hey,,,,"recursion") and you have a pretty good read.

3 I recommend python for learning programming ( you can focus on designing an algortihm not deal with getting a compiler or library to work.) And C#/C++ for resume building. C++ is good for both actually.

there are also many threads on askme about this to read through.
posted by oblio_one at 7:48 PM on April 24, 2008


Seconding Python for programming. And highly recommending the exercises from this course I took at Cornell. They're science oriented with mainly physical and biological examples, but the exercises are clearly written with pdfs giving you instructions on how to code the entire thing and step by step instructions in skeletal python program files. Really a good introductory course for me because it got me interested in the material immediately, as a means to programming something cool. Also got me used to thinking modularly.
posted by peacheater at 7:58 PM on April 24, 2008


I think it's good to learn a high level OO language like smalltalk or Objective-C. Doing this enforces a really high-level approach to problems. I started out on BASIC, then had a job translating ALGOL programs to FORTRAN (!!!), then wrote some PROLOG system stuff. I had a long layoff during which the entire world turned to C/C#/C++ but I always found C uncomfortably low level and C++ an uncomfortable compromise. I found Obj-C to be a really graceful and readable language which makes elegant solutions the easiest ones.

(Basically, rapid prototyping languages like PROLOG and Obj-C often encourage good practice. It's worth learning them even if you don't end up writing in them, because you carry the work practices over with you).
posted by unSane at 8:08 PM on April 24, 2008


Two parts here.

First is that there is a LARGE difference between programming and logic. They build on each other, but one is a construction craft, and the other is more like math (purely esoteric and theoretical).

Second, you can't go wrong getting better at programming itself. The biggest thing that teaches you is just doing it. There are a multitde of "problems" out there for a programmer to solve. Anywhere from Code Kata to a site which I cannot seem to find again that has 50+ math and logic problems that can be solved via programming intelligently.

Once you have a decent grasp on small scale programming (puzzles and problems), go ahead and go after the bigger problems. Don't be afraid to re-invent something that already exists. Go write a chat program. That covers everything from user interface down to network protocols. Implement a small compiler? Write a blog engine? There's lots of things to do. Just go ahead and forge ahead and do them.
posted by cschneid at 8:33 PM on April 24, 2008


Response by poster: Second, you can't go wrong getting better at programming itself. The biggest thing that teaches you is just doing it. There are a multitde of "problems" out there for a programmer to solve. Anywhere from Code Kata to a site which I cannot seem to find again that has 50+ math and logic problems that can be solved via programming intelligently.

I understand that to learn programming the best way is to write programs. Even when im reading teach yourself books i always write out the examples in the compiler and get them to run. However, Im not sure what to program. In my Java class for example to learn maps/collections we built a markov chain generator, or to practice 2d arrays we built tetris, with the foundations of the programs provided by the teacher. In most self help books i look at they give some syntax, then maybe a small example that doesn't help too much and thats it. I want to be challenged/frustrated like I am doing school projects, I want to be like WTH but then realize what I was doing wrong and know the subject for life. (This is pref why i want answers with sample questions)
posted by Javed_Ahamed at 8:52 PM on April 24, 2008


Well, since you are a CS student, I'll assume you're at least a little interested in data structures.

Go implement a Bloom Filter. It's a fun data structure, and there is lots of tweakability in it. It's not hard to do, but it should take you an hour or two. Remember to write it like official production code, don't just hack it out, name things well, separate out classes and methods.

I still think you should write a larger application. Chat (existing network like IRC, or your own made up protocol), an Excel clone (teaches parsing, data structure, UI). It sounds like you know your way around the basics, just go and dive into something large.

Also, go ahead and start at least skimming programming.reddit.com. The links there talk a lot about the culture and ideals surrounding programming, and a little bit of programming itself.
posted by cschneid at 9:04 PM on April 24, 2008


Regarding what to learn and what will help your resume. Don't worry. You're a freshman. Go learn everything you can get your hands on. Ruby or Python will get you your scripting language. C# and Java are good "enterprise" languages. Haskell for functional programming.

Basically, it still boils down to: just go do something. Implement data structures and algorithms (wikipedia for descriptions), design and build larger applications.
posted by cschneid at 9:07 PM on April 24, 2008


Online programming challenges. Project Euler comes to mind as something on the more logical-mathematical side of things (almost all of the problems have a straightforward solution that takes forever to compute, and smart ones that you'll get in a very short time), but there are plenty.
posted by themel at 10:11 PM on April 24, 2008 [1 favorite]


(To elaborate: Once you bang out a nasty-but-works solution in Project Euler, you get access to the solution forums, where you'll find the same problem solved by people who obsess about beating the other guy by milliseconds, people who obsess about using fewer characters of code, and people who obsess about using the most obscure programming language possible. Quite enlightening sometimes.)
posted by themel at 10:20 PM on April 24, 2008


Project Euler is a great place to start. I recommend using python because it's a fun language that's easy to learn but has a lot of features that you can use as you get more experienced. Of course, you can use java or C# or whatever. If a lot of your friends that know programming are using a certain language, use that one, so you can ask them for help.

After doing some small programming exercises, like from Project Euler, think about what you want to specialize in learning about. Computer Science is such a vast field that it is easy to get lost. If you want to do networking, write a sockets program. If you want to do graphics, make a rotating teapot in OpenGL. Make a simple program in a area you want to learn more about and build out from there. If you have a specific sub field you're interested in (AI, parallel, image processing, office apps, etc.), you can probably get better advice on projects.
posted by demiurge at 11:43 PM on April 24, 2008 [1 favorite]


Another thumbs up for Python. The ActiveState ActivePython build is extra useful on the Windows platform.

Also, the Software Carpentry lectures are interesting because they include overviews of a wide variety of development-related topics like process, version control, unit testing, bug tracking, etc.
posted by and for no one at 12:14 AM on April 25, 2008 [1 favorite]


Check out the forums at www.xkcd.com
posted by charlie7691 at 2:47 AM on April 25, 2008


Knuth. There's is only one to start with. When you've consumed volume 1 any programming book you open next is so much easier to understand.
posted by unsliced at 3:38 AM on April 25, 2008


Most replies have missed the fact that you're computer engineering, not computer science. You might actually want to avoid most of the languages mentioned upthread; my computer eng. program only teaches C/C++, and only a little of the ++ variety. You're not going to be using Python, scheme, etc. in embedded systems work, you're going to be using C or assembly.

The Knuth "Art of..." books are great for you, because they use an assembly-like language. It would be much more beneficial career-wise for you to pick up the assembly-way-of-thinking from AoCP than to get the Lisp-way-of-thinking from SCIP.*

There are a lot of intro C books to choose from, I used Kochan's and it's good. If you can work through that, try to find a data structures / algorithms book in C. I've used Horowitz, etc and it's TERRIBLE. The book has made me a better programmer; I'm much better at reading confusing, poorly-documented code now. Knuth's "Art of" books will cover much of the same material as a ds/a book, you should get his stuff instead.


*not anti-Lispist. What I've seen is great and really neat, but I can't get it on my microcontrollers.
posted by tylermoody at 5:44 AM on April 25, 2008


One more thing: make sure any data structures / algorithms book you buy has the words 'statically-allocated' all over the place. If you go into embedded systems, you're working with very small amounts on memory in a system that doesn't do allocation for you. Learning the statically-allocated versions of linked list, trees, etc. will make you a better programmer, and you'll laugh until you cry the next time someone complains about pointers being confusing.
posted by tylermoody at 5:53 AM on April 25, 2008


Response by poster: Thanks so far guys! I will definitely look into the resources you posted :). I might like to add as a clarification though just because im computer engineering does not mean im all for a future in embedded systems, Im probably going to just go commercial programming but i went engineering to get some hardware background as well. I was also looking at this book and it seemed interesting:



Some of the links you all posted seem to be for more advanced people or people who understand the terminology. Any beginner books to algorithms/logic as well? When i look at most of these books i see weird characters like epsilon delta and stuff and I freak out 0_0. Im sure its not that confusing though if I just knew the basics.

(On a side not there seems to be LOTS AND LOTS of computer books for the absolute newb and LOTS AND LOTS for the Pro but very little for the intermediate person... i guess these are what im looking for as well)

posted by Javed_Ahamed at 7:22 AM on April 25, 2008


"I understand that to learn programming the best way is to write programs. ... However, Im not sure what to program."

Pick an open source project that interests you and volunteer to fix a few bugs. As you get more familiar with the project, you'll find bigger and more interesting parts you can work on. You'll be solving real-world problems, and as a bonus, when you're looking for work later, you'll be able to point to the code you contributed as evidence of your abilities.
posted by kristi at 9:39 AM on April 25, 2008


Best answer: If you're interested in algorithms, get an (wait for it) algorithms book. I guess I don't see where the confusion lies.

I started with Data Structures and Algorithms in C. Searching Amazon, it looks like they have a version for Java, if you're more confortable with that.

There's Introduction to Algorithms, which is the seminal text on the subject.

If you're doing OO programming, what you're looking for is "design patterns." The seminal text on that is (wait for it) Design Patterns by the GoF (Eric Gamma, et al). A more accessible version is Head First Design Patterns.

For a language agnostic text on programming in general, Code Complete is outstanding. Read it, digest it, then read it again. I guarantee you'll reference that one again and again.

I'm mostly self taught, so I borrowed lots of books from coworkers. My mentor suggested against reading the Knuth AoCP series, oddly enough.
posted by kableh at 9:47 AM on April 25, 2008 [1 favorite]


Stick with one OOP language until you`ve mastered it. If you keep jumping around you`ll waste most of your time in syntax problems. You need practice in writing programs (or functions or subprograms). If you`re already working in Java, get a book which specializes in intsruction, such as that from Lawrenceville Press This will take you through a series of graduated exercises and has excellent online support.
posted by Neiltupper at 12:51 PM on April 25, 2008


I have found that the best way to learn how to do something is a real-world project that you consider fun and useful. Think of a project that would be useful to you, your community, or the internet, and create it. Or find an open-source project that you're interested in, and ask people how you can help as a beginner programmer. They can assign you a small task. Working on open source is EXTREMELY satisfying, by the way. Go to Sourceforge.net and search for an open source project. You can search by language, if you're interested in using a specific language.

On the topic of languages: I strongly recommend you learn an interpreted language, like Python/Ruby. Having an interpreter where you can interactively write code is a great way to learn.
posted by lunchbox at 5:22 PM on April 25, 2008


Response by poster: Thanks again for all the help guys! :)
posted by Javed_Ahamed at 8:20 PM on April 25, 2008


« Older Why does my phone ring when people call an...   |   Is brainfog from age or something else? Newer »
This thread is closed to new comments.