Object-oriented design is the process of planning a system of interacting objects for the purpose of solving a software problem.
0
votes
1answer
17 views
Object Oriented Analysis and Design and DDD together
I fear this question seems to broad, so I'll try to explain what I mean with some detail. I couldn't, however, find a way to divide it into other questions. If that's really the case, I gladly accept ...
55
votes
11answers
7k views
Why is base-for-all-objects discouraged in C++
Stroustrup says "Don’t immediately invent a unique base for all of your classes (an Object class). Typically, you can do better without it for many/most classes." (The C++ Programming Language Fourth ...
0
votes
0answers
47 views
Design by Contract and Defensive Programming Confusion [duplicate]
I have been interested in better coding practices/methods which makes the reliability and maintenance less painful effort. I read the chapter about Design by Contract on "Object Oriented Software ...
2
votes
3answers
80 views
Enterprise application object oriented modeling for user and role
Generally in the Enterprise Applications like ERP or ERM, CRM, BP etc. we see two things a lot, one of them is Role and the other one is User. What happens is that in the real world we have some ...
2
votes
1answer
103 views
Object Oriented Analysis and Design workflow for developer working alone
Studying about OOAD I've found a simple workflow based on five steps. I don't work with a team, so what I'm interested in is a workflow that can be used by a developer working alone. The workflow I ...
0
votes
1answer
38 views
Database structure for links between objects of same class
I have seen elsewhere that it is a nice design to implement links between objects in a database as a separate object. This makes a clean way to have multiple objects of one class to be linked to an ...
1
vote
3answers
144 views
Is self referencing tables a good idea for geographical data?
I am creating a design for different Geographical types where each type is just a little "place holder" in over all heirarchy.
One example is
Zip code Belongs to Territory Belongs to District
...
0
votes
3answers
283 views
Overriding equals() method in Java
Short question: Why does Java allow overriding equals(), why is it not final?
I am reading Effective Java 2nd edition by Joshua Bloch.
I am a bit baffled by the conclusion that
There is no way to ...
0
votes
0answers
112 views
General design choices. How do you decide?
I have a project in C that I'm looking to convert to C++. The project does white box hardware testing of a device (actually many similar devices). In this case the device has two processors. Each ...
1
vote
2answers
69 views
Literal strings vs. object properties in JavaScript
JavaScript libraries in the same space (UI widgets) use two different approaches for instantiating components:
Literal strings to specify types, and inlining as much as possible, for example:
var ...
1
vote
6answers
213 views
What is a better design a light weight user or a heavy weight heavy user model?
This is a design question and I am confused about how to design my user object. As in most systems, user is the central part of my application and a lot of information scattered around my database ...
1
vote
3answers
199 views
Avoiding a large amount of overloads
I'm currently writing a mailing interface for our enterprise application. Dependent on the send mode (regular email, bulk email, templates, mailmerge, ...) our Send() method requires a bunch of ...
16
votes
6answers
967 views
Does functional programming increase the 'representational gap' between problems and solutions? [closed]
Since machine language (e.g., 0110101000110101) computer languages have generally evolved to higher forms of abstraction, generally making it easier to understand the code when it's applied to a ...
0
votes
1answer
42 views
refactor by inheritance or composition for large class that depend on common state [duplicate]
I have a huge class (>1000 lines), in which all methods depend on a small set of attributes in that class. I can think of 2 quick ways of refactoring.
I keep it as a huge object, but split related ...
0
votes
2answers
62 views
Architecture for process that can be invoked to return errors as well as silently [closed]
I'm looking for some high level design/architectural input for the following.
I have "some business process" I am writing in code (the importing of data from various CSVs into a database. There is ...
0
votes
1answer
113 views
Should I use one class that calls Several static methods or several classes each calling one static method
I need to use instances which represent mathematical functions along with their parameters end enable their evaluation. I can take 2 approaches:
1: have a single class representing all the math ...
-1
votes
1answer
44 views
Know any good resources/information on architecting an iOS app? [closed]
I spent a few months working on an iOS app of mine (in Swift) before realizing it was really a bunch of MVCs (Massive View Controllers).
I want to start fresh and build something modular, scalable, ...
1
vote
4answers
167 views
Options for constructing an object that is not logically initialized until all fields are set
I am working on a Pokemon game at the moment, and am running into some design concerns. The easiest example is as follows:
Each Species of Pokemon has several traits that are required before it is ...
1
vote
4answers
184 views
What is the efficient way to eliminate duplication? Design patterns?
I have a helper class which has a method that perform some checks against a field in a model. I have two models, ModelA and ModelB, they have some similarities but not all. One of them is they both ...
4
votes
5answers
475 views
Should I create a single object for a common method call or use a throw away approach?
I'm creating a little rpg fight program just for fun and to practice my java (I'm pretty new hehe).
I have a class called Dice with a method called d20 that rolls a random number between 1 and 20. ...
1
vote
1answer
62 views
Advice for Evaluating Web Frameworks (or software libraries in general)
At my workplace we are currently looking to redesign our application stack on the web. We are satisfied and accepted that our server will be Node.js but we are finding it very difficult to find a ...
2
votes
4answers
242 views
Two classes that behave identically yet are semantically different
I am writing a program which is a similar to Ruby's Active Record Migrations, in which that every migration has both an "Up" and "Down" in terms of creating a change to the database, "Up" meaning ...
1
vote
2answers
89 views
How do you decide member objects?
So OOP is about breaking down functionality, making each class responsible for one thing etc. But let's take the example where an object is using another object. First thing that comes to mind ...
0
votes
3answers
113 views
where should put showSchedule method in school system
In my school management system I have this partial class diagram:
1- In one use case student want to see his schedule of classes in week. this is what i suppose to do:
get student object from ...
1
vote
1answer
86 views
Object creation: when should I expose a factory vs wrapping class?
I am having some problems trying to figure out when to use a factory or to wrapper class. This question is slightly geared towards C# I guess, so I'm not sure if this is the correct place to ask.
Say ...
1
vote
2answers
162 views
many to many relation in database schema and oop class diagram
I have Student and Group entities. Student can have many groups and Group can have many students too. so in database I should have middle class and change many-to-many relation to one-to-many and ...
1
vote
2answers
68 views
Query on hiding implementation details in java
With the below piece of thread related code, I see that author of Thread class is hiding the details about the working of start() method. What a user of Thread class need to know is, class Thread ...
4
votes
2answers
448 views
What are the valid uses of static classes?
I noticed that nearly every time I see programmers using static classes in object oriented languages such as C#, they are doing it wrong. The major problems are obviously the global state and the ...
3
votes
3answers
172 views
Is it misleading to label code as a particular design pattern if it only loosely fits the definition?
Background:
I have a rough, but working understanding of ~15 design patterns. It's been my experience using design patterns in my own projects that the resulting implementations usually end up as some ...
0
votes
2answers
100 views
Interface inherits from interface without specifying new member
Is it some kind of bad design to have something like this:
public interface IFooStream
{
long Length { get; }
long Position {get; set;}
//...
}
public interface ...
2
votes
1answer
220 views
C# OOP Class Usage [duplicate]
I am just being picky and really wanted some of my code to look, feel, and be used a specific way but am not sure if its possible.
I have a class I created that can be used like this
...
2
votes
3answers
183 views
Getters and Setters unclear example
I know autmatic getters and setters are considers bad as they tend to break object's encapsulation. They also move the work that should have been done within the object outside.
Allen Holub is a big ...
3
votes
3answers
315 views
Best OOP Practice in C#: Passing the object as parameter VS creating a new instance of the object
First things first, I would like to know if passing an object as parameter is much better than creating another object AGAIN in a class that will use it again and second what are the pros and cons of ...
4
votes
1answer
99 views
Extend, wrap, or both to add generics to a class that should have had them?
So I'm using a C# framework that has a great example of where generics would be useful, except they weren't used. For simplicity's sake, we will say it was a list (I know C# has its own list), but ...
3
votes
1answer
126 views
Sharing constructor code between classes that do not inherit from each other
There is a PHP library of classes (generated from a WSDL) that cannot be changed. These look like the below for simplicity.
class System extends \SoapClient
{
public function __construct(array ...
0
votes
1answer
93 views
Should Form Object be considered a DTO?
I got this from one of online video tutorials. Author binds form data not to Value Object directly, but first to validable DTO, and THEN to Value Object, using service.
Example:
package ...
5
votes
5answers
211 views
Specific empty children classes
Is having empty children classes, just to specify, a bad practice?
Lets suppose I've a generic Product class. There are electrical, electronic and mechanical products. I need to represent all them ...
1
vote
1answer
54 views
Do the implementations of the Node interface in Web API violate Liskov Substitution Principle?
MDN article on Node interface states that
interfaces [that inherit from Node interface] may return null in particular cases where the methods and properties are not relevant. They may throw an ...
0
votes
1answer
79 views
What are the key areas to evaluate software (codebase) on? [closed]
I have been asked to do a code review of about 50 applications over a period of 6 weeks. (Management has changed and the new CTO asked for an full internal software audit)
I am wondering, what are ...
3
votes
3answers
502 views
Should an object load itself?
although I'm programming in C++ for some time now, I'm always faced with design decisions (probably due to the language's flexibility). One such problem is deciding if a method should be part of the ...
1
vote
0answers
103 views
Too many parameters to data processing class constructor
I have a conceptually simple application: data comes in as small encrypted packets, they decrypted and validated, some are stored in the database, some rules are applied, and a reply might be ...
1
vote
0answers
64 views
Need to refactor file downloader and post processing utility [duplicate]
Not sure whether this is the right forum to ask this but here goes.
Using this solution - http://stackoverflow.com/questions/26571351/replacing-if-else-logic-with-state-strategy-pattern I was able to ...
1
vote
4answers
734 views
try/catch open/closed principle violation
I have three or more different custom exceptions that a class can throw and I need to use try/catch in order to discover which exception was thrown.
In my point of view this piece of code violates ...
0
votes
0answers
56 views
OO Design Question - Library/Objects for API which includes id references
Public api:
getClients / getClientById - returns a json object like:
{ clientid: 1, name: "Client1" }
getProjects / getProjectById - returns a json object like
{ projectid: 5, name: ...
0
votes
4answers
750 views
Why 'List<E>' is an 'interface' but not 'abstract class'?
While defining the hierarchy, one can think to embed the abstract method(behaviour) in abstract class only because the derive concrete class posses that as core behaviour with it's specific ...
1
vote
1answer
133 views
Program Architecture: How to manage objects that are interdependent
Consider the following case, image I making a simple chat program; I want it to be extensible such that it would be fair easy to add add different scripting and user interfaces.
I want the core ...
0
votes
3answers
118 views
OOP: relying on protected properties in a class-subclass contract
I'm coding in Python, but the question seems independent of programming language.
I have a class that represents some system check:
class Check:
@abstractmethod
def run()
""" You have to ...
7
votes
2answers
220 views
Autoreleasing objects in Reference Counting Systems
I'm experimenting a bit in C and I'm trying to implement my own Reference Counting System. I've mainly worked with Objective-C in the past but AFAIK autoreleasing objects is something that is unique ...
2
votes
1answer
117 views
DDD: Global unique identities vs surrogate
Let's start with an example: we have an entity: Book. It has unique identity: Isbn - a value object that wraps a String. This is an UUID.
The Book entity also needs a surrogate id from the repo (sql ...
1
vote
1answer
48 views
DDD: storing additional data with the model
Our domain is operated within certain context. This context is described by some additional values, like a fooId - id that does not have a meaning in domain business, but it's more a flavor for the ...