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
6
votes
7 answers

Best practice: instance variables filling over time

I'm new to the concept of object oriented programming (in java) and I often encounter the following design problem: I often create classes with instance variables which are not known at the moment of initialization. These variables are filled over…
Fabian Gehring
  • 1,133
  • 9
  • 24
6
votes
2 answers

Why java method does not support multiple return values?

While working with Java Applications, I feel most of the times one question : Why Java doesn't support multiple return values of methods? I know that people who designed Java, must have done thinking about this topic but I didn't get any answer or…
Vishal Zanzrukia
  • 4,902
  • 4
  • 38
  • 82
6
votes
1 answer

How many simultaneous scheduled Jobs can I have in Node

In this Node app I'm working on, it's possible for users to book appointments. When an appointment is booked, the users will later get a reminder by mail X hours before the actual appointment. I'm thinking about using Node-schedule for this task.…
Anders Östman
  • 3,702
  • 4
  • 26
  • 48
6
votes
6 answers

(Programming to an interface v/s working with concrete class) when there is just one concrete class

In an OO component, when you have only one implementation available for an class and that class is not 'published' to other components, is it still advisable to have an interface and work with the interface instead? I am fully aware of 'programming…
user170272
  • 203
  • 1
  • 6
6
votes
3 answers

What practices can safeguard against unexpected deferred execution with IEnumerable as argument?

There are a few questions similar to this which deals with right input and output types like this. My question is what good practices, method naming, choosing parameter type, or similar can safeguard from deferred execution accidents? These are most…
nawfal
  • 70,104
  • 56
  • 326
  • 368
5
votes
2 answers

UML help C# Design Principles

Could anyone please point out the meaning of the graph below: What is the relationship between PolicyLayer and PolicyServiceInterface What is the relationship between PolicyServiceInterface and MachanismLayer. C# code would be also…
Pingpong
  • 7,681
  • 21
  • 83
  • 209
5
votes
1 answer

Grasp creator vs. dependency Injection

Is GRASP Creator a complete contradiction to Dependency Injection? If it is not, please explain why.
5
votes
4 answers

UOM (units of measure) design patterns

Looking for general design patterns principles with respect to storing and converting known values (i.e. meters to feet). Been googling with no luck so I must be missing something. Assuming many fields with various UOM in a single table what is the…
user610254
  • 59
  • 1
  • 3
5
votes
1 answer

Dependency Inversion Principle: High Level and Low Level module example

I was going through the following link to understand what high-level and low-level modules mean in the context of Dependency Inversion Principle. As per the explanation given there, is the following code snippet a good/appropriate example? public…
Sang Suantak
  • 5,213
  • 1
  • 27
  • 46
5
votes
8 answers

What are the list of Patterns and Principles a programmer must/should know?

I have been coding for a few years and still feel that my knowledge is not broad enough to become a professional. I have studied some books related to design patterns, but I know there are many others. So could somebody list the patterns and…
pang
  • 3,964
  • 8
  • 36
  • 42
5
votes
4 answers

SOLID principles or none SOLID

I am continuing the development of an ASP.NET application (web form based) where the previous developer did not follow principles of good Object Oriented design i.e. SOLID (http://www.remondo.net/solid-principles-csharp-interface-segregation/). I…
w0051977
  • 15,099
  • 32
  • 152
  • 329
4
votes
4 answers

How to not violating the OCP when you want to choose between different classes which are inherited from an Interface?

I have an Interface lets say ISendOut which I've inherited two different classes from it for example TransferViaSerialPort and TransferViaWirelessModule (I mean implement this Interface in these two classes). How can I design my software to both…
Mehrdad Kamelzadeh
  • 1,764
  • 2
  • 21
  • 39
4
votes
1 answer

Best Practice: Protected or Private Methods by Default and Test-Driven Development

Similar Questions When do you write a private method, versus protected? Best to use Private methods or Protected methods? Reasons to use private instead of protected for fields and methods My Question Many people agree that protected methods…
Keith Pinson
  • 7,835
  • 7
  • 61
  • 104
4
votes
1 answer

Why oop languages don't support separate access modifiers for reading and writing?

I often find myself writing getters and setters just because getting and setting would require different access level. And those getters and setters are trivial (getter only returns, setter only sets the value, no other code inside). Typical case…
Calmarius
  • 18,570
  • 18
  • 110
  • 157
4
votes
1 answer

How does this example violate LSP, which then causes violation of OCP?

From Agile Principles, Patterns, and Practices in C# by Robert Martin, Listing 10-1. A violation of LSP causing a violation of OCP struct Point {double x, y;} public enum ShapeType {square, circle}; public class …