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.
Closed 9 years ago.
I've heard that using a lot of polymorphism is bad and that it's better code design to avoid polymorphism where ever possible. Is this true?
you probably heard that about Inheritance. The design principle being favor object composition over class inheritance.
No, quite a few design patterns are implemented primarily using polymorphism. The factory pattern is one of the more common patterns that use it.
It is a fundamental part of object oriented programming.
Related
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.
Closed 10 years ago.
One of the disadvantages of inheritance is that the superclass and its subclasses are very tightly coupled. A lot of resources (e.g. SO) say to compensate for this by being 'cautious' when writing a class that might be subclassed.
Are there any guidelines about what precautions you should take, or testing processes to go through to make sure your base class is safe? Or do you just have to try to predict all potential subclass behavior?
Do as little as required in the parent classes. If you must do more complex operations then separate them into logical pieces, putting each piece in a different method so that children can override them as appropriate.
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.
Closed 10 years ago.
Are there any design patterns that deal directly with configuration classes. Thats is, classes that are simply containers for configuration settings.
I usually tend to use constants for global settings. Not everything must be a class.
Some will tell you that a Singleton pattern is fit here, but I think different. Singletons are evil. See this question on Programmers
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.
Closed 11 years ago.
I've been programming with OOP for a year. But I think sometimes, my solutions to the problem, code quality and so on, is not the best as it could be. Are there any good books on writing good and quality OOP code (programming language doesn't matter) for advanced programmers? What would you recommend?
I'm reluctant to suggest a "patterns" book, but Design Patterns is pretty good. It's much more descriptive than proscriptive -- and some of the patterns won't make any sense at all, until you've fought the underlying problem that leads to the patterns -- but if you read the book with the mindset that they are trying to provide a grammar that programmers can use to talk about problems rather than tools that are the Best Possible Solutions, then it is an excellent book.
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.
Closed 12 years ago.
What is the best ORM Object Relational Mapping framework or architecture in your opinion, And why??
Hibernate.
There is a community support behind it. It s widely used. Easy to learn and use.
Hibernate is good documented, has support in other frameworks like Spring. Also implements JPA so it's definitly good choice.
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.
Closed 10 years ago.
I find myself rarely using object oriented principles when I design applications. I am looking for a good reference for Object Oriented design. I'm using C# as my programming language and would like to have a reference which helps to make use of the OO contructs provided by C#. But basically I need a good book to derive some inspiration.
Here goes: two milestones
Design Patterns: Elements of
Reusable Object-Oriented
Software
Head First Design
Patterns
I think a book on Design Patterns may be what you want. The classic one would be Deisgn Patterns: Elements of Reusable Object Orientated Software.
Check out Evan's DDD