solid-principles

How such an important principle "OCP" will be the reason of massive code duplication practice?

OCP (Open/Closed Principle) is one of the SOLID principles. Which is says: ”Software Entities should be Open for Extension, but Closed for Modification.” It take me while to understand the above sentence about OCP. And when I start read more about it, I found it make sense and so useful, but in the mean time I noticed it cause duplica...

SOLID principles

can somebody explain/name me the priciples of SOLID development ? ...

is this violating the SOLID principles ?

i have something like this in my project, the project it's kinda finished already (it's working) i just want know if it is ok with the SOLID principles static public class Tools { static public GetProduct(this id){...} static public GetProductCategory(this id){...} static public GetUser(this id){...} // I also have h...

Is the set of SOLID principles missing an extra 'D'?

Although not a pure OOD principle - should DRY also be included when thinking about SOLID principles? If not - why not? ...

Interface Segregation in Qt

I always try to apply the S.O.L.I.D principles and I really like the Qt toolkit but I find myself stuggeling all the time with the single inheritance rule. If you are using multiple inheritance, moc assumes that the first inherited class is a subclass of QObject. Also, be sure that only the first inherited class is a QObject. ...

DDD Repositories and Factories

i've read a blog about DDD from Matt Petters and according and there it is said that we create a repository (interface) for each entity and after that we create a RepositoryFactory that is going to give instances (declared as interfaces) of repositories is this how project are done using DDD ? i mean, i saw projects that i thought tha...

SOLID Liskov Substitution Principle

if i have something like class square : figure {} class triangle : figure {} does that mean that i should never ever use the square and triangle classes but only refer to figure ? like never do like this: var x = new square(); ...

Is the Composite Pattern SOLID?

the leaf in the composite implements the Component that has the Add Remove and GetChild methods that he is never going to use (violation of the Interface segregation) so is the usage of composite pattern SOLID ? link to composite http://www.dofactory.com/Patterns/PatternComposite.aspx ...

What is a good way to show the relationship between loosely coupled classes and interfaces?

I have introduced the SOLID principles to my team and they understand and are excited about using the principles. S - SRP - Single Responsibility Principle O - OCP - Open/Closed Principle L - LSP - Liskov Substitution Principle I - ISP - Interface Segregation Principle D - DIP - Dependency Inversion Principle I have given them a coup...

Is there any static analysis tools that will report how closely the SOLID principles are followed?

The title says it all. I know blindly following any "best practice" can still lead to a stinking pile of crap that strictly adheres to the best practice. The SOLID principles are just that, principles. They don't apply to every situation but they are still very good heuristics for finding possible improvements in your code. The downsid...

Liskov substitution principle - no overriding/virtual methods?

My understanding of the Liskov substitution principle is that some property of the base class that is true or some implemented behaviour of the base class, should be true for the derived class as well. I guess this would mean when a method is defined in a base class, it should never be overrided in the derived class - since then substit...

Should logging reside within a class who's primary purpose is not logging?

This is more of a theoretical question. Should logging reside within a class who's primary purpose is not logging? Here is a simple interface for anything that will preform a calculation on a number. public interface ICalculation { public int calculate(int number); } Here is an implementation of the ICalculation interface that...

Configuring Automapper in Bootstrapper violates Open-Closed Principle?

I am configuring Automapper in the Bootstrapper and I call the Bootstrap() in the Application_Start(), and I've been told that this is wrong because I have to modify my Bootstrapper class each time I have to add a new mapping, so I am violating the Open-Closed Principle. How do you think, do I really violate this principle? public sta...

SOLID DDD ORM request (to use clean entities and repositories) for .NET

Is there a ORM that would leave my entities classes clean, withouth any attributes for properties and classes would not be ActiveRecord pattern so it should not have entity.Save/Delete etc. optional: able to execute stored procedures and parse the result into entityies ...

How should I plan the architecture for a system rewrite?

I am planning to rewrite a current system that I previously worked on a portion of. I am doing this as a learning exercise. Below is a description of the old system, basic architecture of the new system, some best practices I want to follow, the goals I want to acheive and my questions. Let me explain the old system: 1. SQL Server Datab...

Robust Code framework?

I hate writing code that makes my software more solid. This is something the framework should have done! So, is anybody aware of a code "enhancing" utility that solidifies the code? If I had to create something like this myself, it would work as follows: When you're compiling your code with a Debug flag, it would auto-magically add "sol...

SOLID SRP and FluentNhibernate entities

this class is from http://wiki.fluentnhibernate.org/Getting_started it has some logic in it and I think this violates the Single Responsibility Principle, how do you think, how would you resolve this ? Another thing that bothers me is why in nhibernate always it is being used IList and not IEnumerable which has less functionality ? pub...

Single Responsibility Principle(SRP) and class structure of my rpg looks "weird"

I'm making a role playing game just for fun and to learn more about the SOLID principles. One of the first things I'm focusing on is SRP. I have a "Character" class that represents a character in the game. It has things like Name, Health, Mana, AbilityScores, etc. Now, normally I would also put methods in my Character class so it would ...

How can one measure the SOLIDness of C# code?

Which metrics are there and which tools exist to measure the SOLIDness of C# code? Or tools to indicate where the principles are violated most harmfully? ...

Real world Opensource c# applictions showing good code

Hi All, I have been reading up on SOLID principles and was wondering if there is a good large opensource application or project in DOTNET that shows SOLID principles in use in a real world product. If there are any other opensource projects that are considered to be good coding samples I would be very intrested to see them these too. ...