Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm a self taught programmer; I understand the foundations of programming and what classes are, but my code tends to be messy with class methods interacting with a half a dozen other classes, and my structure is terrible. If someone else were to look at my code, I don't think they would be able to understand what was going on.

share|improve this question

closed as not constructive by Mark Trapp Dec 13 '11 at 20:24

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

4  
This is very likely a duplicate, so you can search the archives here. But also go to Google: Gang of Four, Clean Code, Agile Principles Patterns and Practices, Code Complete, etc. –  Anthony Pegram Oct 14 '11 at 2:27
    
- Designing Object Oriented Software - Walks you through OO design principles with examples - Object Thinking - More theory than hands on - but highly recommended –  talonx Oct 14 '11 at 2:44
    
[Object Oriented Software Construction - Bertrand Meyer] (amazon.com/Object-Oriented-Software-Construction-Book-CD-ROM/dp/… ) –  mikemay Oct 14 '11 at 5:56
    
1  
I've always been a big fan of Object Oriented Thought Process –  David Welker Oct 14 '11 at 13:38

4 Answers 4

up vote 4 down vote accepted

Read, in order:

Code Complete Is the first book you should read. It's about programming well. Regardless of what other book(s) you choose, read this.

Head First Object Oriented Design
I like the "Head First" book series in general. I like how they teach. In fact the authors spend a few pages at the beginning explaining their teaching approach.

Head First Design Patterns

Note: If you need a book to learn a language, look for one from the "How to program" series by Deitel and Deitel. After 30 years of reading computer books I've found these to be very excellent teaching books. There are volumes on Java, C#, C++, and others. They are expensive as hell because they are so popular, so go with a used copy. I have 5 different editions on Java and one on C++.

share|improve this answer
    
Thank you very much –  David Oct 15 '11 at 1:24

Look into design patterns. These are tried-and-true methods to structure your code to solve commonly encountered problems. The more you become familiar with these, the more you'll train your eyes to seek out patterns and solve them elegantly. It'll also make describing your code easier in that you can use the name of the pattern to explain it.

The most classic authority on this is Design Patterns: Elements of Reusable Object-Oriented Software, often referred to as The Gang of Four, or simply Gamma. This book is pretty readable and a good reference to have in your bookcase.

A friendlier read, which may appeal to you even more if you're new to the concept of design patterns is Head First Design Patterns, which is a whimsical approach to learning these and it covers the most often encountered patterns. Another advantage to this source is that it also explains some concepts associated with good object oriented design.

share|improve this answer

Applying UML and Patterns by Craig Larman

An excellent tutorial on object-oriented analysis and design, highly recommended. POS system case study alone makes it worth reading the book.

  • Another thing I like in this book is nicely described and explained walkthrough of a reasonably productive iterative development process.

Title reference to "UML and Patterns" is rather misleading, I think most of those who have read the book would agree on that. To study UML and design patterns one would better go elsewhere.

Book subtitle is much better fit for contents: "An Introduction to Object-Oriented Analysis and Design and Iterative Development"

share|improve this answer

Head First Design Patterns is pretty good. The Gang of Four patterns book is the canonical reference, but for a beginner, it's a bit short on the details of the whys and wherefores. Head First walks a less experienced programmer through examples and explains the thinking behind the design and the patterns. It's not comprehensive, but it's more explanatory, and even aside from learning the specific patterns, it's useful for looking at the thinking behind OOP design in general.

share|improve this answer
    
I see that Head First also has an OOP Analysis and Design book. I haven't read it, so I can't tell you if it is any good, but in general I've liked the Head First approach. –  kylben Oct 14 '11 at 3:16
    
Now that I think of it, I learned a lot about design from Fowler's "Refactoring". Again, a lot of that is by implication rather than specific techniques for how to do design, but sometimes seeing something applied works better than just having it explained. It does for me, anyway. –  kylben Oct 14 '11 at 3:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.