views:

625

answers:

18

I've been programming for around a year now, and all the stuff that I've written works - it's just extremely poorly written from my point of view. I'd like to know if there are any (free) good books on Software Design out there that can offer a little guidance to the beginning programmer? I don't think I'd have as many problems if I knew a little about the thought processes that go into software design.

+3  A: 

Sounds like you want a book on design patterns.

Take a look at: Design Patterns - Elements of Reusable Object-Oriented Software. Warning it is not Python specific though.

You could also take at this online resource for Python design patterns.

Stackoverflow user @S.Lott also has a lot of really good Python resources that he wrote. You can see them on his Stackoverflow page.

Brian R. Bondy
+6  A: 

DRY and YAGNI are good starting points for beginners and you need to study and understand OOP.

Regarding Design Patterns (which are a bit more advanced and abstract than DRY and OOP) you can study from the free Design Patterns - Java Companion. The fact that it's not Python should not bother you - classic design patterns are applicable everywhere.

When you feel like going further have a look at DDD (free DDD book from Eric Evans) and of course Unit Testing which, believe it or not, will improve your code and you as a designer.

cherouvim
If you're using anything but Java/C# (Python, C++, etc), you don't really need more than barely half of the GOF Patterns.
Marcus Lindblom
Yes, but knowledge is always welcome. It also separates kids from real men :)
cherouvim
A: 

Get the Gang of four book - Design Patterns.. But please don't over follow it and try to use Singleton everywhere :)

Just know it and use it wisely. Also after that look into good open source code and try to learn from their structures.. I suggest google code and sourceforge

Quakeboy
+10  A: 

Head First Design Patterns might be a gentler intro to the GoF "Design Patterns" book

Steve McConnell's Code Complete is a good guide to many things code, including how to use good strategies in languages that don't natively support them.

Martin Fowler's Refactoring refers heavily to Design Patterns, but is a great catalog of so-so code, and better ways of writing it (I read it about the same time I read "Code Complete", ana couple of years [tsk tsk] before reading Design Patterns, and "Refactoring" had a major impact in how I looked at code I wrote. For the better, I like to think).

None of these are "free." But how good of advice do you want? If you're trying to invest in your career, this is the cheapest way to do it.

Michael Paulukonis
+1  A: 

Check out this book: Head First Design Patterns ...literally. Check it out. From the library.

Brandon Montgomery
A: 

Head First Design Patterns would be a good place to start for a beginner. It's probably easier to get into than the Gang of four book.

rosscj2533
A: 

Depending on your background (and to some degree, experience) you might also want to look into how basic algorithms. A book like Introduction to Algorithms is a good start.

Besides that, I also vote for Head First Design Patterns. The GoF works better as a reference later on.

Christian P.
A: 

Forget the books. In my experience (which includes time as an instructor and writer of OO design courses) some people can do design and some pople can't - it's a talent, like being a sculptor. At best, reading books on the subject will enable you to design badly, if you don't have the talent.

anon
+2  A: 

A couple of other principles that may be worth noting:

C.R.A.P.:The Four Principles of Sound Design - For usability these are good principles to know.

Pablo's Topic of the Month - March: SOLID Principles - Has some good ideas as well.

JB King
+1 for SOLID. Also, Thought it worth mentioning Bob Martin's definitive articles here: http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod and his book, Agile Software Development, Principles, Patterns, and Practices (http://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445) Which is a really good overview of the "state of the art" in OO Design.
Sean McMillan
A: 

You should probably learn more about object oriented programming. Here is a nice tutorial that's based on Python:

OOP Tutorial in Python

Object oriented programming is a way to organize you programs in a way that mirrors the things in the problem you are trying to solve.

HIH

...richie

Richie
A: 

Learn a different language! I love python, and, despite what everyone says, my python is better because I know java. (Some people complain that starting with java causes one to initially write clunky python, but if you already know more or less the easy way to do something in python, you will be safe from this.)

Let me do a little bit of chainsaw surgery here. It is easy to write python the first time. I write it in vim, because I can and because I love vim. It is easy to maintain and refactor java if you have an IDE. I write java in Eclipse, because I'd be hopeless without it. But the point is, writing in a language that forces you to use abstractions with a tool that makes abstractions easier will slowly shape your brain to code more abstractly. You will bring that back to python, even though the preferred abstractions will be slightly different.

David Berger
+2  A: 

