Skip to main content

All Questions

1 vote
1 answer
717 views

Builder design pattern when creating object between many layers

I stumbled on following problem, and I'm curious if it could be done better. A while ago I wrote a factory class that looked something like this: public class Foo { private IDbContext ...
Draeggiar's user avatar
-1 votes
3 answers
293 views

Design pattern for creating and scheduling tests/exams

I have an Exam class that represents an examination/test: public class Exam { public int Id { get; set; } [Required] [StringLength(maximumLength: 30, MinimumLength = 1] public string ...
Amal K's user avatar
  • 111
7 votes
3 answers
6k views

Design pattern: How to inject dependencies into a Command pattern

I am pretty new to programming languages and only have limited knowledge about design patterns, so I hope you can help me with the following problem: I have an application that operates on a group of ...
Martin's user avatar
  • 91
0 votes
1 answer
650 views

how to use Builder pattern combined with protected access modifier?

I'm reading a book in Design Patterns, and below is some code example used by the author. The author tries to build a html builder as (code in C#): public class HtmlElement { public string Name, ...
slowjams's user avatar
  • 127
3 votes
3 answers
3k views

Design pattern to force client of a class to call a method

I have a large class with complex properties. I'd like to introduce a default implementation, allow the user to override part of the default implementation and also make sure the user calls a sync ...
BornToCode's user avatar
  • 1,273
3 votes
3 answers
2k views

Am I using the factory method design pattern correctly, or which creational pattern should I use?

I've been studying creational design patterns for the past week or so because I have a common use case that keeps coming up, and I can't figure out which pattern fits the bill. Here is a simplified ...
rory.ap's user avatar
  • 909
3 votes
3 answers
2k views

Pattern to use (if any) to co-ordinate loosely coupled classes with strong interdependencies

I have a collection of cooperative classes whose behaviors are interdependent upon one another. But I wish to keep them loosely coupled, so I've created appropriate interfaces. I want to determine an ...
Arthur Sanchez's user avatar