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

2
votes
2answers
116 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: ...
1
vote
2answers
87 views

User and role modeling

I'm working with a system in ASP.NET MVC, with Entity Framework for ORM. The application has a requirements to allow users to have different types of roles, and authorization rules will be different ...
1
vote
2answers
293 views

Updating an Entity through a Service

I'm separating my software into three main layers (maybe tiers would be a better term): Presentation ('Views') Business logic ('Services' and 'Repositories') Data access ('Entities' (e.g. ...
2
votes
3answers
159 views

How do I recreate this Access Control/Group/ whatever methodology in OO/MVC

I am looking at trying to rewrite an application that is mostly procedural to an MVC/OO approach in order to teach myself a deeper understanding of both. BUT, I am having some conceptual issues with ...
0
votes
1answer
34 views

Use cases, User Stories, CRC cards and Conceptual Object Model

i'm currently in the middle of watching the Lynda.com course on the foundations of Object Oriented Design and one question keeps popping into my mind. When should I use Use cases and when should I ...
0
votes
1answer
64 views

Ways to avoid using switches to map strings to classes

I have a C# solution that reads records from a db and processes them into another db. The records to be processed are essentially one long string that represents the data and then another string ...
0
votes
1answer
164 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
89 views

Joshua Bloch Enum Singleton and Third Party APIs

In the book Effective Java he give the best Singleton pattern implementation in his, that is implement by a Enum. I have doubt to how to implement this pattern with a third party API. I'm using an ...
10
votes
8answers
3k views

How do I design a subclass whose method contradicts its superclass? [duplicate]

How do I design a subclass whose method contradicts its superclass? Let's say we have this example: # Example 1 class Scissor def right_handed? true end end class LeftHandedScissor < ...
5
votes
1answer
2k views

How should I structure modules in an Angular.js application?

I am fairly new to Angular.js, and one that confuses me is how to best use modules in an application. It seems to me that modules can contain any of the other common constructs in AngularJS ...
-4
votes
0answers
32 views

Best design for a SQL API - no antlr please [closed]

As a programming exercise, I'd like to explore creating a simplified sql like api to query csv files. Parsing the files is no problem. My concern is with design. What's the best way to design the SQL ...
78
votes
8answers
7k views

Is this a violation of the Liskov Substitution Principle?

Say we have a list of Task entities, and a ProjectTask sub type. Tasks can be closed at any time, except ProjectTasks which cannot be closed once they have a status of Started. The UI should ensure ...
2
votes
1answer
272 views

Should we encapsulate everything in a try{} block in a Try object?

Why can't I make a class for a Try including what I try and then run that in the try {} block? Why is it impractical? class DBConnectTry extends Try { TryResponse response[] attempt(TryObject ...
0
votes
3answers
42 views

Deserializing an object at beginning of program which is used (much) later

I am writing a program, where in the beginning of the execution, I am instantiating a number of classifier objects using parameters stored in some files. I later use those classifiers in multiple ...
3
votes
2answers
150 views

How to avoid …Helper or …Manager classes

I have quite a few Helper classes in my project. I have read that this is a bad thing, but I suspect that "Helper" is the wrong suffix for them. I'll give an example. First, I have a User class. I ...
1
vote
2answers
78 views

Inheriting and storing objects that contain different types of other objects

To start off, this is more of a best-practice question than anything. Introduction to the Environment I have myself an abstract class. Let's call this class Item. I also have another abstract class, ...
24
votes
6answers
3k views

Can you implement “object-oriented” programming without the class keyword?

Say we want to provide an abstraction of an "account" in a bank. Here's one approach, using a function object in Python: def account(): """Return a dispatch dictionary representing a bank ...
-3
votes
1answer
75 views

Java - Best way to set properties of an object [closed]

I don't know if there is any difference in performance, or its just a matter of choice, but I am a perfectionist like that, and I'd like to know. Lets say you have the object HolySheet. You can set ...
1
vote
1answer
34 views

Filtering additions to a list

Hopefully Iʼm posting this in the right SX, and Iʼve tagged it correctly. I have a legacy system that Iʼm making additions to which contains a custom list object. This list object can contain two ...
3
votes
3answers
171 views

Communication between state machine and GUI

I am writing a finite state machine in C++, designed as a library. Furthermore, I have a GUI implemented as a separate project which needs to update the user interface according to state changes ...
12
votes
4answers
973 views

Do I suffer from encapsulation overuse?

I have noticed something in my code in various projects that seems like code smell to me and something bad to do, but I can't deal with it. While trying to write "clean code" I tend to over-use ...
1
vote
3answers
76 views

Design question concerning extensibility

I am constructing a new class which handles deciding which class should process the requests from a web service. I'm looking for a solution for a problem that I am having regarding extensibility with ...
2
votes
3answers
298 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 ...
14
votes
6answers
2k views

Loose Coupling in Object Oriented Design

I am trying to learn GRASP and I found this explained (here on page 3) about Low Coupling and I was very surprised when I found this: Consider the method addTrack for an Album class, two possible ...
0
votes
0answers
24 views

Math formula class in Java [duplicate]

