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)

2
votes
4answers
161 views

How wrong it is to have multiple associations between classes?

I'm modeling a college process, in which I have three classes: Student, Subject and Degree Degrees have their own subjects, students have a list of subjects they have passed, and also students should ...
0
votes
2answers
77 views

Are static methods of a class part of its type?

As far as I understand it, classes –as they are supported in OOP languages such as C++, Java, and Scala – define the type of each object I can instantiate with that class. Not all features of a class ...
1
vote
2answers
51 views

Module based project vs Normal project [closed]

I am writing code on top an established Enterprise application. I see that the application has 4 modules as shown below. -Srk -SrkEJB -SrkUtils -SrkWeb I have gone through the code and I see that ...
15
votes
8answers
5k views

Interfaces on an abstract class

My coworker and I have different opinions on the relationship between base classes and interfaces. I'm of the belief that a class should not implement an interface unless that class can be used when ...
3
votes
1answer
275 views

Correct placement of Methods in OOP

Which Class should contain a method which has dependencies on multiple classes? I've coded up a specific example to avoid generalizations. In this example we have an initial requirement : ...
0
votes
2answers
229 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. ...
4
votes
1answer
99 views

OO design in a data processing pipeline

I'm wondering how to design a fairly simple class whose properties are complex to compute. Also, the properties depend upon each other for computation. An example using graphs and graph processing ...
2
votes
1answer
89 views

C++: Make classes immutable or compatible with STL containers

Making types immutable is often desireable, especially for multi-threaded applications. There's no need to worry about concurrent access and no need for any synchronization. The common STL containers ...
11
votes
5answers
1k views

How do I know my data is relational or object oriented in nature?

Just read these lines- If your data is object in nature, then use object stores ("NoSQL"). They'll be much faster than a relational database. If your data is relational in nature, the ...
1
vote
1answer
196 views

Adding a graphical view to a system

I currently have an program in Java that simulates railway movements. Essentially, trains arrive on platforms, pick up and drop off passengers, and then proceed, respecting signalling where possible. ...
3
votes
3answers
349 views

Functional vs object-oriented style in C#

I'm learning functional programming and face the following confusion when applying it to my C# projects: I begin by writing pure, static functions and use function composition. After the code ...
2
votes
1answer
269 views

Should all functions be fully self-contained (is it bad practice to share a variable between functions)?

