All Questions
14 questions
8
votes
5
answers
2k
views
Open Closed principle in design patterns
I am bit confused about how Open Closed principle can be applied in real life. Requirement in any business changes over the time. According to Open-Closed principle you should extend the class instead ...
17
votes
3
answers
5k
views
Does the state Pattern violate Liskov Substitution Principle?
This image is taken from Applying Domain-Driven Design and Patterns: With Examples in C# and .NET
This is the class diagram for the State Pattern where a SalesOrder can have different states during ...
1
vote
2
answers
385
views
Are experienced developers and software architects able to describe an entire software application in terms of design patterns?
Do experienced developers and software architects see entire application in terms of design patterns?
In other words experienced developers and software architects able to describe an entire software ...
25
votes
5
answers
69k
views
Best way to load application settings
A simple way to keep the settings of a Java application is represented by a text file with ".properties" extension containing the identifier of each setting associated with a specific value (this ...
1
vote
0
answers
83
views
Hierarchy of models while designing a client for a RESTful service
I am trying to write a client for a restful service. I am confused in designing the models. Below are the details:
I have a Model named UnicastMessageRequest, it's definition is like this:
...
11
votes
5
answers
5k
views
A reference counting pattern for memory managed languages?
Java and .NET have wonderful garbage collectors that manage memory for you, and convenient patterns for quickly releasing external objects (Closeable, IDisposable), but only if they are owned by a ...
2
votes
2
answers
165
views
Should we add an extra class to this code sample
I have a shopping website which allows users to place orders. In my web application when the users click 'Create Order' i call an OrderService class which looks like the below:
public class ...
2
votes
4
answers
160
views
Are names like OrderCreation and UserRegistration suitable names for business logic / domain classes
We have moved to a more SRP model and found coming up with class names challenging. Previously we had a Order class that looked something like this:
public class Order
{
public void Create()
{...
4
votes
3
answers
9k
views
What should be in my business logic class
We are currently having an internal debate on how our business logic classes should be structured. At the moment we structure our business classes like this:
public class OrderBL
{
public void ...
25
votes
7
answers
14k
views
Difference between Pattern and Principle
What is the difference between Object Oriented Design Patterns and Principles? Are they different things? As far as I understood both of them try to achieve some common goal (e,g. flexibility). So can ...
5
votes
1
answer
3k
views
State pattern vs Inheritance
In the following image for the State Pattern from Applying Domain-Driven Design and Patterns: With Examples in C# and .NET
I'm trying to persist the SalesOrder entity into the database. Normally I ...
14
votes
9
answers
22k
views
Are too many if-else statements for validation bad? [duplicate]
From the book Professional Enterprise .Net, which has 5 star rating on Amazon that I am doubting after having a read through. Here is a Borrower class (In C# but it's pretty basic; anyone can ...
4
votes
2
answers
1k
views
Hide or Show singleton?
Singleton is a common pattern implemented in both native libraries of .NET and Java. You will see it as such:
C#: MyClass.Instance
Java: MyClass.getInstance()
The question is: when writing APIs, ...
4
votes
4
answers
2k
views
Should we validate a state transition before attempting it in the State Pattern?
When applying the State Pattern illegal transitions should result in an exception being thrown (or at least that's what I understood from the pattern)
I know exceptions are for "unexpected behavior" ...