I need to calculate a score based on various attributes of a Thing t. How should I implement the class that calculates this? Option 1: public class Calculator { public static int calculate ...
4
votes
3answers
444 views

When is an object of real world a (computational) object in OOP world?

In an OOP design phase strategy, Any physical/conceptual object of a system can be modeled(considered) as computational object in your OOP designed program based on below two conditions: First ...
76
votes
14answers
8k views

Is my mentor's concern for code quality excessive? [closed]

To tell you a little about myself: I'm a newbie programmer working internships and learning a lot from experienced programmers. I can't believe I used to think I was good in college. The one I'm ...
0
votes
1answer
546 views

Interface questions for using Command Pattern and Dependency Injection together

I have many projects that have essentially the same high level requirement: test all hardware on a device. Each device can have a different communication protocol, requires different test equipment to ...
4
votes
1answer
97 views

Low coupling when using sealed classes?

Typically, when trying to decouple classes I use Inversion of Control. Lately I've been using a third-party library whose components are sealed. Are there any design patterns to handle this situation? ...
0
votes
1answer
46 views

Design review for refactoring a large function

Basic terminology: Report - single report to generate ReportGroup - group of Report(s) to generate Request - contains one or more ReportGroup I'm working on refactoring of the large function (~350 ...
5
votes
3answers
80 views

How to design a class to check if geometric figures collide?

I am making a basic game with geometric figures. I am trying to design now how to calculate if the figure collides with another figure in an Array List of figures (called entitiesList). I have: ...
21
votes
9answers
3k views

What can go wrong if the Liskov substitution principle is violated?

I was following this highly voted question on possible violation of Liskov Substitution principle. I know what the Liskov Substitution principle is, but what is still not clear in my mind is what ...
0
votes
2answers
132 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 ...
6
votes
4answers
1k views

Is it a good practice to wrap all primitives and Strings? [duplicate]

According to Jeff Bay's Essay on Object Callisthenics, One of the practices is set to be "Wrap all primitives and Strings" Can anyone elaborate on this ? In languages where we already have wrappers ...
1
vote
3answers
91 views

Dependency inversion without static methods?

It's clear that the dependency inversion principle and the use of interfaces makes software components less coupled and promotes maintainability. On the other hand, these principles make using static ...
2
votes
2answers
259 views

Is this the solution to static inheritance?

I've seen a lot of posts recently on why Singletons should be avoided. However, I can't see any of those problems with the following solution to a common problem: static inheritance. For example, I ...
60
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
85 views

How do I model this Shipping Routes scenario?

Trying to begin coding this solution. I have a scenario as follows below: A shipping operator has a network of routes to various ports, the routes are specified explicitly below Buenos ...
4
votes
3answers
174 views

Design patterns for implementing optionally supported features

Here's the original problem. There are two classes: Protocol and, say, ProtocolUser (which actully uses the Protocol class instance). Now, I need to support multiple protocols, whose feature sets only ...
0
votes
2answers
130 views

What is the difference between an abstract method and an interface [duplicate]

An interface requires implementation of the specified functions in a class that implements the interface. An abstract function from an abstract class requires implementation in a class that extends ...
6
votes
1answer
71 views

Does needing the ability to extend a class at runtime imply poor design?

Aadit M Shah states in Benefits of prototypal inheritance over classical: One of the most important advantages of prototypal inheritance is that you can add new properties to prototypes after they ...
1
vote
2answers
99 views

In javascript, should object properties be declared on top of the function?

I learned that it's good practice to declare variables before they are used. For example: function myFunction() { var i; var j; } Does the same thing go for object properties, and is there a ...
2
votes
0answers
32 views

Updating an entity via a service layer

What's the best way to update an entity using a service layer? Performing a single, atomic action I can understand like BlogService.Publish(blogID) but what about editing multiple values which map to ...
1
vote
1answer
126 views

Differences in design/thought process for OO in Java and JavaScript [duplicate]

Despite sharing a similar name and syntax, Java and JavaScript are quite different. However, they both have Object Oriented features. As a JavaScript novice, the main differences that I can see ...
0
votes
0answers
58 views

Class design for an app that reads data from Active Directory

I am hoping someone can help me regarding design and architecture for an application. The application is basically a service written in C#. The purpose of this service is mainly to read data from ...
3
votes
2answers
134 views

Does this data processing pipeline design need to be so complex?

I have a data processing pipeline with well defined stages and IO boundaries. I can choose a language to suit the needs of this design. It starts with an InputObject. At the end of each stage, ...
9
votes
2answers
401 views

When following SRP, how should I deal with validating and saving entities?

I've been reading Clean Code and various online articles about SOLID lately, and the more I read about it, the more I feel like I don't know anything. Let's say I'm building a web application using ...
2
votes
2answers
183 views

return a object without returning the reference

i'm having some trouble with returning objects and lists of objects. To problem is I want to return a object in my example an developer but I don't want to give the reference. What's the best ...
-1
votes
2answers
208 views

which one is recommended object-oriented design? [closed]

I made simple object-oriented prgram, and think about design. I wonder which one of belows is recommended object-oriented design. Most left side class is "Main" class. Black arrow means they are "Has ...
3
votes
3answers
2k views

Why shouldn't an object reference have access to a static member in C#

Context of my question: I am reading C#. Trying to understand Static keyword. I understand that when Static is applied to a member of a class, it can only be modified by the class and not the class ...