Questions tagged [design-principles]

Design principles are ideas that guide developers toward certain goals in software design.

Software has many different desirable quality aspects -- among them are reliability, security, maintainability, efficiency, and size; and these are all impacted by choices made by the developers. Software design principles tend to focus on the maintainability aspects of quality: is the code loosely coupled, or does it have many dependencies that make it hard to use? Is the code highly cohesive, or is a collection of unrelated information needed to use a module? Is the code readable and understandable? Is the code testable? Is the code usable and reusable? Is the code simple or complex?

Various design principles can be used by developers to advise them in making choices that will yield highly cohesive, loosely coupled, simple, maintainable designs. The SOLID design principles are an example of specific design advice for object oriented projects. The Principles of User Interface Design provide design advice for creating user interfaces.

309 questions
0
votes
1 answer

Good practice to show Form from UserControl

I want to follow good practices design patterns when developing WinForms applications. I have a UserControl with a button "Add" to open a new Form where de user can search Employees. How i can organize my code?
apaz
  • 51
  • 3
0
votes
0 answers

*Why do we even need Iterator patterns?*

So I lean back all relaxed and sh*t, refurbishing my design patterns knowledge, everything going fine and dandy, as I wait for the weekend adrenaline to kick in. My life couldn't get any smoother. Next thing you know... I get the biggest realization…
Mohd Abdul Mujib
  • 13,071
  • 8
  • 64
  • 88
0
votes
1 answer

Open/Close Principle in OOPS

I am working on a telecom project. I have implemented Open/Closed principle in my project. Below are my classes. MainServiceClass.CS public abstract class BaseServiceClass { public abstract IEnumerable GetServiceData(); public…
KiddoDeveloper
  • 568
  • 2
  • 11
  • 34
0
votes
1 answer

Can you apply OOP to Linq Projections?

Using Visual Studio 2010 .Net Framework 4 C# Linq to Entities Issue I would like to be able to apply Object Oriented Principles like DRY and SOLID to some Linq Projections. With compiled queries or passed parameters I can apply these to the rest…
Rodney S. Foley
  • 10,190
  • 12
  • 48
  • 66
0
votes
1 answer

Is it a principle to always have the most abstract parameters and if so does it have a name?

For example, one might have a method max on an integer array. public static int Max(int[] ints) { var max = ints[0]; foreach(var i in ints) { if(i > max) { max = i; } } return max; } But…
user420667
  • 6,552
  • 15
  • 51
  • 83
0
votes
1 answer

How can I split selenium test classes from selenium framework?

I am currently working at my job on GUI web pages automation using selenium via Java in Intellij. We have few product development teams, where one is maintaining&developing continuously selenium framework and theirs tests. Other teams grabbed…
0
votes
2 answers

Method with object vs parameter list in Repository Search. Violation of SRP?

I have a debate with my peer on whether it is good practice or not to either encapsulate a repository method's search options in an object or in a (potentially growing) parameter list. In summary, psuedocode would be: SearchItems(int id,string…
tinonetic
  • 7,751
  • 11
  • 54
  • 79
0
votes
1 answer

Design Improvement

Suppose that we have a UI with a selectOneMenu, which contains two items basic and customized. Let the class DocumentController be responsible for generating PDF documents for the chosen type (basic or customized). It is clear that an extention of…
Ayoub Falah
  • 484
  • 3
  • 19
0
votes
2 answers

Base class has one responsibility, and derived class has another responsibility. Does this conforms to SRP?

I've a VolumeButton which derives from ButtonModifier. If I put my business logic (volume up/down, mute, etc) into VolumeButton, enable/disable logic to base class ButtonModifier. Like, public class VolumeButton : ButtonModifier { /// Event…
Yang Nan
  • 1
  • 2
0
votes
0 answers

How to pass parameters to constructor of dependency from within dependent class? Create provider?

For example, my DependentClass depends on some AbstractCsv class. Here is the declaration of AbstractCsv's factory (http://csv.thephpleague.com/instantiation/): public static AbstractCsv::createFromFileObject(SplFileObject $obj): AbstractCsv And…
0
votes
1 answer

Liskov Substitution Principle - Am I violating it here?

I am still trying to understand LSP. From what I understand so far, Subclasses / Subtypes should be able to substitute Baseclass / Main type and the program should work intact. I have the following... abstract class Warehouse { private…
Kevin Rave
  • 13,876
  • 35
  • 109
  • 173
0
votes
2 answers

IOS : Best practices for Fields Validation on User Interface

In my app I want to validate user inputs in the fields. For Example If textfields is empty. Or email is in correct format I don't want to add validation logic in ViewController, Neither I want to pass UIView to a Validator Class I have multiple…
Irfan
  • 5,070
  • 1
  • 28
  • 32
0
votes
1 answer

Delegates with multiple notifications in C++

I've been considering the best way to implement delegates in C++, and so far I'm inclined to using std::function callbacks. However, some of my classes issue several delegate notifications (such as opened, closed, and changed_state). Instances…
André Fratelli
  • 5,920
  • 7
  • 46
  • 87
0
votes
1 answer

Open Closed Principle basic doubts

I do see a lot of questions posted on OC principle and some have good answeres , i still have some doubts regarding this , below are the ones. 1) Lets assume there is registration module in my application currently it supports only one country , i…
sumedha
  • 473
  • 1
  • 9
  • 24
0
votes
1 answer

where to instantiate simple values /entity objects? DDD

Using domain driven design, where are simple value objects/entities instantiated? For example, if i needed to create a simple value object in a service class, would I just call the new operator on the value object's class, coupling this to the…