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)

4
votes
1answer
100 views

Which C++ IO interfaces for a complex data source i.e. converter

My question: When you've got a complex converter like, that takes chunks or large result sets out of a database, converts it into a line by line file/resource in the end, should one either design it ...
1
vote
0answers
53 views

Child class accessing its parent's method from Ancestor method

I find myself right now banging my head with the following issue (in PHP): I have an abstract base class, which has a non-abstract method, inherited and unchanged all over the inheritance chain ...
0
votes
1answer
28 views

How can I paint a custom circular JComponent without an “invisible box” around it?

I'm writing a JApplet that displays a diagram with numbers in circles and lines connecting the circles. I've created a class that extends JComponent to act as the circles. I overrode the ...
3
votes
2answers
255 views

Is turning a method into a class too use it across many classes bad practice? [on hold]

Let's say I have a sort method inside of my class and another class that has no relationship with that class needs the same method. Instead of writing that method twice and breaking the do not repeat ...
2
votes
1answer
547 views

Emulation of MMU accessing the contents of the registers

I'm having a play around with emulating a simple old CPU. I've set the structure up, so far anyway, as follows: The device is the main and creates an instance of the CPU. The CPU then creates ...
4
votes
1answer
679 views

Rewriting a Procedural PHP App - Should we use a framework?

We have an app that's currently only got about 120 users. The userbase will probably grow by 50% over the next 12 months - but we're going to have to separate storage etc. because we're looking at ...
0
votes
1answer
44 views

Impacts of a method's parameter that throws an exception according to object state

I'd like to know how bad it is to do something like this: public class FooBar { public bool CanOverride { get; } public FooBar(bool canOverride) { CanOverride = canOverride; ...
1
vote
3answers
40 views

How to decide what instance variables to have in a class?

Most OO guides say not to store things in instance variables if they can be easily calculated, because the state might become inconsistent, and there is more code to maintain. I am trying to come up ...
1
vote
2answers
55 views

Does my code still break encapsulation and uses getters/setters instead of the TellDontAsk principle?

I and one guy have been discussing potential solution of a problem on an unrelated board, regarding the typical getter/setter hate, ie. using getters/setters leads to procedural programming. I ...
0
votes
1answer
149 views

Object Communication Design

Multiple top-level systems that communicate with each other via messages(events/commands). The Main class of the program wraps around all the systems and has a message dispacher component wich ...
8
votes
2answers
322 views

ActiveX, OLE, COM explanation or informative links

I've been programming a lot with C# on Visual Studio and many minor/other languages, but I'm having a really hard time to get the grasp of ActiveX, OLE, COM interfaces. All I got is that they're like ...
1
vote
2answers
92 views

A generic helper class, a project specific class, and the rest of project

I have a generic helper class (1) that can be used in other projects also. Imagine something like basic handling of file and folders, something useful and DRY that always come in handy. I have ...
1
vote
1answer
90 views

Compiler design prevent register override

I'm trying to write a compiler for a self-designed CPU with accompanying instruction set. The CPU has 3 registers, 2 input registers (B and C) and one output register (D). When for example an ADD ...
3
votes
1answer
153 views

What design pattern is used in this delegating scenario?

I am currently having to bend some framework API to fit my usecase. The framework provides generic interfaces such as public interface Processor<T> { T process(T t); } with various ...
23
votes
5answers
3k views

Is it a good practice to avoid constants by using getters?

Is it a good practice to replace constants used outside of classes by getters? As an example, is it better to use if User.getRole().getCode() == Role.CODE_ADMIN or if User.getRole().isCodeAdmin()? ...
2
votes
1answer
62 views

Cleanest way to expand a base class without explicitly mapping properties in C#

