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
vote
0answers
38 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 ...
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 < ...
0
votes
3answers
41 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 ...
1
vote
2answers
73 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, ...
3
votes
2answers
131 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 ...
-3
votes
1answer
68 views

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

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
33 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 ...
1
vote
3answers
71 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 ...
3
votes
3answers
159 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 ...
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 ...
0
votes
1answer
22 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 ...
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
43 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
77 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: ...
1
vote
3answers
89 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 ...
0
votes
0answers
84 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 ...
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 ...
4
votes
3answers
436 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 ...
0
votes
2answers
129 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 ...
4
votes
3answers
171 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 ...
23
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 ...
6
votes
1answer
70 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
96 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
29 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
124 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
56 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
130 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, ...
2
votes
2answers
180 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 ...
0
votes
1answer
156 views

Memento pattern: saving memento [closed]

There is one problem about this pattern that troubles me. In a situation when we have to save a state into a file, is it class Memento that should be responsible for handling this process? (for ...
4
votes
4answers
110 views

Business Layer Procedural?

The most common way I've seen of saving an entity into a database is through a class in a business / service layer. For example, when adding a new entity called User: User user = new User(); ...
0
votes
0answers
24 views

Classes, Datatypes and replicating Methods [duplicate]

I've gone from writing code procedural-style to object-oriented recently and during my development as an object-orientated programmer I have made a few mistakes. What I have been doing is, inside my ...
2
votes
1answer
110 views

Should I use the State Design pattern for only two states? Also, what if one object's state is affected by another state?

If you only have two states for an object, is it worth it to still use the State Design pattern? The context is a multi-player, turn-based game environment where there are Game "Tables" that a player ...
9
votes
4answers
820 views

Class Duplication Pattern?

I'm currently working as a solo developer on my current project. I inherited the project from another developer, who has since left the company. It's a model-view-controller style web application in ...
-1
votes
2answers
60 views

Appropriate Design Patterns [closed]

I have a list of objects which represent log entries like below. List<LogEntry> Entries; //Log Entries Read By A Log Reader The Log Entry Class contains following properties. public class ...
5
votes
2answers
182 views

Top-down vs Bottom-up approach when designing a class library

I am designing a class library to represent western equal temperament music theory concepts for the purpose of composing notated music with code (I realize there are other libraries and programs for ...
-1
votes
2answers
185 views

Mermaid problem (OOP) [closed]

A Mermaid is half fish and half human. It has upper human body and lower fish body. When under water its upper part swims like a human while its lower part swims like a fish. Please explain how can it ...
2
votes
2answers
192 views

How/when to “build” a Singleton that stores configuration data

I am a junior developer (think "intern-level" experience) working at a small shop more or less alone on a project that consumes data from a database, processes it, and inserts the results into another ...
0
votes
1answer
111 views

Access fields of super class from derived classes [duplicate]

There is an abstract BaseGame class that will be inherited by specific game classes. This class has an attribute requestHandler that will be used in all subclasses and should be initialized in the ...
1
vote
2answers
165 views

Dependency injection vs dependency lookup in a layered architecture

Given a layered architecture, where the business logic is isolated in a package from all other layers, like persistent storage, user interface, interfaces for various (vendor) remote services, etc, I ...
1
vote
6answers
184 views

Why do I need to map arguments to instance variables?

Class BankAccount: def __init__(self, accID, name, balance): self.accID = accID self.name = name self.balance = balance In the code above, why is it that I'm required to ...
1
vote
2answers
218 views

Are any side effects not concrete side effects?

In Chapter 23 of "Object Oriented Software Construction" (1988), Betrand Meyer makes a distinction between side effects, concrete side effects, and abstract side effects. Meyer defines a side effect ...
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? ...
2
votes
1answer
91 views

Ambiguity of seemingly clear method names in APIs

(The question is language-agnostic, but to illustrate the point, I wrote the examples in C#.) Say I'm trying to model the behavior of "components" that communicate via "ports". I might model this ...
-1
votes
1answer
68 views

How to make variables inherent to an object or system

How can one make variables inherent to an object or system? For example, when creating a web browser, each option that is created for the user to have control over (i.e. how a window opens, if ...
0
votes
0answers
75 views

difference between generics and interfaces [duplicate]

Are there any advantages of using generic type constraints over an interface? For example: T whatever<T>() where T is IInterface; vs IInterface whatever(); My guess is it's just a ...
1
vote
1answer
194 views

Inheritance or Composition?

Let's say I have a main class A and another class B. In the B class the user can change some settings and variables of the program that belongs to A, I want to be able to apply these changes to the A ...
2
votes
1answer
56 views

For specialized code, use custom interfaces and types or available generic ones?

I will use Java as example, but the question pops up in my mind with any language / framework / stack / pattern / ... For instance in python, should I just use a dict(), or should I subclass it to ...
4
votes
1answer
141 views

Should I always throw the most specific or should I try to generalize exception types?

Say you normally have FooException. /** * @throw FooException If Foo is invalid for searching. */ public bool exists(Foo a) But at some point you need to have two more specific exceptions for ...
1
vote
3answers
224 views

Pass the whole object to a method or just parts?

I have an object that has about 50 properties, but one of my methods only uses about 3 of these properties. Is it still better to pass the whole object or parts. A scenario would be were I am using ...