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)

7
votes
3answers
148 views

How to model and store an entity which has “one or more” values

I'll use C# to design the model to be persisted Let's suppose I have the following entity: public class Episode { public int Id { get; set; } public string Title { get; set; } public ...
0
votes
1answer
49 views

Non-anemic model and SRP

I'm implementing a feature in legacy system right now. Instead of putting all my logic in some dummy application services and having anemic models, I thought I will try to do some OOP this time. I'm ...
0
votes
0answers
67 views

Dealing with several custom getters

I have a data structure with data units containing different types of data. I've wrapped the data in "Field" objects so that each field is able to independently parse user input in a desired way. ...
8
votes
2answers
190 views

Best practices for serialization of DDD aggregates

According to DDD domain logic should not be polluted with technical concerns like serialization, object-relational mapping, etc. So how do you serialize or map the aggregates' state without publicly ...
-2
votes
0answers
26 views

advantages and disadvantages of Dresden OCL Toolkit and Eclipse MDT/OCL [on hold]

What are features provided by these two OCL tools? Overall difficulty of use: How easy or hard is the tool to use (understandability, learnability, operability)? Cost: How expensive (e.g. ...
3
votes
3answers
158 views

Is it misleading to label code as a particular design pattern if it only loosely fits the definition?

Background: I have a rough, but working understanding of ~15 design patterns. It's been my experience using design patterns in my own projects that the resulting implementations usually end up as some ...
0
votes
0answers
26 views

Adding new Interface & Replacing Method with Interface Type

Let's say that I have 2 classes: Foo and Bar. `Foo` { List<Bar> bars String bippy() int boop() } `Bar` { int biz() String baz() } Observe that Foo's fields include a List<Bar>. ...
-2
votes
2answers
125 views

Why public access level method get overridden in java?

This question is raised with a clarification required to decide when to declare a method protected or public during class design of a package. My point is, if one needs to override a method of a ...
0
votes
2answers
78 views

Is it ok to access private members while doing same class comparison?

I am writing a class which basically is a wrapper around a dictionary with some extra functionality. This dictionary is stored as protected member _store. Now I am writing a __eq__ method to compare ...
4
votes
3answers
230 views

Why use arg type `class Object` instead of `Comparable[]`?

In the code below, I believe it would look more appropriate to make the method argument be of type Comparable[] instead of Object[]. The first reason it would be more appropriate is that one can be ...
1
vote
1answer
135 views

Modern OOP vs Alan Kays OOP [closed]

I've recently come to discover there's actually a strong amount of criticism towards what people refer to as "modern OOP" - often comparing it to either functional programming or Alan Kays' OOP. ...
2
votes
1answer
204 views

C# OOP Class Usage [duplicate]

I am just being picky and really wanted some of my code to look, feel, and be used a specific way but am not sure if its possible. I have a class I created that can be used like this ...
5
votes
2answers
157 views

How to avoid “type dispatchers” when working with SOLID

I've realized that since I've been more and more strict about the SOLID principles, my code tends to consist of more pure data objects and a lot of "operator" classes which seems to go against ...
22
votes
5answers
1k views

Saving an object via a method of its own or via another class?

If I want to save and retrieve an object. Should I create another class to handle it, or it's better to do that within the class? Or maybe mixing of both? Which is recommended according to OOD ...
4
votes
0answers
527 views

Is there an equivalent of lambda calculus for object oriented languages? [migrated]

Lambda calculus serves as a foundation for all sorts of functional languages and its various extensions are compiler targets for languages like Haskell, ML, etc. So what is the equivalent for object ...
2
votes
3answers
371 views

Class design - should methods call other methods?

I'm writing a very basic custom class for coupons and I've come up with a basic layout for the class, which consists of a number of small methods as I generally understand is a best practice. What ...
0
votes
1answer
42 views

How to organize conversion logic for strategy pattern?

I have a Color class. It has a property model which is a class that implements ColorModel interface, this property could be a RGB, Hex or HSL classes which implementing ColorModel interface. // ...
6
votes
1answer
160 views

In MVC should a model contain subview models?

Some background: A colleague and myself have different interpretations of MVC which means, given the same problem, we are coming up with radically different solutions. He comes from a Java background ...
2
votes
3answers
172 views

Getters and Setters unclear example

I know autmatic getters and setters are considers bad as they tend to break object's encapsulation. They also move the work that should have been done within the object outside. Allen Holub is a big ...
1
vote
1answer
122 views

Creating a calendar/planner program. Confused about OO logic?

I'd like to create a piece of software that has the functionality of a common written planner. To do this, it will have a Calendar. When planning the program, I became confused as to how I would ...
1
vote
1answer
169 views

Alan Kay: “The Big Idea is Messaging” [duplicate]

Alan Kay said "OO" was about messaging, not objects and drew a parallel to biological cells. His views are enticing, but vague. The way I understand it is something like a Cellular Automata. In a ...
0
votes
3answers
167 views

Building a calculator using MVC

I've been programming in Java for about 6 months, and I thought a good and challenging test of my skills would be to build a GUI calculator. I have very recently heard about this MVC idea, and I ...
3
votes
0answers
116 views

How to handle a memory consuming member variable

Suppose multiple objects of the same class should do something which takes a memory consuming resource. Which of the following approaches is recommended to define and use the resource by the objects? ...
1
vote
0answers
53 views

Extend, wrap, or both to add generics to a class that should have had them?

So I'm using a C# framework that has a great example of where generics would be useful, except they weren't used. For simplicity's sake, we will say it was a list (I know C# has its own list), but ...
1
vote
4answers
203 views

Member variables versus. state variables? [closed]

Sometimes we declare a member variable in the scope of class but we could do the same by providing input to and getting outputs of the functions. I am learning that member variables are to hold the ...
3
votes
1answer
130 views

Usage of this keyword in constructor chaining?

I am reading msdn documentation for this keyword. They gave three usages for this keyword as follows To qualify members hidden by similar names To pass an object as a parameter to other methods To ...
0
votes
1answer
113 views

Should I use a class as a wrapper?

Lets say I have a class representing a chemical compound class Compound(networkx.Graph): def __init__(self): super(Compound, self).__init__() And lets say that I want to add some ...
0
votes
1answer
97 views

Intermediate results as variables or only base values?

I have a object which has a few base variables (integers as example) and one intermediate variable for further processing. The intermediate variable can be calculated from the base vars. Now the ...
-2
votes
0answers
28 views

Why 'JRootPane' is-a 'JComponent' in javax.swing? [duplicate]

As per below code, I see that, setLayout() is being called on a JRootPane object instead of JFrame top level container in javx.swing world unlike java.awt, because it is told that swing's JFrame is ...
1
vote
1answer
53 views

Do the implementations of the Node interface in Web API violate Liskov Substitution Principle?

MDN article on Node interface states that interfaces [that inherit from Node interface] may return null in particular cases where the methods and properties are not relevant. They may throw an ...
3
votes
1answer
85 views

Why 'JButton' is-a 'Container' in javax.swing?

As per the class hierarchy in java.awt.*, class Button & class Label is-a class Component, and Component is not a Container, which make sense to me. As per the redesign of class hierarchy in ...
-1
votes
2answers
67 views

what is the difference between inclusion and inheritance [duplicate]

the question is self explanatory, I just want to know when to use the inclusion and when to use inheritance, and which one serves for re-usability. in other words, which one meets the Object ...
0
votes
1answer
68 views

Create an Inferface for different data sources but same datastructure [closed]

At the moment I have my sourcedata stored in different excel files but in the future I want to use a database. Since I dont want to write everything new when I have to change the source and maybe in ...
1
vote
2answers
52 views

Query on Recursive composition

For the below relation between Container and Componentin java.awt class hierarchy, I see that, in addition to is-a relation, class Container has composite relation with class Component with below ...
0
votes
1answer
76 views

Does class Availability makes programming as Object Oriented Language? [duplicate]

Does class Availability makes programming as Object Oriented Language ? Most of the people think that if there is Availability Class in a language, then that language becomes Object Oriented. Is it ...
1
vote
3answers
107 views

Exposition of Data Representation

I would like to know how the data representation is exposed in slide 7 of information hiding: Modifying an exposed data representation propagates to all code which directly accesses that ...
0
votes
2answers
158 views

if a c# interface contain only getter and setter definition, is it a code smell?

A project that I am working on has the following code for interface example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Test { public ...
0
votes
1answer
101 views

Coupling in OOP Contracts: Many simple values of few complex objects as arguments?

When designing an OOP-based application, should one prefer to transfer information between objects through complex objects that do a lot of handling work, or should I retrieve the data from the ...
0
votes
2answers
174 views

Bad Practice using Auto Generated Classes for Data Access

I've seen this before but haven't found concrete reasons. When you add Entities to your EF model, EF auto generates classes for these entities. In terms of DataAccess, why is it preferred to not ...
-1
votes
3answers
134 views

Objects in smalltalk and c++ [closed]

I have a question based on SmallTalk and C++. In one of the programming languages books, there is a question like: "Does an object in Smalltalk require its own private stack? What about in C++?" ...
0
votes
3answers
209 views

I want to understand clearly why can't we instantiate an object of an abstract class [duplicate]

Can I get a clear explanation why why can't we instantiate an object of an abstract class. I know abstract is not real. But I want to know more why can't we instantiate an object of an abstract class. ...
0
votes
3answers
108 views

Communicating between unrelated components/objects

Imagine that I have a game, with Monsters, Missions, Vehicles, and of course their controllers and such, so a Monster class, Mission Controller class, Vehicle Controller class and so on. Suppose that ...
2
votes
1answer
215 views

Convert procedural code to object oriented

I have a PHP application (a web service). It consists of files grouped in directories by theme like :      /customer         /search.php with this example content : Auth::authenticate($options); ...
1
vote
2answers
122 views

Python: Object initialised inside a Class?

Is possible and, if so, common practice to initialize an object inside a class in Python? self.field = Class()
1
vote
1answer
93 views

Inheritance, Composition and Protocols

I'm reading a book on general object oriented concepts to try and gain a solid understanding of everything. One thing that is throwing me off is the difference between Inheritance and Composition. I ...
1
vote
1answer
154 views

Should we use data object (or the data transfer object) for sharing data between these three classes?

I found an article by Martin Fowler that has made me doubt my design choices, particularly about data objects. Martin Fowler has written an article about what he thinks is a code smell. In this ...
0
votes
3answers
266 views

Force Derived Class to Implement Static Method C#

So the situation is like, I have few classes, all of which have a standard CRUD methods but static. I want to create a base class which will be inherited so that it can force to implement this CRUD ...
1
vote
1answer
74 views

Setting fields of a base class when using the constructor is not an option

I am refactoring a base class, implementations of which are plug-ins, loaded at runtime by another class using reflection. The class I am refactoring uses a user ID of the form domain\user. I need ...
2
votes
2answers
57 views

How to ORM non-disjoint specializations

Consider this highly simplified sample of relational data (each table may be involved in one-to-many and many-to-many relationships not shown here): people +-------+------+--------+ | name | born | ...
2
votes
2answers
64 views

Domain/Model objects attributes good practices

Simple question: Should model/domain objects only include attributes that are meant to be persisted in a database or serialized to any other specific format? My understanding of a domain/model object ...