Object-oriented design is the process of planning a system of interacting objects for the purpose of solving a software problem.

learn more… | top users | synonyms

-1
votes
0answers
11 views

help me about the design of a campaign system

I need to implement a Campaign system in my E-commerce web app, required I Could define the following type of sale campaigns: A set of products to receive discounts (10%) A set of products to ...
0
votes
0answers
54 views

Should I ever reset object state?

I have a series of TextBlocks which are drawn on frames to make a video of a book. I do it when user click on Make Video. User may change the content of some blocks and click again on Make Video. I ...
3
votes
3answers
69 views

Approach to designing a workflow web app that contains some automation

I have been tasked with creating a web application which will provide end-users with a self help workflow, asking them questions and skipping to another part of the workflow depending upon the ...
6
votes
3answers
207 views

Implementing common logic in base class

Background In the documentation of a project I'm working on I came across the following sentence which immediately triggered an alarm for me: when having several concrete classes that inherits ...
2
votes
2answers
95 views

For a concrete SQL Repository, should I encapsulate the SQL logic inside or outside the repository methods?

If I have a concrete repository based on SQL data access, should I pass in SQL to the repository methods or encapsulate them within the methods. I feel if I pass them in, then I am coupling my ...
0
votes
1answer
112 views

How much to encapsulate when objects being dealt with are pretty similar

As I have been answering questions related to object-oriented design and how to go about reducing the amount of classes to make sure that there is not a lot of "class clutter" and code repetition I ...
1
vote
2answers
82 views

Class design for JSON serialization

I've been stuck for some time on a circular reference issue with JSON serialization. I have a card game that I'm pickling to a redis store. As I retrieve the Game state from redis I'm trying to ...
4
votes
1answer
105 views

What is the preferred way to approach this problem in object-oriented design? - virtual disks abstraction

I am writing a program that manipulates encrypted virtual disks and encrypted flash drives (eg. importing disks into my application, mounting/unmounting, changing passwords etc.). I am still new to ...
3
votes
3answers
503 views

How to model state of leaving/entering home

I have two sensors: One detecting if the door is open or closed, another if movement has been detected in the corridor. I want to detect if the person has left or entered home. Usually the person has ...
0
votes
5answers
183 views

classes/inheritance, how do I handle special cases that require more change

I often find myself in this situation where I have a base class that does a lot of graphics. There are, for example, three strings that are positioned top, middle, bottom of an element. Like a scale ...
1
vote
1answer
60 views

Calculating the determinant of a matrix

I am working on a library (in my spare time) that I hope to open source soon. One of the elements in the library is a method for calculating the determinant of a given input matrix. For this, I have ...
4
votes
2answers
262 views

What is the correct approach for creating an application around a library?

I have a library that defines messages. In my particular instance, it's autogenerated code from an XSD using JAXB (Java). The messages can be very complex, with some members as objects and those ...
-1
votes
1answer
27 views

Extracting client specific code. refactoring possibilities required

I am facing a Design problem. I have a set of classes which writes data in XML,JSON or HTML formates for different clients. I have a class which receives Data and a XML, JSON or HTML writer as it ...
0
votes
3answers
97 views

Is the Model part of MVC an inner platform

I'm not particularly up on MVC as an architecture but isn't the Model just a duplication (except slower and buggier) of the database? Given modern databases support stored queries, user definable ...
0
votes
1answer
35 views

Restructure Service - Http - Notification communication

I am trying to restructure a project to make components reusable and clearer. Consider the following scenario: A WakefulBroadcastReceiver (in my case called SimpleWakefulReceiver) will start my ...
1
vote
2answers
71 views

Is there a better pattern for a form object populating itself in 3 different ways?

So I'm writing a form object that deals with a specific thing - price - which is going to be included in several different underlying resources. (The Price is a separate model that may or may not need ...
0
votes
1answer
46 views

designing domain model that can handle large number of data filters?

I'm currently working on a project that I came into several years after it was built. The code is mostly procedural with a few objects that act more like buckets of functions than anything else. I ...
4
votes
1answer
66 views

When should I subclass an exception in Python?

In my code there are about seven places where I raise an exception. All of these exceptions are treated the same: print an error to log file, return software state to default and exit. During code ...
0
votes
2answers
108 views

Object oriented Classes and single responsibility [duplicate]

I'm reading a book that explain that it is a good thing that classes have a single responsibility, that is, that they do a single thing. I can understand how to implement this in some cases I ...
2
votes
4answers
75 views

Design: How to handle user permissions across a system

My team is currently working on a massive refactor of a medium-sized application in PHP. We are doing our best to refactor our code on a module (Orders, Users, Products) basis. The issue that I am ...
1
vote
2answers
77 views

How to organize code which converts from one type to another

If I have a DateRange class, and I want to translate a DateRange into SQL (e.g. some_col >= '2015-3-5' AND some_col <= '2015-3-5'), where should I put the method that does the translating? ...
1
vote
2answers
93 views

MVC like design with interfaces: How to handle basic objects?

I have an (android) application and decided that the presentation layer will get data only through strict interfaces from the controller. I am at the point where some basic objects need to be passed ...
0
votes
1answer
51 views

Methods accounting for all input to method

This is more of a conceptual question. Let's say that you had the following enum public enum FooEnum { ALPHA, BETA, GAMMA, DELTA; } And let's say you have the following method: ...
0
votes
4answers
256 views

2 methods that are 75% the same? [closed]

I have code that violates the DRY principle and I would like to consolidate 2 methods as much as I can, but the problem I am facing is that they have some differences, I would say they are about 75% ...
0
votes
1answer
37 views

domain driven design value object behavior

I recently finished Steve Smith and Julie Lerman's excellent Pluralsight course on Domain Driven Design, and I'm applying the training to a project. I have what I think is a good candidate for a value ...
0
votes
1answer
61 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 ...
57
votes
11answers
8k 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
93 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
159 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
42 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
157 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
326 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 ...
1
vote
0answers
119 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
76 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
219 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
207 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
1k 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
46 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
66 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
118 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
49 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
172 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
190 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
498 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. ...
2
votes
1answer
79 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
255 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
92 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
117 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
3answers
196 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 ...