There are two ways to do the same thing (pseudo code) Define databaseHandle in the parent function, and use it as a global in this scope: function API() { function openDatabase() { ...
0
votes
2answers
428 views

Object Oriented programming and modelling [closed]

I am taking a course in OOA/D this semester. I have some doubts about Object Oriented Programming. Is it true that Object Oriented programming can be done without any specific modelling like OMT? ...
0
votes
0answers
69 views

Is using Interface implemented by single class a not recommended practice? [duplicate]

I have several classes in C#, not just POCO class but with methods and implementations. Each of those classes implement one Interface. e.g. IPerson implemented by Person class. Employee implements ...
39
votes
5answers
5k 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 ...
4
votes
4answers
337 views

Legitimate cases of having .equals() behaving inconsistently with .compareTo()?

Java documentation says it's "strongly recommended" to have them behaving consistently. But are there legitimate cases of java/c#/python/etc Object.equals() method behaving inconsistently with the ...
9
votes
6answers
2k views

Checking if a method returns false: assign result to temporary variable, or put method invocation directly in conditional?

Is it a good practice to call a method that returns true or false values in an if statement? Something like this: private void VerifyAccount() { if (!ValidateCredentials(txtUser.Text, ...
2
votes
1answer
59 views

Which approach for coding a 'texture atlas'?

For a game project, I have a couple of textures coming from multiple sources and I need to pack all these within a single texture atlas. Example for a racing game circuit, there are textures for : ...
0
votes
1answer
71 views

Strategy pattern can use this pointer?

I want to use strategy pattern, but I wander if it is correct to use "this pointer" with the strategy pattern interface. This is required in order to get internal information which is required for ...
13
votes
1answer
831 views

How to verify the Liskov substitution principle in an inheritance hierarchy?

Inspired by this answer: Liskov Substitution Principle requires that Preconditions cannot be strengthened in a subtype. Postconditions cannot be weakened in a subtype. Invariants ...
142
votes
13answers
34k views

Should we avoid object creation in Java?

I was told by a colleague that in Java object creation is the most expensive operation you could perform. So I can only conclude to create as few objects as possible. This seems somewhat to defeat ...
34
votes
2answers
2k views

Why do methods that take an unlimited amount of parameters often define overloads with fewer parameters?

For instance, the System.IO.Path.Combine method in .NET has the following overloads: Combine(params String[]) Combine(String, String) Combine(String, String, String) Combine(String, String, String, ...
22
votes
5answers
3k views

Is my usage of explicit casting operator reasonable or a bad hack?

I have a big object: class BigObject{ public int Id {get;set;} public string FieldA {get;set;} // ... public string FieldZ {get;set;} } and a specialized, DTO-like object: class ...
1
vote
4answers
201 views

Is there a name for refactoring technique that turns hardcoded values into configurable parameters?

What is that technique called when you take values in the code that are hardcoded and make them variable, possibly constructing elaborate OO constructs to make that variable properly configurable? ...
2
votes
2answers
220 views

When it makes sense to implement C# explicit operator?

Follow-up of Is my usage of explicit casting operator reasonable or a bad hack? One of the users commenting on that question said that it's really bad if the casting operator creates a new object ...
-2
votes
1answer
41 views

ClickHandler for button = strategy pattern? [closed]

If you provide a implementation of a ClickHandler interface to a button (defining some behaviour), is this the strategy design pattern?
14
votes
14answers
6k views

How can I explain the usefulness of Inheritance? [closed]

When trying to explain the concept of Inheritance in OOP, the common example is often the mammals example. IMHO, this is really a bad example, because it will lead the newbies to use this concept the ...
5
votes
4answers
733 views

How to add a property to an object you can't change?

Let's say that I'm using a library and I would like to add a property that doesn't exist to an existing class. In this case, I'd like to add Color as a property of Fruit. namespace Library { ...
1
vote
2answers
105 views

Should method names getX and setX only be used for fields and have no other effects? [duplicate]

Should I avoid using getX() and setX() as names for methods that aren't "traditional" getters or setters? (Let's define traditional as it only gets/sets the field and has no other effects.) I guess ...
22
votes
7answers
2k views

Does functional programming ignore the benefits gained from the “On the Criteria To Be Used in Decomposing Systems into Modules” (data hiding)?

There's a classic article named On the Criteria To Be Used in Decomposing Systems into Modules that I just read for the first time. It makes perfect sense to me, and is probably one of those articles ...
1
vote
2answers
194 views

Is MVC controller an use case controller?

In GRASP (http://en.wikipedia.org/wiki/GRASP_(object-oriented_design) ), a controller (use case controller) is defined as: A use case controller should be used to deal with all system events of ...
58
votes
4answers
5k views

So what *did* Alan Kay really mean by the term “object-oriented”?

Reportedly, Alan Kay is the inventor of the term "object oriented". And he is often quoted as having said that what we call OO today is not what he meant. For example, I just found this on Google: ...
22
votes
7answers
18k views

What is the difference between “data hiding” and “encapsulation”?

I'm reading "Java concurrency in practice" and there is said: "Fortunately, the same object-oriented techniques that help you write well-organized, maintainable classes - such as encapsulation and ...
4
votes
1answer
146 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 ...
2
votes
2answers
291 views

Putting it all together [closed]

I've been reading a few books on c# development over the last few months (clr via c#, architecting applications for the enterprise, c# 4 in nutshell just to give you an idea). I really feel it's been ...
4
votes
4answers
909 views

Is it always a good idea to divide large classes into smaller ones? [duplicate]

I've heard time and time again that in object-oriented programming, you should try to split objects that 'do too much' into multiple classes, to avoid the "God Object" problem. This seems like fine ...
-1
votes
2answers
186 views

Mermaid problem (OOP) [closed]

A Mermaid is half fish and half human. It has upper human body and lower fish body. When under water its upper part swims like a human while its lower part swims like a fish. Please explain how can it ...
2
votes
1answer
51 views

Keeping lists of Objects, some with, some without inheritance

Let's say I have two classes, Foo and ExtendedFoo where ExtendedFoo inherits from Foo. Foo has a method .getValue() which returns a number, ExtendedFoo also has .increaseValue() which adds to the ...
0
votes
2answers
687 views

I cannot understand the application of oops How can I develop the understanding of application of oops? [closed]

I am a developer in PHP technology, I am aware of almost all the basics of OOPS, but still cannot find out the way to apply these concepts over a procedural programming. I do it in very orthodox way, ...
10
votes
5answers
20k views

Best way to load application settings

A simple way to keep the settings of a Java application is represented by a text file with ".properties" extension containing the identifier of each setting associated with a specific value (this ...
-1
votes
2answers
509 views

Object inheritance and method parameters/return types - Please check my logic

I'm preparing for a test and doing practice questions, this one in particular I am unsure I did correctly: We are given a very simple UML diagram to demonstrate inheritance: I hope this is clear, it ...
2
votes
1answer
188 views

Advantages of having numeric data types as classes rather than primitives [closed]

I was wondering about why some languages choose to implement numeric types (boolean, integers, floats, characters etc.) as classes/objects (eg. Kotlin) and some as primitive types (eg. Java). I am ...
0
votes
1answer
113 views

PHP OOP: value property is guaranteed different?

Imagine this code: class Test { public $result; public function makeSum($a,$b) { $sum = $a+$b; $this->result = $sum; } } In a webserver. At same exact moment, ...
0
votes
1answer
113 views

Access fields of super class from derived classes [duplicate]

There is an abstract BaseGame class that will be inherited by specific game classes. This class has an attribute requestHandler that will be used in all subclasses and should be initialized in the ...
0
votes
0answers
54 views

Should URL params and request params be stored in the Request object

Is it acceptable if GET parameters don't reside in the Request object, but in the URL? I am writing a small library in PHP, which is to represent the Request/Response as different entities and ...
8
votes
7answers
3k views

How to explain OOP to a matlab programmer? [closed]

I have a lot of friends who come from electrical / physical / mechanical engineering background, and are curious about what is "OOP" all about. They all know Matlab quite well, so they do have basic ...
4
votes
2answers
164 views

Why is it bad to have one mechanism for inheritance and subtyping?

It is quite well-known that (class) inheritance and subtyping (sometimes called interface inheritance) are different things: inheritance is a mechanism for sharing code, while subtyping is a ...
1
vote
6answers
184 views

Why do I need to map arguments to instance variables?

Class BankAccount: def __init__(self, accID, name, balance): self.accID = accID self.name = name self.balance = balance In the code above, why is it that I'm required to ...
23
votes
11answers
2k views

Does Refactoring towards Looser Coupling, Smaller Functions, and Separate Classes affect System Performance? (and Should I Care)

In Computer Science field, I have noticed a notable shift in thinking when it comes to programming. The advice as it stands now is write smaller, more testable code refactor existing code into ...
1
vote
2answers
218 views

Are any side effects not concrete side effects?

In Chapter 23 of "Object Oriented Software Construction" (1988), Betrand Meyer makes a distinction between side effects, concrete side effects, and abstract side effects. Meyer defines a side effect ...