Questions tagged [design-patterns]
For questions requesting extra attention to be paid to the usage of design patterns in the code.
1,420 questions
82votes
6answers
233kviews
Design a chess game using object-oriented principles
I would like to know if my approach is correct and how could it could be improved? Also, is there a way to get rid of the relation between the Piece and the ...
69votes
4answers
59kviews
EF Code First with Repository, UnitOfWork and DbContextFactory
I am about to >explode< :) due to amount of reading on this subject... My head hurts, and I need some honest opinions... There is a similar question/review that I noticed, but I believe my approach ...
51votes
3answers
109kviews
Repository/Service Design Pattern
I use the Repository/Service design pattern in my projects and I have found something that might be a bit redundant. Am I writing any unnecessary code? With that in mind, here is my structure: <...
38votes
2answers
3kviews
KISS my... unit of work
I've seen many, many UoW+Repository implementations. Whenever one was built on top of Entity Framework, I'd cringe at the added complexity. Sure the complexity buys you (sometimes) full decoupling ...
37votes
2answers
106kviews
Entity Framework Generic Repository Pattern
Thought 1 ...
33votes
5answers
1kviews
I have a problem ...factory
I'm creating a system to generate math problems. As you know in mathematics, there are several different kinds of problems: Binary problems, fractions, decimals, comparating two numbers, etc. I'm ...
29votes
2answers
91kviews
Implementing factory design pattern with generics
In this new project I'm working on I need to create objects on runtime by data from the DB, right now I have two groups of classes, each group implementing a different interface. I started working on ...
28votes
2answers
16kviews
Reusable Unit Of Work Interface / Factory
Given my IUnitOfWork interface using System; public interface IUnitOfWork : IDisposable { void Commit(); } I then ...
27votes
3answers
2kviews
How is my CMS design? Any security, design, or other issues?
I am trying to learn PHP in depth by creating this personal CMS. I try to utilize OOP concepts and do best I can... The way I am trying to design this CMS is to keep including 'modules' within a page ...
26votes
4answers
2kviews
Law of Demeter and data models?
Inspired by this question, but hopefully not a duplicate. I understand that the Law of Demeter is very useful in case of services interacting with other services, for example it's much easier to mock ...
25votes
6answers
2kviews
A Library Class : Point
I am trying to create a library of my own which contains (among others), a class called Point. As the name suggests, it is intended to encapsulate a point ...
25votes
1answer
5kviews
A Pong Game using C++
I wrote a simple, 2-player Pong game for a Udacity Nanodegree in C++. The program has the following class structure (relatively new to UML so any tips on here would be very much welcome too): ...
25votes
4answers
14kviews
Interface for unit of work pattern and repository pattern
I'm trying to design a well defined yet simple interface for the unit of work and repository patterns. My UoW's are exposed to services and services then "get repositories" that it needs to query. I ...
24votes
1answer
11kviews
Strategy design pattern with various duck type classes
I've recently picked up the Head First Design Patterns book in an effort to become a more efficient and better Python programmer. Unfortunately, the code examples in this book are in Java. I'm not ...
24votes
1answer
17kviews
Generic repository and unit of work code
I am writing a WPF application that needs to access information from a database (I am currently using Entity Framework code first, so data access is via DbContext). ...