Questions tagged [design-patterns]
For questions requesting extra attention to be paid to the usage of design patterns in the code.
1,426 questions
81
votes
6
answers
233k
views
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 ...
70
votes
4
answers
59k
views
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 ...
51
votes
3
answers
109k
views
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:
<...
38
votes
2
answers
3k
views
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 ...
37
votes
2
answers
106k
views
Entity Framework Generic Repository Pattern
Thought 1
...
33
votes
5
answers
1k
views
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 ...
29
votes
2
answers
91k
views
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 ...
28
votes
2
answers
16k
views
Reusable Unit Of Work Interface / Factory
Given my IUnitOfWork interface
using System;
public interface IUnitOfWork : IDisposable
{
void Commit();
}
I then ...
27
votes
3
answers
2k
views
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 ...
26
votes
4
answers
2k
views
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 ...
25
votes
6
answers
2k
views
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 ...
25
votes
1
answer
11k
views
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 ...
25
votes
1
answer
5k
views
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):
...
25
votes
4
answers
14k
views
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 ...
24
votes
1
answer
17k
views
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). ...