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
3answers
103 views

Should abstract classes be used to prevent instantiation

Is preventing the instantiation of a class a valid reason to make it abstract? For example, if I have a class called Gauge which has subclasses HeadingIndicator and AirSpeedIndicator, is it a good ...
2
votes
1answer
84 views

Creating variables in methods/functions

In how far do we create variables in our methods or functions? Do we only create one when we're using the result of the variable more then one time like this? function someFunction(SomeClass ...
1
vote
4answers
206 views

When is it not acceptable to model physical world objects with classes?

Does Object Oriented Programming Really Model The Real World? [closed] also "Firstly, A represents an object in the physical world, which is a strong argument for not splitting the class up." ...
1
vote
1answer
43 views

PHP MVC Display many records - model logic

I bet this question has been asked already but I can't form my thought as you can see from the title, so I couldn't find anything. I am working with MVC for quite some time now and I'm pretty happy to ...
2
votes
1answer
81 views

Proper way to refactor multiple if based conditions [duplicate]

I took over a large legacy code base. It has a code like this: if ($route == 'login' || $route == 'logout' || $route == 'forgot-password') { return; } if ($loggedInUser == false && ...
0
votes
1answer
41 views

Database properties as Interface Constants in PHP [on hold]

I bought a PHP Design Patterns book, and the author uses constants to hold connection attributes: interface IConnectInfo { const HOST = "localhost"; const UNAME = "root"; const PW = ...
-1
votes
0answers
48 views

Is partial application of functions the corresponding technique for state saving objects?

Imagine we have Converter object which is responsible for converting Strings in different ways, e.g. with convertingMethod1 and convertingMethod2. As the Converter depends on some context, it also ...
15
votes
6answers
863 views

Does functional programming increase the 'representational gap' between problems and solutions? [on hold]

Since machine language (e.g., 0110101000110101) computer languages have generally evolved to higher forms of abstraction, generally making it easier to understand the code when it's applied to a ...
2
votes
1answer
182 views

Why do mainstream OO languages not have immutability on class-level built-in? [duplicate]

I regularly write classes which can only have immutable instances, much like string. I am wondering why Java or C# or VB.NET don't have immutability built-in into the language? That way, I can ...
0
votes
1answer
62 views

Condition before statement or statement in condition

I've come across this problem a few times: Is there any "programming rule" for checking for an condition (error checking for example) before you want to do execute code, or only execute the code when ...
-1
votes
0answers
34 views

Binary Search scheme alteration [closed]

I'm having a bit of an issue with programming an algorithm..... below would involve some of the details of the assignment; now before you begin to say that I should actually attempt, in solving this ...
0
votes
3answers
77 views

Heuristics on when should one subclass and when not [closed]

Are there any good tips, when one should subclass and when should not? It's clear that we should not subclass when we want to reuse a single method of some class we override all methods, changing ...
5
votes
1answer
110 views

How to use OO Design to Refactor a Library with Functions that are specific Product-aware

I have a class that acts as a library of functions for various products. To compute its data, the function currently needs to be aware of all product names. Depending on which product calls the ...
-3
votes
0answers
40 views

abstraction and encapsulation example [closed]

lets say we have a mobile phone. We are listening to music on that damn thing but we are not concerned about how the phone plays the music.This is abstraction Now,the way the phone plays the music is ...
-1
votes
1answer
93 views

Why is it said that a class represents an abstraction? [closed]

I think that abstraction represents only the essential things needed for the purpose as there are so many unnecessary properties. So why is it said that a class represents an abstraction?
8
votes
5answers
2k views

class in OOP language and type

In programming language theory, a type is a set of values. E.g. the type "int" is the set of all integer values. In OOP languages, a class is a type, is it? When a class is defined with more than ...
2
votes
2answers
105 views

Initialize physical resources in constructor

Is it an acceptable practice to initialize physical/external resources from a constructor when the resource is needed for the object to do it's work? For instance, let's say I wanted to create an ...
-4
votes
1answer
150 views

object oriented programming vs. object oriented design [closed]

We know what is object oriented programming but my question is: What is the difference between object oriented programming and object oriented design?
4
votes
4answers
294 views

Does Object Orientation require the concept of inheritance? [closed]

I read Object-Oriented Analysis and Design with Applications Notes written by Grady Booch. In the book there is a sentence: There are three important parts to this definition: (1) Object-oriented ...
2
votes
2answers
119 views

Can a class method be accessed both in an instance and statically?

I am relatively new to class design and I have a task that I'm not sure how best to complete, or whether my idea in general is a code smell. I'm developing a RPG where people can own monsters, so ...
0
votes
4answers
207 views

How should nodes in a chain be connected?

Suppose you were building a system that receives data on one end and sends filtered data on the other end. The system is a chain of nodes, each receiving data from the node before and sending ...
1
vote
4answers
150 views

What is the efficient way to eliminate duplication? Design patterns?

I have a helper class which has a method that perform some checks against a field in a model. I have two models, ModelA and ModelB, they have some similarities but not all. One of them is they both ...
0
votes
1answer
153 views

Interface or boolean?

I have a CustomObject class which has the abilities like being Clickable, KeyPressable and Movable. I created interfaces: IClickable, IKeyPressable and IMovable and make different CustomObject classes ...
1
vote
2answers
70 views

Parsing input into multiple subclasses

Lets say I have 10 xml message types that come into my program via some type of input (file, port, etc). I have 10 subclasses of a type Message to handle the unique needs of each message type. When a ...
2
votes
3answers
150 views

Good or bad idea to create a “fromJSON” static factory constructor for an object that is often created by parsing a JSON coming from API?

I have a "Product" POJO class in my app. A Product object can either be created in-app by the user or by parsing a json that comes from the API. Product has 20+ fields, but Im using only 2 here for ...
1
vote
1answer
103 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. ...
1
vote
0answers
124 views

How to separate out below tightly coupled classes

I have two classes which are somewhat tightly coupled to one another. Lets call them A and B. A derives from C and B derives from D. B is the class whose instance is created by the system and then B ...
1
vote
1answer
32 views

Splitting single Class into multiple Classes

I am writing automated test scripts with Selenium Webdriver (Python) and I try to follow the correct programming practices, specifically the Object Oriented methodologies, where possible. At the ...
1
vote
0answers
37 views

Combining Patterns: Fluent Builder and Null Object Pattern

I am currently wrestling around with some GUI code where I have a table whose rows correspond to some object, let's say a Person object. When the table initializes, it fills the table with the Person ...
1
vote
1answer
128 views

How to represent “class” data type in C or any low level language? [closed]

I'm writing a simple language compiler,currently it's support functional programming only. I want to support OOP concept, but I don't know how exactly I can represent an object ? just where to start ...
0
votes
2answers
198 views

What's the benefit of having everything as an object in dynamically typed programming language? [closed]

modern dynamic programming languages like Python, Ruby and Javascript all take the approach of treating everything as an object, what's the benefit of this approach, and what's the curse of it? ...
3
votes
1answer
102 views

Unit testing a template class after refactoring

I am cleaning up my code by way of removing duplicates, and found two classes that were almost identical, out of 55 lines, only a single predicate in an if statement differed between them. Both ...
1
vote
1answer
98 views

Where to put data for tree structure which every node requires?

I have a quad-tree structure where each node has some of its own data, but there is also data which applies to the tree as a whole. I'll explain my current solution and I would appreciate feedback on ...
-1
votes
2answers
94 views

In plain English, what is an object model? [closed]

I read about objects models on Wikipedia, but it is too abstract to really make much sense to me. Can someone explain what an object model is in plain English?
2
votes
1answer
143 views

Why do class-based OO-languages always use the keyword `new` to create an object? [duplicate]

I do not know much about OO-languages, but from what I have seen, it seems most class-based OO-languages uses a keyword new (or something equivalent) to create an object. Prototype-based OO-languages ...
1
vote
3answers
142 views

Does overriding a method affect a superclass's call?

I'm trying to understand some of the nuances of inheritance but I can't find an answer to this question. Consider the following: class SuperClass { method foo { print "in SuperClass.foo" ...
25
votes
7answers
2k views

What are the caveats of implementing fundamental types (like int) as classes?

When designing and implenting an object-oriented programming language, at some point one must make a choice about implementing fundamental types (like int, float, double or equivalents) as classes or ...
2
votes
4answers
237 views

Two classes that behave identically yet are semantically different

I am writing a program which is a similar to Ruby's Active Record Migrations, in which that every migration has both an "Up" and "Down" in terms of creating a change to the database, "Up" meaning ...
3
votes
3answers
147 views

What is the correct Object Design/Architecture for the following scenario?

I am developing some custom controls in an Object Oriented language (using Swift/Cocoa but this is a technology agnostic question). In particular, I have a horizontal and vertical set of buttons that ...
0
votes
3answers
56 views

Event Driven Objects/Framework on the Web [closed]

I am a desktop developer moving to web development. The guys who I am working with use procedural PHP, and coming from an event driven, objectified perspective (using WPF and C#.Net) I am completely ...
1
vote
2answers
83 views

How do you decide member objects?

So OOP is about breaking down functionality, making each class responsible for one thing etc. But let's take the example where an object is using another object. First thing that comes to mind ...
0
votes
3answers
113 views

where should put showSchedule method in school system

In my school management system I have this partial class diagram: 1- In one use case student want to see his schedule of classes in week. this is what i suppose to do: get student object from ...
2
votes
5answers
324 views

When I should add another non-static class?

How do you decide if you need a new non-static class (maybe when you are developing or after it)? The question is two part: Why another class? Why not an static class? New static classes and ...
1
vote
2answers
113 views

many to many relation in database schema and oop class diagram

I have Student and Group entities. Student can have many groups and Group can have many students too. so in database I should have middle class and change many-to-many relation to one-to-many and ...
9
votes
7answers
2k views

How did OOP evolve to include the notion of Properties

I've come from a C++ background and am going all out C# in my current job and I've just been reading a lot of Q&A about what's the difference between public fields and properties and all the back ...
12
votes
3answers
2k views

Non-Object Oriented Programming in Object Oriented Language [closed]

Recently I was assigned a task of creating a calculator with functions addition, subtraction, multiplication, division and power using Object Oriented Programming. I successfully completed this task. ...
3
votes
3answers
356 views

How to use multiple programming languages together in the same program? [closed]

Such a simple question, but I have not found a reasonable answer to this. I currently program in Python, an interpreted language. I always hear of people using multiple languages in the same program? ...
5
votes
2answers
260 views

Where did the three tenets of OOP originate

It is easy to find the origin of the term OOP coined by Alan Kay when he created Smalltalk, but I can't find if when creating the language he also created the 3 tenets of OOP (Encapsulation, ...
4
votes
2answers
436 views

What are the valid uses of static classes?

I noticed that nearly every time I see programmers using static classes in object oriented languages such as C#, they are doing it wrong. The major problems are obviously the global state and the ...
3
votes
4answers
270 views

What programming mindset to have towards JavaScript? [duplicate]

I used to program in Java. As a result of that I got well-versed with Object Oriented Paradigm. In my opinion it is a great approach to programming because it's easy to unit test, use design patterns, ...