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
112 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
2answers
87 views

Objects in smalltalk and c++

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
184 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
100 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 ...
1
vote
1answer
199 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
118 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
79 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
143 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
202 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
65 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
55 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
58 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 ...
0
votes
0answers
39 views

Is this interpretation correct on usage of interface? [migrated]

We have numerous threads talking about the usage of interface vis-a-vis abstract class Taking reference of an answer, given by Prasun looks complete answer to me. Do you think this is complete ...
3
votes
3answers
307 views

Should we add constructors to structs

We often use c++ structs to define data structure as opposed to class which can be a complete module with member methods. Now deep down, we know they both are the same (loosely speaking). The fact ...
2
votes
0answers
52 views

Advantages and drawbacks of different ways using Either-types

I am writing software for compiling programs. Therefore have a Compiler that compiles a given sourcecode. It then returns a CompileResult that is similiar to an Either type (it is actually internally ...
13
votes
10answers
2k views

Can objects constructed from the same class have unique method definitions?

I know this seems like a weird question, since the point of two or more objects sharing the same class is that their behavior is the same, i.e. their methods are identical. However, I'm curious if ...
-2
votes
0answers
46 views

Adding a link label for a list of features [migrated]

I have a class that contains a list of features and I would like to add a link label for each item in that list. When doing this, I am not able to display all of the features, only the first feature. ...
3
votes
2answers
106 views

OOP CLI menu structure organization?

This problem has kept me from pursuing a project I'm working on because it influences the entire structure of the application. This question has been briefly touched on here, but I feel that it wasn't ...
1
vote
1answer
95 views

Should I use composition or inheritance for sharing configuration items?

I'm working on a fairly new project where I'd like to share some config items used by a JavaScript plugin. Specifically, the project is using jQuery dataTables and I want to find a good way of sharing ...
1
vote
2answers
65 views

Is composition and aggregation really a type of association relationship?

From Wikipedia: There are four different types of association: bi-directional, uni-directional, Aggregation (includes Composition aggregation) and Reflexive. From what I know: Composition ...
0
votes
1answer
68 views

Cleanest choice for symmetric operations

I have a need to do some processing from a format A to a format B and from B to A. The job in one direction is very similar to its counterpart. Both formats are represented with an interface Msg. In ...
-1
votes
1answer
33 views

How do Event Bus and ReativeX interact with each other?

I wanted to look into communication/decoupling patterns and how to improve them. My current approach is to have a centralized commander in the form of an Event Bus and make him be the one to respond ...
0
votes
3answers
114 views

OOP: relying on protected properties in a class-subclass contract

I'm coding in Python, but the question seems independent of programming language. I have a class that represents some system check: class Check: @abstractmethod def run() """ You have to ...
-2
votes
1answer
61 views

Naming of classes [closed]

I am creating an Email sending client. My POJO domain model conssts of 2 string fields, userName and userId. My thought process around designing the classes was to club these 2 fields into a domain ...
4
votes
2answers
620 views

What is the difference between Encapsulation and High cohesion?

I've looked at encapsulation and cohesion, but they look like the same thing to me. Isn't an encapsulated object already highly-cohesive?
-2
votes
1answer
71 views

Architecture - 3D Modeling Library

I'm writing a library to allow users to generate 3D models programatically. User writes code (e.g. Square(4)) User views preview of 3D model (with built in visualizer) User can "print" the model to ...
1
vote
2answers
354 views

Generics in low level languages

I'm developing a language like Vala and OOC that compiles back to C. This means that, eventually, every feature needs to be adoptable to C code in some way or another. Generics is one of the features ...
2
votes
2answers
229 views

Inheritance in imperative programming

My first introduction to programming was Java, which was horrible so I learnt Actionscript3 which was nice... "The point is" OOP was my introduction to programming where by I went on to gain a career ...
3
votes
3answers
212 views

Interface to enumerate over files

I'm trying to design a generic interface for enumerating over a list files. Each iteration will open a file, allow the consuming code to access the file to perform some task, and then close the file. ...
2
votes
3answers
146 views

Determining a class structure

I'm currently in the early stages of designing an e-commerce application. I'm working out some designs for my classes which have so far been fairly straightforward, but I've run into something of a ...
0
votes
3answers
138 views

Why static members can't be abstract and don't implement polymorphism? [duplicate]

I'm a Java/C#/PHP developer, through my OOP programming experience I find myself asking the same question: Why static members can't be abstract and don't implement polymorphism especially in ...
1
vote
1answer
201 views

Should I couple these classes?

I am programming in Python. I have several complicated/hard-to-understand XML files that describe the structure of an election. I am trying to write a python wrapper that makes it easy to access this ...
0
votes
1answer
135 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
68 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
189 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
218 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
132 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
83 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
54 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
217 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
148 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
131 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
119 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 ...
4
votes
8answers
321 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
237 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
392 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
192 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
513 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 ...
28
votes
8answers
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() ...