A methodology that enables a system to be modeled as a set of objects that can be controlled and manipulated in a modular manner

learn more… | top users | synonyms (3)

0
votes
1answer
124 views

What should be in a PIMPL?

I am kinda trying to implement a windowing library in C++, the circumstances are forcing me to implement it all myself, that's not the point of this question however. My question is: What should be ...
2
votes
1answer
46 views

Design Question - System Integration

Guidance on good application architecture / design is not in short supply however most of the examples focus on some business object, like Customer and its behaviour and persistence. There is little ...
0
votes
1answer
177 views

Is not being able to resolve a function call to its declaration a drawback of Polymorphism?

Consider a class that prints an "outline" table for a particular product line. Say you have several, A, B, C, D. The mechanism of the table generation is the same, but the data is different. I ...
1
vote
1answer
201 views

Designing classes the right way [closed]

I am trying to design my classes in the optimal way for the following scenario. A city has metro lines covering a number of stations.There are 4 lines represented by 4 colors.The user has to enter ...
1
vote
1answer
90 views

Best OOP pattern to use for creating a commandline SQL API for a proprietary json based company datastore

We need to create a SQL commandline tool for querying a proprietary json based datastore. I'll be using java. Any suggestions on the primary OOP design pattern I should use for building this API? ...
0
votes
1answer
81 views

when would you wrap a service object with an interface? [duplicate]

I'm new to UT and some of the best practices and anti-patterns when writing testable code, made me think. I used to wrap any service object with interface. but I see many mocking frameworks can ...
0
votes
0answers
53 views

when would you write static method as it avoid a “seam” for testing [duplicate]

when would you write static method. I used to write it in utils classes where all the methods are static and work state-lessly on arguments only. But now I know it blocks from creating a seam in ...
2
votes
3answers
156 views

OOD: Java inheritance and access to child methods via casting

