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
1
vote
1 answer

Sensitive Data in Command Line Interfaces

I know it's frowned upon to use passwords in command line interfaces like in this example: ./commandforsomething -u username -p plaintextpassword My understanding that the reason for that (in unix systems at least) is because it'll be able to be…
mredig
  • 1,736
  • 1
  • 16
  • 29
1
vote
1 answer

Characteristics of bad object oriented design

I am reading about object oriented design principles. I came across the characteristics of a bad design. It is hard to change because every change affects too many other parts of the system. (Rigidity) When you make a change, unexpected parts of…
nits.kk
  • 5,204
  • 4
  • 33
  • 55
1
vote
2 answers

Apply DRY principle with JavaScript

I am currently stuck trying to apply the DRY principle in this scenario. Here is the code. As you can see, I am trying to run scripts containing different variables on different days. I mean, I could simply shoot out a bunch of else if statements…
Argentum
  • 57
  • 7
1
vote
1 answer

How can I split my Java Selenium tests into separate classes?

I'm currently working at my job to perform GUI testing of our web page using Selenium 2 via Java in Eclipse. I've been trying to program my tests in such a way that I maximize the amount of code I can reuse and as a consequence I now have a lot of…
Seth A.
  • 25
  • 4
1
vote
2 answers

How to reference AggregateRoot internal entity data in DDD

I'm interested in the Idea of DDD but I have some questions about the concept of encapsulating and protecting the AggregateRoot internal Entities and how to reference them. I created a simple example (don't hit me if the domain design is bad, this…
1
vote
1 answer

Android design principles and the use of activities/fragments

I'm new with android apps development (but have some Java experience) and I am struggling a little bit with how I should design my app. For example: When I execute the App I have a start page with the logo and two buttons: Register and LogIn. This…
1
vote
4 answers

What is an elegant way to track the size of a set of objects without a single authoritative collection to reference?

Update: Please read this question in the context of design principles, elegance, expression of intent, and especially the "signals" sent to other programmers by design choices. I have two "views" of a set of objects. One is a dictionary/map indexing…
Chris Ammerman
  • 14,978
  • 8
  • 41
  • 41
1
vote
1 answer

Maker-Checker-Approver in Java Application

This is basically a design question.I would like to know what is the best way to implement this. I need to implement a maker-checker-approver functionality.One common way is like below: If there is Employee entity then employee_mk and employee_app …
SCoder
  • 919
  • 2
  • 11
  • 26
1
vote
1 answer

Interface Segregation in Java CRUD

I have classes which are dependent on an interface which defines methods CREATE , READER , UPDATE and DELETE However some of my implementation do not have option for CREATE I believe it is not best practice to force those classes to implement…
yantrakaar
  • 374
  • 3
  • 15
1
vote
0 answers

Object creation & equivalent attribute signatures. Does this satisfy the requirements?

I'm trying to upgrade my general class design skills in C#, and want you guys to reveal code-smells I might have. (hope general discussions are allowed at Stackoverflow.com) Regarding to This Tutorial, I wrapped this up to C# and tried to chain…
MrMAG
  • 1,194
  • 1
  • 11
  • 34
1
vote
0 answers

Anyway of minimizing references to selfies when refactoring to class based design?

I'm in midst of refactoring a large set of python files and merging various methods into classes for modularity. However, the use of self everywhere is quite daunting. It's impossible to change every variable reference using regexes since it's…
PhD
  • 11,202
  • 14
  • 64
  • 112
1
vote
4 answers

Information hiding is abstraction or encapsulation?

The title says it all, I am bit confused as I was asked a question that Information handling in term of OOP is abstraction or encapsulation? I opted for abstraction but still I am confused because in encapsulation we also hide the fields and in…
user1765876
1
vote
2 answers

Is it ok to put logic inside exceptions?

I use exceptions extensively, and I often face the dilemma of where to put logic for a very specific exception. To illustrate let's say that I have implemented my own XML parser which takes a file path, opens the file and parses it. Now in case of…
Maciej Sz
  • 11,151
  • 7
  • 40
  • 56
1
vote
1 answer

When to violate the single responsibility principle?

How do you decide when and how to violate the single responsability principle? For example, let's say I have a network camera with the following interface (interface kept stupid and "wrong" for simplicity): class Camera { string user(); void…
1
vote
1 answer

XSLT XPath style guide / best practice / coding standard?

Does there exist an XSLT / XPath style guide / coding standard / best practice reference? In particular I'm maintaining a bunch of XSLT scripts which are demonstrably fragile and unmaintainable. eg. Adding a single level of nesting to the XML…