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.
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.
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.
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.
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.
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.
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.
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.
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.
Check out this book: Head First Design Patterns ...literally. Check it out. From the library.
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.
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.
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.
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:
- How will I test it?
- How will I debug it?
- What do I find myself doing over and over again?
I'm sure other people have other ideas, based on their own experiences.
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.
You should probably learn more about object oriented programming. Here is a nice tutorial that's based on 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
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.
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)
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
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.
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.
© 2022 - 2024 — McMap. All rights reserved.