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

What Design Principle is Violated, and Which Design Pattern can Fix It

In one recent exam, I was asked 2 questions regarding the code snippet below... The questions are as follows Identify the design principle violated by the code snippet Describe the design pattern that solves the design principle violated. Provide…
0
votes
1 answer

Violation of OO concepts?

Create a base class with a method that uses a switch case that reference the type of the children class. Is the below piece of code violating the OO principles, if so which one? public abstract class BaseClass { public BaseClass Method() …
user3814849
0
votes
0 answers

Is calling an interface nested inside an abstract generic class bad programming practice

Using the code below as an example public abstract class Foo{ // ...some methods public interface IFoo{ S doSomething(U input); } } class MyClass implements Foo.IFoo{} Is calling the interface…
Tendai
  • 71
  • 6
0
votes
2 answers

Micro Layers: Do not add functionality on top but simplify overall Dependencies

I was going through design principles but could not understand this principle(avoid Micro layers), what would the significance be. I tried to google it but could not find any examples or explanation for this design principle. Could it possible for…
Kryptonian
  • 860
  • 3
  • 10
  • 26
0
votes
0 answers

Is there an alternative way to enforce model validation?

In order to 1. clarify possibilities on an interface and hence 2. reduce test cases plus 3. fail as fast as possible I intend to enforce validation of a model upon creation. The model shall not be created if the constellation is not valid. As a…
0
votes
1 answer

How to design a new ble beacon protocol?

I am working in a project related to IoT where a gateway receive information form different sensors by mean of beacons. One part of the project consist on design a new protocol which could be more generic, instead of needed to choose between…
raivel33
  • 95
  • 1
  • 1
  • 5
0
votes
1 answer

Implementing Factory Patterns - Removing the switch

I've recently just started trying to improve my base skills as a developer and reading more about Design Patterns, and a variation of an Abstract Factory is something I've been using for a little while. I have a question on the specifics of…
plantpowerjames
  • 375
  • 2
  • 10
  • 22
0
votes
1 answer

How should I store ~400 key-value pairs for my Android app?

What would be the best way to store ~400 key-value pairs for an Android app? These values would be set on initial setup of the app and changed extremely infrequently after that. However they are used once per app use as a template to create a set of…
0
votes
1 answer

How should a DAO layer be implemented? One table DAO or multiple table DAO?

I am implementing a module as per layered architecture. It will have a presentation layer, service layer, a business layer and a DAO layer. As per layered architecture guidelines, the communication flow should be top to bottom. Similarly, the…
0
votes
1 answer

Reasons for a "Simple and Stupid" software design

I am currently studying for a software engineering test. One of the study points is to know why we should use a "Simple and Stupid" design principle. I know this is helpful when reading through someone else's code, but are there any other important…
KYDronePilot
  • 527
  • 3
  • 12
0
votes
1 answer

Should one place a list of models inside another model?

Should one place a container structure in a model? For example, AModel { List listB; } In terms of OO this makes sense. But when working with models and databases will I run into problems as AModel and BModel have their own tables?…
0
votes
2 answers

C# OOP Cast interface parameter to concrete type

i'm trying to build a sort of framework for some base process in an app. There is some common behavior where i have to execute some operations but these operations are different depending on some scenarios. I have done something i'm not sure if it's…
FredE
  • 71
  • 7
0
votes
2 answers

Separation of concerns and JQuery AJAX callbacks

I am working on a web application for debtor management and I am refactoring the code and try to adhere to the principle of separation of concerns. But the async nature of AJAX is giving me headaches. From a jQuery dialog the user can set a flag for…
Rattensau
  • 13
  • 2
0
votes
1 answer

What's the best way to have different parent field initialization?

I have a class as below public abstract class MyObjectManager { private final Map objects; private final MySystem system; MyObjectManager(MySystem inputSystem) { system = inputSystem; // also initialize the…
eriee
  • 416
  • 2
  • 15
0
votes
1 answer

How to keep a big SOLID project manageable?

Having a big code mass demands some kind of principles to make it manageable. SOLID is one of the more used principle set. Even if it solves problems it appears to create another. With a vary large codebase, following the SOLID model will…
Banshee
  • 15,376
  • 38
  • 128
  • 219