I have several classes Parent and Child1 ... Child9 implemented in Java. Parent is an abstract class, containing all the common variables of the child classes (a lot, which is the main reason why I ...
1
vote
1answer
134 views

Should I declare the most specific type as return type of method?

Sorry for my English In Android I can put only ArrayList of Parcelable objects in Intent: Intent putParcelableArrayListExtra(String name, ArrayList<? extends Parcelable> value); I can't put ...
1
vote
2answers
120 views

Deriving from a class only to provide a special constructor

In our codebase, I encountered the following construct: There is a base class B, and then there is a class D which derives from B, but does not override or add any members. In fact, D is completely ...
0
votes
1answer
116 views

Method Parameters Ordering [closed]

I was recently changing a method to add in an additional parameter, and I couldn't help but wonder if there were "best practices" or "generally accepted rules" in deciding what order parameters of a ...
6
votes
8answers
298 views

Do objects with validation logic in their domain really represent their real world counterparts?

I asked a question about whether validation behavior should be treated the same as other types of behavior in regard to the concept of OOP being "data + behavior". I got some good answers back that ...
2
votes
3answers
216 views

OOP: Behavior + Data, but what about 'validation' behaviors?

EDIT: Thanks for all the great answers! In reading these responses I realized that I'm approaching this from the wrong angle so I wrote a new question here. I had this discussion with my superior ...
3
votes
2answers
373 views

Are there any OO languages without inheritance?

During a code review today, a colleague of mine said something interesting: prototype is only useful when you need inheritance - and when's inheritance ever a good idea? I thought about this and ...
1
vote
2answers
185 views

Why is object-level privacy difficult to use as a paradigm, and why is it desirable?

I have heard a prominent language designer remark that no language today enforces real object privacy, and we are still unsure whether it is possible in practice to design a language that does. ...
3
votes
4answers
449 views

How to force “program to an interface” without using a java Interface in java 1.6

In java 1.8 they have wonderful new "default interface methods". In 1.6 how close can we come? The goal: keep clients (using code) from being able to tell that a class is not a java interface. If ...
25
votes
7answers
6k views

When writing object-oriented code, should I always be following a design pattern?

Is there a conceivable design pattern for any object-oriented program? I ask this because recently I saw an implementation of a Door class with a Lock. It was part of a test and the answer said that ...
2
votes
2answers
166 views

Should fields still be private when you need to restructure the data?

I was taught that an object should know how to do everything with itself. So I've built an application trying to keep fields private and have a lot of methods like these: DisplayGraphically() ...
0
votes
2answers
73 views

When should you create/destroy underlying object in a class that wraps it

(note: I used Java to make it easer to explain my question, but the actual language is irrelevant for this dilemma) TL; DR: I have a wrapper around some underlying class. At which point should I ...
0
votes
0answers
97 views

Evaluating local storage for data persistence for small, stand-alone applications

TL;DR - I have a standalone application that will remain relatively small. I'm trying to evaluate between using XML files or a lightweight database for local storage of data that needs to be ...
0
votes
1answer
84 views

Are there any serialization schemes for OOP that include methods or operations in the contract in addition to data structure?

So typically we create schemas, mime-types, etc for our objects when we're communicating to another system about objects. The document usually defines data structure of the objects for serialization ...
0
votes
3answers
306 views

Is the KISS principle more important than utilizing OOP to solve a problem?

I'm a PHP developer coding in the Yii 1.x framework. I was looking for a way to encode unescaped JSON in Yii 1.x, and found the CJSON framework class for this purpose (so OOP). Since it does not ...
0
votes
1answer
112 views

When should I refactor a private class into a package-private class?

When I began implementing a class in my system (let's call it A), I realized I needed some kind of object that does something. So I needed a new class (let's call it B), but I made it a private static ...
-1
votes
1answer
129 views

Is it common to have a constructor with 7 elements for example? [duplicate]

Is it common to have a constructor with 7 elements for example? or is it better to use many setters instead?
1
vote
1answer
133 views

Static controllers

I have built myself a PHP MVC framework to meet my needs. As pretty much all of the core classes are static, I just stumbled upon the idea of having static controllers. I know that for some reason ...
-1
votes
0answers
58 views

Algorithm / Coordinator or Worker / Integrator Distinction

In this article by Jakub Holý on writing maintainable and evolvable tests, the author shares his experience of a course lectured by Kent Beck and that when designing a part of the system Kent would ...
0
votes
0answers
56 views

Is it good to make singleton Log classes for Entity classes [duplicate]

I am little confused about the technique i use in almost all applications i wrote ,i think i am going wrong I make Entity class Forexample Person, Adress ,Class and then to save it i make AdressLog ...
2
votes
4answers
478 views

When should something be a class? And are my chosen classes good OO design?

My background: I am new to programming. Python is my only programming knowledge. I program as a hobby, and I'm teaching myself by reading copious amounts of books. I understand enough about OOP to ...
1
vote
2answers
206 views

when using dependency injection, should I always pass an interface

When using depending injection, you generally pass everything around as an interface (perhaps with the exception of primitives and strings). That allows you to easily chance the behavior, without ...
0
votes
2answers
156 views

Is this instance of mixing FP and OOP a good design?

I had a strange-feeling pattern come up in some code I was writing. In a project with user accounts, there was a lot of code that needed to do common things such as creating accounts, deleting them, ...
0
votes
0answers
66 views

The finer points of HMVC

I'm new to HMVC and whilst tutorials are great about dealing with the overall details of keeping modules separate and only letting controllers communicate, they aren't so great at explaining the ...
34
votes
5answers
3k views

IOC Containers break OOP Principles

What is the purpose of IOC Containers? The combined reasons for it can be simplified to the following: When using OOP/SOLID Development principles, Dependency Injection gets messy. Either you have ...
1
vote
2answers
153 views

When I create an object, is fresh memory allocated to both instance fields and methods or only to instance fields

I have a following class class Student{ int rollNumber; int marks; public void setResult(int rollNumber, int marks){ this.rollNumber=rollNumber; this.marks=marks; } public void ...
0
votes
0answers
4 views

error LNK2019: unresolved external symbol? [migrated]

Firstly, I am beginner in c++ and Visual C++ (but not OOP). I am now trying to import Excel data to my data structure. What I have done is creating the structure(as class) in dataStructures.cpp along ...
1
vote
4answers
352 views

When to not use dynamic in C# [closed]

I'm making a class similar to the following: public class KeyValue { public readonly string key; public readonly object value; } Value could be of any object type as a result of this ...
11
votes
4answers
677 views

Is it an overkill to wrap a collection in a simple class only for the sake of better readability?

I have the following map: Map<Double, List<SoundEvent>> soundEventCells = new HashMap<Double, List<SoundEvent>>(); This HashMap maps double values (which are points in time) ...
0
votes
2answers
51 views

Should `setX(Object o)` methods perform deep or shallow copies of objects?

My particular situation is related to Java, but I believe this is a more general OOP question than just Java programming. The Question: Should "mutator" methods perform deep or shallow copies? An ...
1
vote
1answer
134 views

C++ : Association, Aggregation and Composition [closed]

I'm beginning to study OOAD and I'm having difficulty finding a C++ code example that'd illustrate how Association, Aggregation and Composition are implemented programmatically. (There are several ...
2
votes
3answers
254 views

Could the creation of many methods in Java affect performance? [closed]

I was told by a colleague that in Java, the performance may be worse if we create more methods, stacking many methods calling over them in JVM, specially in a Java EE environment. This seems to ...
1
vote
4answers
148 views

Domain model associations that do not required the behaviour of the associated object. How to model?

I've been struggling with this question for a while. I'm specifically thinking within the object orientated domain model. Let's say I have two entities. A supplier and a customer. There is a ...
1
vote
1answer
114 views

DataMapper for a MMO game plugin to send packets

I am working on an plugin for some game-server. The information about the plugin is not really necessary. Few points you might find helpful to answer to this question: The server The server is ...
0
votes
5answers
349 views

Liskov Substitution and SRP Principle violation - how best to structure this scenario?

While learning SRP and LSP, I'm trying to improve the design of my code to comply best with both of these principles. I have an employee class that has a calculatePay method on it. Firstly, I believe ...
2
votes
1answer
208 views

Any OOP design pattern that is somewhat representative of all of the SOLID OOP design principles at play?

I'm trying to teach an object oriented design principles course (on SOLID) at a training institute. I also want to teach the students a few OOP design patterns such as factory, singleton and one ...
0
votes
1answer
108 views

Are there two type of associations between objects or are there just different representations?

I've been spending some time on 're-tuning' some of my OOP understanding, and I've come up against a concept that is confusing me. Lets say I have two objects. A user object and an account object. ...
4
votes
2answers
161 views

Reducing dependency cycles and reducing coupling

I'm trying to learn how to produce quality object-oriented code and have been studying concepts like SOLID. I'm currently working on an entity-component-process system for a small game engine. ...
0
votes
1answer
291 views

Single responsibility: how does this code cause problems?

Given the following interface interface Modem { public void Dial(string pno); public void Hangup(); public void Send(char c); public char Recv(); } Uncle Bob writes However, ...
1
vote
2answers
141 views

How to let the outside world decorate my private field?

Imagine a simple Controller (as in process control) interface. I have some concrete classes, say PIDController, that implement it. I also have some decorator classes that extend these classes ...
3
votes
1answer
181 views

Redundancy caused by polymorphism

I have two chat rooms, one has administration behaviour, and one doesn't. I have factored out all of the common code into a base chat room, but the AdministerChatroom behaviour I have pulled out into ...
0
votes
1answer
80 views

Efficiency of getters/setters with database performance

I'm currently in the process of refactoring a very old personal project of mine, which used procedural PHP-in-HTML code. I'm modernising it as a learning project, using OOP where beneficial. I ...
2
votes
1answer
76 views

class hierarchy with structurally different subclasses

I want to implement a protocol layer which sits on top of the TCP/IP stack. There is a limited set of PDUs that can be sent and for each PDU there is a class which represents it in a structured form. ...