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
70 views

How do you write super() in the UML format?Is it correct to write super(parameter: type): return type in the UML methods section?

Suppose you write a subclass that extends to a certain class and in that subclass, you use the super() method for your constructor. Would you write "super(parameter: type): return type" in the UML?
2
votes
1answer
210 views

For Object Oriented Programming purists, are @annotations heresy?

Philosophical Question: An issue that occurred to me is that especially when using frameworks like Spring or Hibernate ( which are everywhere in industry), we have annotate everything. This is ...
5
votes
6answers
276 views

Rule of thumb for deciding which class a method belongs to

For example, imagine a website which stores results about a certain sport or game, which has a typical "season" structure, such that there's both a Player and a Season class. To retrieve a player's ...
0
votes
1answer
108 views

Design patterns for ERP software with clients and web service

I'll will make ERP software for managing data for business activities. The solution must have two big parts: a WPF application for all the clients and an ASP MVC Web API application for all the client....
6
votes
3answers
386 views

Best practices for using public, protected, private?

Is it fair to say that it is good practice to default everything to private up front when coding something? And then only upgrade it to protected if a subclass needs it, or public if another class ...
1
vote
2answers
154 views

How to store state data when the data is related to another entity?

In order to increase the parallel-ability of my objects, I try to make them read-only and include only data that naturally belong to the entity. I have class Object { ... }; class Processor { ...
7
votes
3answers
554 views

Should every object know how to present/draw themselves?

David West in his book Object Thinking (chapter 10, section 1, sub-section 2) proposed that in an ideal OO environment, every objects should be capable of presenting themselves upon request; be it to ...
1
vote
2answers
78 views

Is it good design to log something related to an object from the callee?

I am designing a class whose object is instaniated with a user idn which creates a pdf with that user specific details. It should log something depending on success or failure which can be determined ...
0
votes
5answers
253 views

Is there a better way to debug while avoiding getters/setters?

I'm thinking about how to debug better without using Getters/Setters. If it helps, I program using xcode. Many answers in Stack Exchange have argued against Getters/Setters for lack of encapsulation (...
4
votes
1answer
45 views

Logging multiple objects for various reasons, then grouping by that reason

I'm having trouble cleaning up my code, and was wondering if there was any sort of pattern that I'm not aware of that can help me in this situation. I need to process a list of objects in various ...
3
votes
2answers
214 views

Using MVC style, where is the best place to put SQL functionality?

I am wondering about best practices here. MVC (Model - View - Controller) patterns involve separating components of your program that model the data, manipulate those models, and display those ...
5
votes
4answers
298 views

Why instantiate an object to a Base class rather than a specific Sub class?

For example: URL blogFeedUrl = new URL("http://manishmaharzan.com.np/getJSON/json.json"); HttpURLConnection connection = (HttpURLConnection) blogFeedUrl.openConnection(); connection.connect(); ...
1
vote
1answer
80 views

Split class into two or leave as one

I have the following class: internal class LeaveRequest : ServiceBase { private const string InvalidRequestMessage = "Specified Request does not exist"; private const string ...
0
votes
2answers
78 views

What is the accepted practice for handling numeric conversions under OOP?

I am making a weather app that involves temperatures. You can change between Kelvin, Celsius, and Fahrenheit just for fun. However, temperature figures get used all over the place in different ways. ...
-1
votes
1answer
102 views

Is there an official name for the “one object disease” anti-pattern (iterative single object operations on databases, services etc.)?

It is caused by the naive programming paradigm: focus on just a single object, do something with it, and if you have to work with many objects, you loop, iterate and traverse, repeating the operation ...
1
vote
3answers
82 views

Should I keep “redirect only” methods in my Controller?

Controller: function indexAction() { if ($condition) $this->renumPosition($id); //LINE #1 } //Redirect only - function's sole purpose is to call another function function ...
6
votes
2answers
154 views

Is there such a thing as a workflow pattern? or how to do a workflow properly?

(and alternatives to a workflow engine) Problem: I have various inputs with various attributes. For example {name: john, country: US} and {name: Jose, country: MX} And I have the following workflows ...
-1
votes
3answers
193 views

What to do with database foreign keys in an entity class?

I know that an attribute defines the state of an object. So, is it correct to keep attributes that don't define the state of an object of a class? For example, I have an Employee class, which has ...
3
votes
6answers
316 views

Can we say “If a parent class never appears in my codes except in its child class, it should be composition instead of inheritance”?

I read some posts about "composition over inheritance","where to use composition/inheritance" , "Is-a relationship..." or "Liskov substitution principle" for some time, but I am not sure if I get the ...
2
votes
2answers
110 views

Should we add an extra class to this code sample

I have a shopping website which allows users to place orders. In my web application when the users click 'Create Order' i call an OrderService class which looks like the below: public class ...
0
votes
4answers
255 views

How to convince “old” co-workers of the merits of OO for certain applications [closed]

I am working as SAP developer, where in many cases you have traditional requirements to applications (reports): Read in some data from the database or a file Do some magic with that data, e.g. do ...
1
vote
1answer
108 views

Alternatives to anonymous class

In the language I work with, Progress OpenEdge 11.5.1, there is nothing like anonymous classes. However, the system design would really benefit the use of such classes. Is there some nice known way ...
2
votes
1answer
122 views

Are nested private classes considered composition?

Background I am considering a design that includes a public API class containing many nested private classes. I am doing this for the following reasons: Why private nesting? They will have no use ...
0
votes
2answers
199 views

Per my design requirements, does this design hierarchy seem reasonable?

Background Construction Note that I am using C# here, but it may not be necessary to provide input to my conceptual questions about design. Consider the following design methodology... I work at a ...
0
votes
3answers
274 views

Java constructors confusion? [closed]

public class example { private String one; private String two; public example(String one, String two) { this.one = one; this.two = two; } public static void ...
4
votes
3answers
195 views

What is the purpose of writing functions and methods? When should you make a snippet of code into a function or method?

I have a philosophical disagreement with one of my co-workers, and I'm trying to get back to basics here. What is the purpose of a method? In this question, consider this example. I was criticized ...
1
vote
2answers
163 views

Is a an object Necessary or can I still use a DataTable

I'm currently working on a fund project and I have it set up so I get the holdings from my database and store in in to a DataTable to process. I've created a function where my Database results are ...
19
votes
5answers
4k views

Is it okay for a class to use its own public method?

Background I currently have a situation where I have an object that is both transmitted and received by a device. This message has several constructs, as follows: public void ReverseData() public ...
0
votes
0answers
99 views

How do I replicate my object-ish style from Python into Golang?

I've been going around in circles on this for a while Googling and reading, time to ask experts. When coding my common approach is to create a type of thing and add it to some sort of list with ...
4
votes
3answers
70 views

Using Multiple 'Sub-types' vs a larger single type?

I have a user model in an application that I'm working on, which currently uses sub-types to encapsulate properties depending on what type of user you are - I just can't help but think that this is ...
8
votes
4answers
2k views

Why would passing objects through static methods be advantageous?

Why would there be an advantage to use a static method and pass the reference to an object as a parameter rather than calling the method on an object? To clarify what I mean, consider the following ...
3
votes
1answer
116 views

Avoiding tightly coupled class definitions in Python for has-a relationships

I have the following code: class Car(object): def __init__(self, my_id): self.my_id = my_id self.color = color self.brand = brand self.get_color() self....
1
vote
1answer
135 views

Is it sensible to write a wrapper to use an OO library in this procedural project?

I am writing a program using a procedural style. At most I have some modules where the logic is present (one to retrieve data from, one to display the info, one with the saving logic, etc.), but my ...
242
votes
17answers
18k views

Why have private fields, isn't protected enough?

Is the visibility private of class fields/properties/attributes useful? In OOP, sooner or later, you are going to make a subclass of a class and in that case, it is good to understand and being able ...
9
votes
3answers
290 views

Are Python mixins an anti-pattern?

I'm fully aware that pylint and other static analysis tools are not all-knowing, and sometimes their advice must be disobeyed. (This applies for various classes of messages, not just conventions.) ...
-1
votes
1answer
133 views

Does this pattern have a name?

I have a large XML file that I extract information from. I am extracting the information using a list of classes with a main method of the type ParsedValue[] GetValue(BigXmlFile). This is a bit like ...
11
votes
4answers
903 views

Why is there no consistent definition of essential concepts to OOP?

I am very new to coding and a bit confused from reading\hearing different conventions from different sources: Does Object-oriented programming have 4 or 5 concepts? As a newcomer, I understand these ...
5
votes
1answer
458 views

Are we abusing static methods?

A couple of months ago I started working in a new project, and when going through the code it stroke me the amount of static methods used. Not only utility methods as collectionToCsvString(Collection&...
5
votes
2answers
87 views

Should Modelling Document Analysis?

I use UML I, like most (I think), use UML as my main diagramming toolset. UML is clear and useful for representing OOP and has sufficiently diverse diagrams that there is something for whatever area ...
1
vote
2answers
301 views

Multiple instance of the same class?

I have a class named "Category" to handle all the operations and data about my categories. Now, my class is created however I need to find a way to build an object for each of the categories in my ...
1
vote
4answers
109 views

File-Directory Implementation: Does a a file have to own a reference to it's dir?

I am currently issuing a problem while forming the program-design, which is exact like a File-Directory relationship, and to ease it, I am using that as an example. I think it is usual, that a ...
2
votes
2answers
81 views

How do I decide whether to make an Input/Output data type an array or a class?

I have some input that I send to a computational library, which processes the input and produces some output. Question: What considerations do I take into account to help me decide whether the ...
4
votes
1answer
209 views

Do I have to stop using Dependency Injection to keep object debug printouts small?

Say I have a large object - think EntityManager of an ORM such as Doctrine, or a custom DAO object, or what have you. Object, output of which is required to be used inside a class, but the object ...
1
vote
2answers
135 views

Safety of magic setters in PHP

I don't know how in else languages, but in PHP seems to me that they are very unsafe way how to set value of any member variable - because one setter cannot easily validate input for many variables (...
3
votes
1answer
97 views

PHP OOP, structuring my objects properly

I have an architecture similar to this: User (Name, Email, ID...) ---- Studios (Name, Location, Description...) ---------- Videos (Title, Description, URL, Length, Views...) Simply put, a user can ...
1
vote
0answers
58 views

Creating duplicate instances of objects for timeline functionality

I am working on a Spring-MVC based project, in which I would like to add Timeline functionality. The most important object in our project is the Note, there are objects associated with it like ...
7
votes
2answers
257 views

Object reading from file, violation of SRP?

I am writing a physics simulation program in C++. I am a novice in OOP and C++. In my program, several objects need to be initialized based on data from an input file. For example, an imaginary ...
1
vote
0answers
138 views

OOP - Modeling a Chat Design Review [closed]

Seeking thoughts on the following design. I know the design could be lot simpler if use Sockets. But I wanted to think of a design with pure POJO classes. User string id; string displayname; ...
1
vote
5answers
155 views

Can variable names match field names? [closed]

Microsoft suggested that variable names should not match field names. However I saw this extensively in Java (e.g., this tutorial), especially in setters and constructors. So, among these two styles: ...
3
votes
1answer
320 views

Bad c++ code design? [closed]

This is bothering me a long time. I feel like I am doing mistakes on the code design relative to the performance. I never had any teacher to indicate my mistakes so its hard to me to make it right in ...