Thank you for your answers. I had a look at most of the suggested books.
Effective Java, by Joshua Bloch
This book consists of 78 guidelines, which explain how you should use OO concepts and what the advantages are for doing so. It is a useful book with a lot of practical advice. It answers my questions with the following chapters:
- Item 13: Minimize the accessibility of classes and members
- Item 4: Enforce noninstantiability with a private constructor
- Item 16: Favor composition over inheritance
- Item 3: Enforce the singleton property with a private constructor or an enum type
- Item 15: Minimize mutability
- Item 1: Consider static factory methods instead of constructors
Patterns of Enterprise Application Architecture, by Martin Fowler
This book covers various separate topics about the structure and architecture of programs. It is in interesting read for anybody who is working on a "Enterprise Application", a program specific to a certain domain. As it covers the architectural part of certain topics, it gives a broad insight to architecture. Interesting book, but it answers only a part of my questions.
- Mapping to relational databases
- Web presentation
- Concurrency
- Session state
Clean Code, by Robert C. Martin
This book is about keeping code clean and maintainable. It explains how to structure the code and gives guidelines how to keep your code clean. I dislike the writing style and many things covered in this book are already clear to me. It does cover OO somewhat and explains some programming principles, such as:
- The law of Demeter
- The single-responsibility principle
- Class cohesion
- Encapsulation
- Dependency injection
Code Complete, by Steve McConnell
A useful, thick book with a lot of concrete tips and guidelines for programmers. Assumes that the reader knows how to program and wants to get good at it. Covers writing code, working in a team and the software process. It misses specific information on how to use OO concepts. This book, although very practical and useful, is not what I was looking for.
Refactoring, by Martin Fowler
This book describes some very practical ways to refactor something in code. It offers an example, a motivation and step-by-step plan to do the refactoring. It explains how to move between various OO structures, but it omits information on what the best OO structure is and why. Some section names:
- Replace Parameter with Method
- Encapsulate Field
- Extract Superclass
- Replace Method with Method Object
Agile Software Development, Principles, Patterns, and Practices, by Robert C. Martin
I had not the chance to look at this book. The SOLID principles, although very true, are quite abstract and do not answer many of my questions.