Read other peoples code. That is the best way to learn better design principals. Read peoples code at your work, read peoples code on forums, take a look at open source projects... and never stop coding, because the best teacher is the mistakes you make along the way...

Check out the book, Pragmatic Programmer, from Journeyman to Master. This is a great book to help fill that gap in knowledge you are looking for.

dferraro
+1  A: 

It's not a book (books are so passé), but it's definitely good to spend a few hours reading through the Portland Pattern Repository.

While it's also not a tutorial, it has great code examples, and equally great discussion on design patterns and programming in general. It's an excellent resource on learning how to think like a programmer.

Seth
+3  A: 

With a year of programming experience, I won't suggest Design Patterns (or Head First Design Patterns), as I think Design Patterns (the concepts) is best processed once you have more programming experience, perhaps more like 5-10 years of experience.

I think the book, The Pragmatic Programmer: from Journeyman to Master by Andrew Hunt and David Thomas is perhaps your best bet for the most bang for your buck at the level you are at currently. Here is an excellent summary of the topics and contents (from Jeff Atwood at Coding Horror). Use inter-library loan if you cannot afford to purchase your own copy.

cover of The Pragmatic Programmer

Two other titles that are also language-agnostic yet classic books highly recommended for new programmers that you can keep in mind are The Mythical Man-Month (anniversary edition published in 1995) by Fred Brooks, and Code Complete (second edition) by Steven McConnell.

These books will help expand your programming knowledge without overwhelming you at your current stage of development, and make for a solid foundation for becoming a better programmer. All of these books are constantly on the top of recommended programming books for serious programmers, and they are all "old" enough that they are clearly not a fad, but enduring recommendations not limited by a particular language, environment or tool-set.

mctylr
-1: The Pragmatic Programmer is a very good book, but IMO Design patterns should be first on the list. I read it when i had just about exactly 1 year of programming experience and it has been a real eye opener for me. Programming for 5 or even 10 years without ever having heard of design patterns seems like a huge waste of time to me.
Adrian Grigore
I believe a new developer needs to learn how to walk first (i.e. program "in the small") before learning to run (i.e. programming "in the large"); whereas Patterns is largely focused or best serves large scale application or system programming. I rather a developer learns good basics (foundations) before risking over-designing every application through blind usage of Patterns.
mctylr
I don't know much about this inter-library loan stuff. I take it that its a service that allows you to borrow books from libraries not in your area, but can you borrow books from another _country_? I searched for "The Pragmatic Programmer" in that site you linked, and the closest library that stocks that book is in _Hong Kong_.
cornjuliox
Yes inter-library loans is the borrowing of books between libraries. Personally I have always been able to find a source domestically, but I believe a librarian said they could also send a request internationally if I needed to. You will have to check with a librarian at your local library for the details.
mctylr
+1  A: 

I suggest Structure and Interpretation of Computer Programs, which is available on-line in book form, as well as an on-line course.

It's not a book on design patterns, but it will help you develop good fundamentals for building applications.

Joe Internet
+1  A: 

I would definitely add another book. I think that Clean Code by Bob Martin is a very good book to tell you how to write code that is maintainable. It introduces several easy rules that leads to code that is very well structured and readable.

zlajo
+1  A: 

The best way to learn good software design is to write code in a bunch of different ways, read code written by others, and learn what works and what doesn't first-hand.

When you are writing code, ask the following questions:

  1. How will I test it?
  2. How will I debug it?
  3. What do I find myself doing over and over again?

I'm sure other people have other ideas, based on their own experiences.

novalis
A: 

Wow, I wonder why nobody said until now that U really should not go too deep into theory. After one year Ur code is ugly. Nothing to do about it. If U get most things done U want to finish, it is already very awesome. But U cannot cheat Ur brain with theory. Just go on writing and be angry about Ur code. That is the best way to write better. Take Ur time to think about how to write working code in a more readable/usable/maintainable way as often as U can. AND: Read other peoples code + get reviews on Ur code! There should be people out there who can write better then U. Learn by example!

And maybe 20% of Ur programming time (that means if U code every day, not more than 2 months a year!) get some theory.

Why not start with masses of theory? U kill Ur motivation and Ur instinct. But when U sit there and try to solve a problem it is mostly about the right instinct. With too much theory U overthink the problem and Ur solutions. But Ur instinct will be still on the level of Ur experience, no matter how much U read.

(sorry, if bad english. not my mothertounge)

erikb