Lets assume I have following base class: public class Base { public int Id {get; set;} public string SomeText {get; set;} public string SomeOtherText {get; set;} public static Base ...
0
votes
1answer
97 views

How to implement strategy pattern on N-Tier application?

Well, i have a N-Layer MVC project which is something like: Domain > Repository > Application > Presentation I have a feature on the website where the user put some monthly expenses (food, gas, ...
2
votes
0answers
79 views

Finite state machine menu design

I'm creating a FSM in python (it's a step sequencer and sample pad based on a Raspberry Pi 2). Right now there are two states and the third is the Menu. This is handled by a class System which ...
3
votes
1answer
202 views

How can a object have many types?

I am currently reading Design Patterns - Elements of Reusable Object-Oriented Software. I am in chapter 1 at page 16 in section Class versus Interface Inheritance. There in the last line of the page ...
1
vote
2answers
102 views

Does an interface including several methods that return instances of Object make sense?

I am in the process of writing my first true API. In the process, I am defining an interface for mapping complex data structures onto other complex data structures. At the moment, the interface ...
8
votes
4answers
354 views

Parallel hierarchies - partly same, partly different

There are quite a few similar questions out there 1, 2, 3, 4, but non seems exactly the case in this question, nor do the solutions seem optimal. This is a general OOP question, assuming ...
40
votes
1answer
3k views

Why do programmers use `Acme` as a package, namespace or directory name [closed]

This may or may not be a silly question, but I really would like to know the answer to something which has been bothering me for a while. I quite often see programming examples/conventions where the ...
1
vote
3answers
231 views

Java need to call many methods systematically

I have a group of methods that is going to be very large. I need to be able to call methods systematically from a large group, in two different ways. The methods create a new item object with ...
28
votes
8answers
6k views

Is it acceptable to copy and paste long but straightforward code instead of wrapping them into a class or function?

Suppose I have a segment of code to connect to internet and show connection results like it: HttpRequest* httpRequest=new HttpRequest(); httpRequest->setUrl("(some domain .com)"); ...
56
votes
11answers
6k views

Does this class design violate the single responsibility principle?

Today I had an argument with someone. I was explaining the benefits of having a rich domain model as opposed to an anemic domain model. And I demoed my point with a simple class looking like that: ...
-3
votes
1answer
152 views

I think fan-in fan-out is backward, please explain [closed]

The term Fan-In came from Electronics, and refers to how many inputs a logic gate has, such as a Two-Input AND gate (fan-in of 2). Fan-Out refers to how many gates can simultaneously draw on the (one ...
3
votes
2answers
5k 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 ...
2
votes
3answers
150 views

Why does the overriding rule of C++ not care about visibility changes?

In C++, it is possible to write an overriding for a base class's method even if the visibility declaration of the two don't match. What are the possible design considerations under the decision of not ...
2
votes
4answers
208 views

Handling Multiple Collections in C#

I'm currently trying to learn C# and want to enhance my understanding of Object Oriented Programming (OOP). I'm hoping to accomplish this by experimenting with a small program that keeps track of my ...
21
votes
3answers
4k views

The principle of least knowledge

I understand the motive behind the principle of least knowledge, but I find some disadvantages if I try to apply it in my design. One of the examples of this principle (actually how not to use it), ...
24
votes
8answers
5k views

Is it a good practice to use List of Enums?

I am currently working on a system where there are Users, and each user have one or multiple roles. Is it a good practice to use List of Enum values on User? I can't think of anything better, but this ...
3
votes
3answers
359 views

Generics vs common interface?

I don't remember when I wrote generic class last time. Every time I think I need it after some thinking I make a conclusion I don't. The second answer to this question made me to ask for ...
0
votes
1answer
92 views

Can I enforce the overriding of GetHashCode() and Equals() methods for users of a generic container class?

I have a container class similar to the one below (with much of the logic omitted): class Container<T> { Dictionary<T, TWrapped> contains = new Dictionary<T, TWrapper>(); ...
74
votes
16answers
57k views

Is it better to return NULL or empty values from functions/methods where the return value is not present?

I am looking for a recommendation here. I am struggling with whether it is better to return NULL or an empty value from a method when the return value is not present or cannot be determined. Take ...
3
votes
2answers
19k views

Recommended reading for (Object Oriented) application design architecture? [duplicate]

Possible Duplicate: Best books on the theory and practice of software architecture? In life it doesnt matter if you do one thing for 15 years. You will end up waking one day and asking ...
20
votes
4answers
2k views

“Too object-oriented”

I come from a strong OO background, and I have recently started working in an organization which, although the code is written in Java, has a lot less emphasis on good OO design than what I am used ...
121
votes
9answers
105k views

Aggregation vs Composition

I understand what composition is in OOP, but I am not able to get a clear idea of what Aggregation is. Can someone explain?
6
votes
1answer
105 views

Software design: recommend approach to avoid slicing/type erasure here

Here is a concrete minimal example to formulate my question : In small ball game, you have a physics engine that moves the objects regularly: void move(set< PhysicalObject* > objets, Duration ...
0
votes
1answer
57 views

static method, helper function or in the controller, where does this go?

I'm working on a piece of functionality that simply allows a guest user to perform an action a certain number of times before requiring them to login\create account. In this instance, they can vote on ...
2
votes
3answers
191 views

What means mapping in terms of programming

My question is what means a mapper and the action of mapping something? For example, I often hear things like: Mapping the classes Mapping the objects from the database Mapping the objects Mapping ...
2
votes
1answer
48 views

Using prototype/non-Spring managed beans in Spring Web application

I have been working on few web applications/REST web services recently (Spring IoC/MVC/Data JPA etc) and they usually follow the same pattern: Controller classes --> Service classes (which have number ...
-1
votes
2answers
145 views

A class with extra field

Let's say I have an animal class...with fields of name, height and weight. I want to create a bird class which is an animal, but it has also, say, wing size. How can I do that? My general idea is ...
2
votes
3answers
5k views

An ideal way to decode JSON documents in C?

Assuming I have an API to consume that uses JSON as a data transmission method, what is an ideal way to decode the JSON returned by each API resource? For example, in Java I'd create a class for each ...
6
votes
3answers
193 views

System Decoupled in the Wrong Places: Meta-Problem? [closed]

At a meta level, I often find that when I grow a codebase organically, parts of the system that I eventually find need to know about each other (at least through some interface) have been mercilessly ...
0
votes
3answers
109 views

DDD Request Validation Handling

I stuck somewhere that I can't find a solution! There are plenty of validation questions here, but as far as I see, most of them were asking about entity validation. But what about request validation? ...
2
votes
2answers
641 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 ...
2
votes
1answer
105 views

Pattern for interface between sequence executing object(s) and sequence configuration objects

My motivating case is hardware test automation. We have several different testers (benches of lab equipment that connect to the "device under test" (DUT)), and we write test configuration files which ...
1
vote
1answer
59 views

Modeling specific objects interaction

I want to model an interaction between classes, e.g. there is a general class Hero and he can have some items. (I came up with this analogy so it is easier to understand) Some of them are e.g. potions ...
5
votes
4answers
421 views

Trying to get a better understanding of object-oriented design's performance pitfalls

I'm currently in a high-performance computing class taught in C++. Usually, I do work in C#, meaning everything is taken care of for me, and optimization comes behind maintainability and higher-level ...
0
votes
1answer
61 views

What is the difference between ADTs and objects? [closed]

This question was answered in a post here title "Understanding Abstract Data Types (ADTs) [duplicate]" (You need at least 10 reptutation to post more than 2 links...), and the top voted answerer (by ...