Design principles for complete noobs? [closed]
Asked Answered
S

18

15

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.

Shipentine answered 8/12, 2009 at 18:22 Comment(6)
LOL. I've read a lot of books and I still say "Man, that's really ugly" after I'm done. The fact that you recognize it means that you're already in the top percentile of developers. :) codinghorror.com/blog/archives/000530.htmlSelfhelp
Are you looking for any general advice or are you thinking of Python in particular? It might be a good idea to make this a community wiki if it is going to be a general "How to learn best practices of software design".Alemannic
I'm looking for general advice. I figured design principles and processes would be independent of any one programing language, so I didn't bother to specify.Shipentine
Free? How about checking out books from the library and then buying the ones you find useful? Inter-library loan will allow you to check out almost any book in existence for no or little cost. Personal recommendations: The Art of Agile Development, Code CompleteTarantella
Like others have said, the fact that you can recognize design issues is key. Just keep writing more and more code. Your bad code will bit you in the ass and you will never do that again :-)Chartist
I live in an area where there are no public libraries (Manila, Philippines), and books like those are expensive (at least for someone like me), so I resort to relying on free stuff from the web to educate myself.Shipentine
W
4

Read other people's code. That is the best way to learn better design principles. Read people's code at your work, read people's 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.

Wo answered 8/12, 2009 at 19:10 Comment(0)
C
12

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", a 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.

Cosmotron answered 8/12, 2009 at 18:27 Comment(0)
T
7

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.

Trapper answered 8/12, 2009 at 18:24 Comment(2)
If you're using anything but Java/C# (Python, C++, etc), you don't really need more than barely half of the GOF Patterns.Depicture
Yes, but knowledge is always welcome. It also separates kids from real men :)Trapper
B
4

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.

Bureaucratize answered 8/12, 2009 at 18:23 Comment(1)
Well the design patterns book is obviously relevant but (if my experience of trying to read it when I started programming is indicative) he will possibly misunderstand it. The reasons for applying the patterns become obvious only after you have created a few larger applications. I would recommend Practical Object Oriented Design with Ruby by Sandi Metz. Even if you are not a Ruby programmer.Plaintiff
W
4

Read other people's code. That is the best way to learn better design principles. Read people's code at your work, read people's 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.

Wo answered 8/12, 2009 at 19:10 Comment(0)
P
3

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.

Pasture answered 8/12, 2009 at 18:53 Comment(1)
+1 for SOLID. Also, Thought it worth mentioning Bob Martin's definitive articles here: butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod and his book, Agile Software Development, Principles, Patterns, and Practices (amazon.com/Software-Development-Principles-Patterns-Practices/…) Which is a really good overview of the "state of the art" in OO Design.Eyebolt
J
3

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.

Jim answered 8/12, 2009 at 19:54 Comment(4)
-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.Tranquilize
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.Jim
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.Shipentine
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.Jim
C
2

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

Conchiferous answered 8/12, 2009 at 18:27 Comment(0)
C
2

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.

Carob answered 8/12, 2009 at 19:32 Comment(0)
S
2

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.

Spill answered 8/12, 2009 at 20:14 Comment(0)
C
2

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.

Currier answered 8/12, 2009 at 20:24 Comment(0)
P
2

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.

Phillada answered 8/12, 2009 at 20:54 Comment(0)
H
1

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.

Hoopen answered 8/12, 2009 at 18:28 Comment(0)
P
1

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

Pires answered 8/12, 2009 at 19:2 Comment(0)
E
1

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.

Etz answered 8/12, 2009 at 19:5 Comment(0)
F
1

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)

Following answered 8/12, 2009 at 21:2 Comment(0)
S
0

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

Slade answered 8/12, 2009 at 18:26 Comment(0)
M
0

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.

Monocotyledon answered 8/12, 2009 at 18:37 Comment(0)
D
0

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.

Dialysis answered 8/12, 2009 at 18:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.