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
15
votes
5 answers

Rules Engines User Interface Design

At work, we have optimization engines, and one of the inputs used by these engines are business rules, which we create and edit with a proprietary rule editor. These rules are of our own proprietary format, because the existing rule engines were not…
bguiz
  • 27,371
  • 47
  • 154
  • 243
14
votes
10 answers

Should software be designed with performance in mind?

Is it advisable to zero-in on design of a component or architecture of a software with performance in mind? What I mean is, how ready should the design/architecture be to used in a performance-intensive environment? While designing components,…
user170272
  • 203
  • 1
  • 6
14
votes
6 answers

A very common C# pattern that breaks a very fundamental OOP principle

Here is a very simple question, which I'm still very uneasy about: Why is it widely accepted now for a class to return a reference to its private member through an accessor method? Doesn't this totally break the encapsulation principle? If this is…
samus
  • 6,102
  • 6
  • 31
  • 69
14
votes
1 answer

Pattern for modifying knockout observable on parent from child view model

I have a parent-child view model object structure set up and need to update an observable on the parent from the child. I've basically come up with two patterns for doing so: 1] Pass a reference of the parent property to the child and update the…
KodeKreachor
  • 8,852
  • 10
  • 47
  • 64
13
votes
5 answers

Does the Liskov Substitution Principle apply to subtype which inherited from abstract class?

loosely speaking, Liskov Substitution Principle states that a derived class can be substitute in place of the base class without affecting the user. In the case when the base class is an abstract class, which means no user is using an instance of…
A.A.
  • 147
  • 1
  • 7
12
votes
3 answers

Properly implement comparison of two objects with different type but semantically equivalent

I've found a similar question How to compare two distinctly different objects with similar properties that may implicitly and/or in part reply to my question. Suppose I want compare (without a lot of nested conditions) this object: class ObjectA { …
jay
  • 1,510
  • 2
  • 11
  • 19
11
votes
2 answers

Difference between "depend on abstractions not concrete classes" and "program to an interface"

The difference between these two principles is not clear for me. They just look like the same thing. What is the difference if any?
ps-aux
  • 11,627
  • 25
  • 81
  • 128
11
votes
6 answers

Add more behaviour without creating new classes

This was the question asked in an interview. There is a Label with a property Text In one page a label is simple Label, in other pages it may handle any one or combination of the below actions Clickable Resizable Draggable How do you design this…
Billa
  • 5,226
  • 23
  • 61
  • 105
10
votes
27 answers

What features any good application should care about 'By-Design'

I know that the default answer is "it depends", but I want to know the feature list you are working from in developing a good application. I'm particularly interested in features that need to be cared about at design time because adding them late…
Ahmed Mozaly
  • 1,454
  • 2
  • 15
  • 22
10
votes
3 answers

Single Responsibility Principle : class level or method level

I have problem in understanding Single Responsibility Principle . Should SRP be applied at class level or at method level. Lets say i have Student Class ,i need to create student , update student and delete student. If I create a service class…
sumedha
  • 473
  • 1
  • 9
  • 24
9
votes
5 answers

Confusion between Inversion of Control and Hollywood Principle

I am reading Head First Design pattern and just stuck on the Hollywood Principle. Earlier I read about Inversion of Control and what I understood was, it's a design principle (some also call it pattern) through which conventional flow of program…
OldSchool
  • 2,123
  • 4
  • 23
  • 45
9
votes
1 answer

RAII and unit testing principles

The RAII (Resource Acquisition Is Initialization) is one of the suggested ways of constructing objects. How does it relate to the unit testing principles that are saying: no complex job done in the constructor? And especially no explicit creation of…
thatsme
  • 325
  • 1
  • 2
  • 10
8
votes
3 answers

Is adding attributes dynamically frowned upon in Python?

In Python, you can assign an arbitrary attribute from outside the defining class: class Profile(models.Model): user = models.OneToOneField(User) name = models.CharField(max_length=140) p = Profile() p.age = 42 The underlying mechanism…
Dan Abramov
  • 264,556
  • 84
  • 409
  • 511
8
votes
4 answers

REST API question on how to handle collections as effective as possible while still conforming to the REST principles

Im pretty new to REST but as far as i have gathered i understand that the following URL's conform to the REST principles. Where the resources are laid out as follows: /user//library/book//tags ^ ^ ^ ^ …
netbrain
  • 9,194
  • 6
  • 42
  • 68
8
votes
1 answer

Why you should never use synchronized on Optional java object

I m learning about java optional wrapper, to do so I m reading the following tutorial however I have a simple question that is not answered in the article: in item 25: Avoid Using Identity-Sensitive Operations on Optionals they are mentioning to…
1
2
3
20 21