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
2answers
50 views

How to better define SRP and “wholesome” objects? [duplicate]

Assume you have a class. It can really be any class that defines a domain concept like an employee, a product on an e-commerce site, or a car. One of those examples that are oldies but goodies. ...
0
votes
0answers
26 views

EF “Code First” and Object/Relational Impedance

I'm trying to learn more about the current orthodoxy with respect to ASP.NET MVC application design, and I stumbled upon something that confuses me, relating to the choice among database design ...
-3
votes
2answers
139 views

How 'Encapsulation' is different from 'Data abstraction'?

class DblyLinkList below, follows these 2 definitions mentioned in this answer. Term representation is used in in place of implementation in the code. Abstraction has to do with separating ...
3
votes
3answers
91 views

Is this a valid situation for returning rather than throwing an exception?

This is not something I would ever normally do, but I have a situation where some existing legacy code is being reused in a new application. The code is shared and needs to be used by both the legacy ...
-1
votes
0answers
33 views

How to organize a mid-size program with core functions and user-interface? [on hold]

many of my programs have a common style: I need to do e.g. some math calculations, like some statistics (so working with real numbers, array, matrices). Plus I need to create a graphical ...
2
votes
2answers
106 views

How to avoid god controller classes and keep single responsibility principle?

The task is to make a migrator from Old DB to New DB using OOP Single Responsibility Principle. My problem is how can I make this without making the controller a God Class or breaking the single ...
0
votes
1answer
52 views

Should I put the parameters in constructor or in method? (Python 3)

I have the following code: def __init__(self, vocable_file_path, xsd_file_path, word_list_file_path): self.vocable_file_path = vocable_file_path self.xsd_file_path = xsd_file_path ...
4
votes
3answers
244 views

How can I add properties to subclasses and access them without casting from a superclass?

I'm trying to model a multi-dimensional point class in C#. I have about eight different types of points, and there may be more in the future. Right now, I have a superclass (PointBase) that holds all ...
-2
votes
2answers
94 views

How to reference one object with two interfaces? [duplicate]

Suppose I have two interfaces I and J that is implemented by Test class. Now I need one object of class Test that is referenced by I and J both interfaces. I can do it by singleton design pattern. But ...
1
vote
1answer
124 views

Inefficient use of interfaces in OOP (C#)

In my code, I've got two interfaces, let's say IOpenable and IExaminable. IOpenable allows the user to Open or Close the object, and IExaminable allows the user to Examine the object. Now, we have ...
3
votes
3answers
241 views

“Correct” way to use inheritance

Within a small project, a class Storage is meant to store any type of Item. Now, an Item has a String name, and an interaction. For example, a clock item might implement the interaction increment(int ...
0
votes
1answer
46 views

Object Oriented programming for scientific hpc? [closed]

Ever since I read about object oriented I became increasingly interested in it; the concept of focusing on modularity has instantly appealed to me and I seem to frequently find new reasons to ...
0
votes
4answers
198 views

How to write procedural code in an object oriented language?

I recently started working in domain of mesh generation . My programs usually contains large chunks of procedural code consisting of several phases. Eg. class MeshAlgo1 { /* A very long function ...
0
votes
1answer
46 views

How to better isolate JOGL or LWJGL3 dependency from game clients?

I'm currently working on a project to develop a relatively small framework with the goal of supporting game development efforts for students in a course. The scope of this project is an OpenGL-based ...
1
vote
1answer
78 views

HashMap to replace Singletons?

Consider the following: I have controllers and views in a client-application. As this runs purely on the client side, each controller must only exist once. At first I thought about implementing ...
3
votes
2answers
83 views

COM - with great power comes great responsibility, but at what cost? (looking for advice on coding practices when working with COM)

What is best (or commonly accepted) practice for where to declare COM object variables (scope) and how to handle cleaning them up when using structured error handling? I just spend a whole load of ...
4
votes
2answers
42 views

Is it acceptable to define a “module” and “class” within a single .VB element?

Experiment: I have found it is possible to define both a "Module" (Namespace?) and a "Class" (Namespace?) within a single .Vb element (Module??). You can try this at home: Create a new Console ...
1
vote
1answer
43 views

How do you keep up with 'requiring new methods in an interface' (Following LSP and adding new methods to interface seems to violate ISP)

I have a game that deals with opening and closing doors and the Door Engine deals with IDoor interface which has Open() and Close() contracts So far so good. the game is tested and works fine. Now a ...
1
vote
3answers
138 views

What categories of software modeling problems is object orientation highly unsuitable for? [closed]

I'm trying to get a better grasp of the applicability of object-oriented programming and design. I'm curious about some examples of situations where object orientation is not simply inefficient or ...
0
votes
1answer
57 views

Issues deciding on approach to create object

I'm trying to decide what's the best approach to instantiate a particular class. Basically there are two use cases for it: instantiate it in order to save a new entry to the database and fetch an ...
2
votes
1answer
57 views

How to break mental model of objects

I've been working with OOP for a while now, but in each large project that I find myself starting, I seem to run into the same problem; where does the responsibility reside. Like many who use OOP on ...
3
votes
5answers
263 views

OODesign: Data Structure which calls algorithm on insert

I have a data structure which has an add function. When the user instantiates a new data structure object, she can specify an algorithm which will be executed each time the add function is called and ...
0
votes
1answer
70 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 ...
1
vote
2answers
105 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 ...
1
vote
2answers
112 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 < ...
1
vote
3answers
51 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
90 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
164 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
80 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
35 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
78 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
189 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
43 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 ...
77
votes
14answers
9k 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
49 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
86 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
98 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
90 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
263 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
455 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
131 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
178 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 ...
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 ...
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
105 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
38 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
133 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
64 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 ...