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
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
491 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
224 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
162 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
85 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 ...
36
votes
5answers
4k 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
191 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 ...
1
vote
4answers
397 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
692 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
59 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
859 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
269 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
154 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 ...
2
votes
1answer
164 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
370 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
236 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
121 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
3answers
236 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
297 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
144 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
188 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
95 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
86 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. ...
3
votes
5answers
518 views

Are a class's methods stored only once in memory? [closed]

When I create an instance of a class the system allocates memory for all instance variables of the class. Some languages may call them fields or properties. But what about the code of the class ...
1
vote
1answer
209 views

Entity Component System Coupling

Lately I've been working on a small personal project which is basically an Entity Component System framework with autoupdated Systems. While I have a pretty good idea on the way the framework should ...
0
votes
2answers
150 views

Designing Nested List<Class> Property in a Class

I'm currently in the class modeling phase of my project. Real life Scenario: Let's say I have a Project that is composed of Main Components and each Main Component is composed of Sub Components and ...
0
votes
2answers
257 views

C# - initialize variable inside method and use in whole class [closed]

this is a conceptual question, but if i initialize a variable in c# as public will it be able to be used in the class as I want a variable "player1" and a variable "player2" where either could be one ...
0
votes
1answer
139 views

The ViewController design in iOS vs MVC in tradiational web apps design

As I came from the background of webapps and move to iOS programming, I am wondering why we can't just apply the MVC design approach to native apps, i.e. in iOS, the view and controller are tightly ...
1
vote
1answer
433 views

Composing programs from small simple pieces: OOP vs Functional Programming [closed]

I started programming when imperative programming languages such as C were virtually the only game in town for paid gigs. I'm not a computer scientist by training so I was only exposed to Assembler ...
1
vote
3answers
165 views

Am I violating LSP if the condition can be checked?

This base class for some shapes I have in my game looks like this. Some of the shapes can be resized, some of them can not. private Shape shape; public virtual void SetSizeOfShape(int ...
1
vote
2answers
264 views

Advice on approaching a significant rearrangement/refactoring?

I'm working on an application (hobby project, solo programmer, small-medium size), and I have recently redesigned a significant part of it. The program already works in it's current state, but I ...
4
votes
5answers
438 views

Questioning one of the arguments for dependency injection: Why is creating an object graph hard?

Dependency injection frameworks like Google Guice give the following motivation for their usage (source): To construct an object, you first build its dependencies. But to build each dependency, ...
2
votes
1answer
193 views

Is this JS code a good way for defining class with private methods?

I was recently browsing a open source JavaScript project. The project is a straight port from another project in C language. It mostly use static methods, packed together in classes. Most classes are ...
36
votes
5answers
4k views

Passing functions into other functions as parameters, bad practice?

We've been in the process of changing how our AS3 application talks to our back end and we're in the process of implementing a REST system to replace our old one. Sadly the developer who started the ...
3
votes
1answer
208 views

Project structure: where to put business logic

First of all, I'm not asking where does business logic belong. This has been asked before and most answers I've read agree in that it belongs in the model: Where to put business logic in MVC design? ...
2
votes
1answer
96 views

Models, collections…and then what? Processes?

I'm a LAMP-stack dev who's been more on the JavaScript side the last few years and really enjoying the Model + Collection approach to data entities that BackboneJS, etc. uses. It's helped me organize ...
1
vote
4answers
141 views

When should a method of a class return the same instance after modifying itself?

I have a class that has three methods A(), B() and C(). Those methods modify the own instance. While the methods have to return an instance when the instance is a separate copy (just as Clone()), I ...
5
votes
6answers
503 views

Requesting feedback on my OO design

I'm working on an application that creates music by itself. I'm seeking feedback for my OO design so far. This question will focus on one part of the program. The application produces Tune objects, ...
0
votes
3answers
156 views

How to change the state of a singleton in runtime

Consider I am going to write a simple file based logger AppLogger to be used in my apps, ideally it should be a singleton so I can call it via public class AppLogger { public static String file = ...
1
vote
0answers
106 views

JS closures - Passing a function to a child, how should the shared object be accessed

I have a design and am wondering what the appropriate way to access variables is. I'll demonstrate with this example since I can't seem to describe it better than the title. Term is an object ...
3
votes
4answers
234 views

Is there a way to avoid type-checking in this scenario?

I have a class SuperClass with two subclasses SubClassA and SubClassB. I have a method in a different class which takes a SuperClass parameter. The method should do different things depending on the ...
0
votes
1answer
158 views

Should I limit my type name suffix vocabulary when using OOP?

My co-workers tend to think that it is better to limit non-domain type suffixes to a small fixed set of OOP-pattern inspired words, e.g.: *Service *Repository *Factory *Manager *Provider I believe ...
2
votes
2answers
611 views

One boilerplate class or many similar classes?

Lets say I'm trying to model a variety of objects that are virtually identical, the only difference being their class variables. Am I better off creating one boilerplate class and just calling the ...
9
votes
4answers
474 views

Are first-class functions a substitute for the Strategy pattern?

The Strategy design pattern is often regarded as a substitute for first-class functions in languages that lack them. So for example say you wanted to pass functionality into an object. In Java you'd ...
0
votes
1answer
94 views

What's a “Polymorphic method”?

Sometimes people use the phrase "Polymorphic method/function". Does it mean: A method that takes a Polymorphic type as a parameter, and performs some operation on it. By "Polymorphic type" I mean a ...
1
vote
1answer
191 views

Passing in config values to a method using SOLID principles

I have an email helper class that has a method that sends email: private static class EmailHelper { public static void SendEmail(string from, string to, string subject, string message) { ...
0
votes
3answers
188 views

Drawback of using static method [duplicate]

For methods that never access instance variable or static variable and they act just like a function (name-spaced) and they are deterministic base on only the input arguments , I want to ask, are ...
1
vote
0answers
64 views

Dealing with class optional dependencies

I am wondering how are you guys handling an optional class properties. Let's say I have a product that can bud doesn't have to have a color property. Is that really the best way of doing that? Should ...
1
vote
3answers
415 views

Self-Evaluation: How do I know if I actually have a “good grasp” of OOP? [duplicate]

If I skip the back story and any thoughts I have on this topic, there's really only one question left to ask: How can I find out if I have a "good grasp" on OOP? (I am specifically using PHP, but ...
5
votes
2answers
2k views

Why are inheritance, encapsulation and polymorphism not the pillars of OOP? [closed]

One day I went to a Stack Overflow chat and saw a phrase, that was stating that inheritance, incapsulation and polymorphism are the pillars of OOP (in the sense that they are fundamental, a ...