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

High-Level Classes and Low-Level Classes [duplicate]

I've seen at SOLID there is a principle Dependency inversion principle. Also I've seen that: High-level Classes should not depend on Low-level Classes but both of them should depend on abstractions. ...
7
votes
3answers
362 views

Object Identity and Mutability

I was reading a proposal for value types in Java, and I came across this sentence: "Object identity serves only to support mutability, where an object’s state can be mutated but remains the same ...
5
votes
4answers
574 views

MVC: Does the Controller break the Single Responsibility Principle?

The Single Responsibility Principle states that "a class should have one reason the change". In the MVC pattern, the Controller's job is to mediate between the View and the Model. It offers an ...
2
votes
2answers
140 views

MVC: Controller often simply delegates to Model when notified by View of GUI events. Is this reasonable?

Since I learnt about MVC, I used it for every app I made (which is arguably not the best idea, but that's not the topic of this question). All of them small, 1000 LoC apps. I am using Java and Swing ...
2
votes
3answers
215 views

Should POCO domain classes contain collections?

The question title is not good, but I couldn't think of a way to word it better. I am used to develop using POCO classes in my projects, that is, domain objects contain absolutely no logic, only ...
1
vote
2answers
283 views

Classes shouldn't call other classes? [closed]

I've just finished reading The Art of Unit Testing, by Roy Osherove. It was an interesting book, but I'm having trouble with something he mentions near the end (section 11.2.2): Identifying ...
2
votes
2answers
128 views

How to (or should I) have one assert per test with object comparisons? [duplicate]

I've recently read The Art of Unit Testing by Roy Osherove which I found very useful for helping me establish how to define a good unit test. One key aspect of the guidelines Roy puts forward are to ...
0
votes
2answers
135 views

Interface method signature not restrictive enough

I wrote a piece of code at my job sometime ago. While writting the code I wrote few interfaces who would allow me to add more flexibility and at that time I was also trying to understand OOP concept ...
1
vote
1answer
179 views

Practical programming according to the Dependency Inversion Principle

What the Dependency Inversion Priciple implies in practice is that in a system, high level components should depend on abstractions of the low level components (instead of on the low level components ...
0
votes
1answer
83 views

Persisting type in Java - should I be using flags?

Is there some specific piece of advice around persist values that indicate type? Specifically I want to know if I should persist a flag/state indicating the type in persistence or not. I get the ...
3
votes
2answers
137 views

UML class diagram: how to annotate observer-subject relationship?

How can I annotate in a UML class diagram that an instance of ClassA is registered as an observer of an instance of ClassB? (Both implement the appropriate interfaces). This doesn't really belong in ...
1
vote
4answers
514 views

Is it considered 'reasonable' to implement a major part of a program largely by subclassing a library class? [closed]

I'm planning to implement a word processor using Java, and Swing for the GUI. I was thinking how I can implement the text area where the user types the text. My idea was to subclass JTextArea. It ...
0
votes
1answer
238 views

UML class diagram - instantiation dependency relationship: who depends on who? [duplicate]

I did some reading on the <<instantiate>> relationship in UML class diagrams. It's a dependency relationship where one side depends on the other. However, I'm not sure who depends on who: ...
2
votes
6answers
2k views

How did programmers implement Linked list ideas before the object oriented paradigm?

Linked lists, as far as I have seen, are largely implemented using object-oriented ideas. (having an object that holds some information and the address of the next link). How were Linked-lists ...
13
votes
3answers
815 views

Why are interfaces more helpful than superclasses in achieving loose coupling?

(For the purpose of this question, when I say 'interface' I mean the language construct interface, and not an 'interface' in the other sense of the word, i.e. the public methods a class offers the ...
1
vote
2answers
154 views

Design for reusable java module which uses DB connections

I'm tasked with changing some procedural Java code into Object Oriented re-usable module. It's an XML generator utility which uses velocity for XML generation. There are also business rule ...
1
vote
1answer
119 views

Should I be using OOCSS in a CSS theme?

I have heard of OOCSS some time ago, but never really looked into it. Today I did so, and I thought of the implications of applying OOCSS to a simple CSS theme. One problem I thought of is that, by ...
4
votes
6answers
408 views

Inheritance/OO design question

This will probably wind up being a fairly simple question, but it needs some background first... I'm modelling various hardware switches, which can be turned on and off. The switches are configurable, ...
4
votes
4answers
2k views

What are the benefits of using Polymorphism 'in the real world' - as opposed to not using it? [duplicate]

I understand what Polymorphism is, but since I only ever programmed in Java and 'dived' pretty quickly into OOP, I'm having a hard time understanding exactly what it's benefits are (and I feel the ...
3
votes
2answers
394 views

Aren't decorators easily breaking the ISP?

"The Interface-Segregation Principle (ISP) states that no client should be forced to depend on methods it does not use." The decorator pattern is a design pattern to decorate a method of a class. For ...
0
votes
0answers
52 views

Modelling network and persistent entity representations

I have an app where I need to synchronize some entities (simply download latest versions of entities from server to client). Entity has bunch of text properties and bunch of resource links (referenced ...
0
votes
0answers
28 views

Class/Object with different sets of configurations, singletons etc (PHP)

I want to produce maintainable code for configuring one or multiple classes differently depending whether in a production or development environment. For example, making a Paypal class/object that ...
1
vote
1answer
84 views

How to deal with interactions between many objects

I've been working on a game in my spare time. I'm pretty much done defining the primitives and until today everything was pretty well segmented and encapsulated but now it's come time to implement ...
1
vote
5answers
247 views

object model and data model

I have heard/read mixed things on whether to start with an object model or a data model. And more people say to starting with an object model as it will ease your data modelling. My question is, ...
3
votes
4answers
536 views

Is it good practice to declare and set properties in abstract classes?

I am using PHP and designing some abstract classes. I can declare properties with constant values within my abstract class and access/overwrite them from any class which extends this without re ...
0
votes
3answers
310 views

Understanding object-oriented programming: why is it important? [duplicate]

Just started learning about classes in C++ and I'm have trouble understanding why object orientated programming (OOP) is useful. I understand the syntax, how to use them etc. But I'm still confused ...
0
votes
0answers
445 views

How to design socks proxy server (OOP)

I'm working on a socks server application written in C#. But I don't really know how to design this in a nice way. I got this for Socks V4 and V4A: I'm not sure if it clears things up, but I think ...
-1
votes
1answer
233 views

How to make C# methods work like javascript functions? [closed]

I'll keep it simple, I want to make C#'s methods work like javascript's functions. Mainly so I can convert this - function makeVariable(terp) { var me = {value: 0}; return function () { ...
12
votes
4answers
667 views

Adding field to the class at runtime - design pattern

Imagine your customer want's to have a possibility to add new property (e.g. color) to product in their eshop in their CMS. Instead of having properties as fields: class Car extends Product { ...
0
votes
2answers
293 views

How can I re-use object from another project?

I have a first project has a feature to viewing, inserting and updating an employee record, with this possibly I will create a java class for the UI and another for the database connection with ...
2
votes
3answers
299 views

Inheritance: Is code from superclass virtually *copied* to subclass, or is it *referred-to by subclass*?

Class Sub is a subclass of class Sup. What does that mean practically? Or in other words, what is the practical meaning of "inheritance"? Option 1: The code from Sup is virtually copied to Sub. (as ...
3
votes
1answer
195 views

OO design choice and single responsibility principle

I'm currently refactoring an application which periodically downloads content from various sources (http, ftp, sql, etc). There is a schedule which controls the times during which the application can ...
0
votes
1answer
185 views

Is NoSQL a better choice when working with OOP? [closed]

This might be a silly question, but I've reading a little bit about NoSQL databases on the past few days and I'm trying to understand when really they help us. One thing I've realized though is that ...
0
votes
1answer
228 views

Implementing a strategy pattern with dependency injection

Okay, so the goal here is to implement a strategy pattern that can be tested using any sort of automated testing tool. I've been struggling with this problem conceptually for a few weeks now and I ...
4
votes
2answers
732 views

What is the process of determining which method in a class hierarchy should execute known as?

I thought I understood inheritance and polymorphism, but I was given this question, and I can't, for the life of me, figure out what the proper answer is or what they're trying to get at: The ...
1
vote
2answers
259 views

Using the Decorator pattern to add public methods to an object

The Decorator pattern is usually used to extend the functionality of an object by extending one of it's current methods. To illustrate, please consider an object object and a decorator decorator. ...
1
vote
1answer
329 views

Differences between Dynamic Dispatch and Dynamic Binding

I've been looking on Google for a clear diffrentiation with examples but couldn't find any. I'm trying to understand the differences between Dynamic Dispatch and Dynamic Binding in Object Oriented ...
-4
votes
3answers
158 views

How to inherit from two parent classes [closed]

I have many classes with many relationship I draw Uml that relation between them: Is this relation true and how to implement this?
0
votes
1answer
148 views

Singleton: Why is a global point of access bad? [duplicate]

Most people here and on StackOverflow agree that Singletons are evil. The main explanation I've come across against the use of Singletons, is they fact that they provide a global point of access to ...
2
votes
2answers
132 views

Refactoring sought for replacing shared data types in .NET component

I am in charge with updating a software product that is made up of two components the Controller process and the UI process. The Controller and the UI communicate via XML messages. Furthermore, the ...
2
votes
2answers
612 views

What is the recommended approach for helper functions in JavaScript?

What is the recommended approach for helper functions? I would like to choose one technique, and run with it to create my new "class". Here are the design options I have pondered: Option 1: Helper ...
1
vote
3answers
244 views

When to use a Singleton and when to use a static class [duplicate]

I've searched about this here and on StackOverflow and found some differences between the two. But I'm still not sure in what cases one would prefer a Singleton, and in what cases one would choose to ...
1
vote
2answers
125 views

Does subtype polymorphism distinguish between inheriting behavior, or inheriting an interface?

To provide some context, I've seen some comments lately that equate inheriting behavior from a supertype, with inheriting a pure interface with no behavior. But there are pretty significant, and ...
2
votes
2answers
1k views

UML class diagram notations: Differences between Association, Aggregation and Composition

I'm confused about some of the notations of UML class diagrams. Pretty sure I know what Association means. Any relationship between instances of two classes, where an instance of one class needs to ...
2
votes
1answer
187 views

UML class diagrams: How to show dependency

Please consider a program with four classes: Class A, B, C and D. Classes A and B are subclasses of abstract super-class C. Class D is dependent on C. Meaning: It holds a C objectOfTypeC field. As ...
0
votes
1answer
259 views

My UML class diagram is too complicated, what should I do?

Classes have 10-20 links with one another and you can't see anything in that mess of a diagram Unfortunately we finished coding already and if we change the class diagram we have to redo the whole ...
0
votes
1answer
157 views

MVC in a desktop application - can the View ever hold a reference to the Model?

(I'm specifying this is a desktop application so people wouldn't refer specifically to web implementations of MVC). The title says it all pretty much. In an MVC structure - can the View ever hold a ...
0
votes
1answer
42 views

Implementing objects with several equivalent representations

I am wondering if there are patterns, references or useful resources about how to implement objects that may have several equivalent representations. For example: Suppose I want to implement a ...
6
votes
2answers
334 views

Dependency Inversion Principle: Understanding how both low level components and high level components depend on abstractions

I'm learning about the Dependency Inversion Principle. It states that: High level modules should not depend upon low-level modules. Both should depend upon abstractions. For a while I tried to ...
-1
votes
3answers
212 views

How important is it to learn UML for an OO developer? [closed]

When studying OOP by myself I often encounter UML class diagrams. I understand them, but don't completely know how to write them. Meaning, I don't entirely know what each kind of arrow means, and ...