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 (2)

1
vote
3answers
75 views

When to store values in constants/finals

This might seem like an odd question, but I'm worried that I'm putting too many things as constants/finals at the top of my java class. I've started to put every value that is in my program into a ...
7
votes
2answers
249 views

Is there a specific name for the “Square inherits from Rectangle” paradox?

A certain failure of OOP is shown with a class Square inheriting from Rectangle, where logically Square is a specialization of Rectangle and should therefore inherit from it, but everything falls ...
0
votes
3answers
84 views

What concept am I missing with private methods and testing? [duplicate]

I've read a lot o blogs arguing about private methods and testing. Some people say you should not test private methods, they say you should make them public or put those methods in a new class. But ...
5
votes
2answers
206 views

Is it good to have an interface plenty of methods which belong to different concepts, just to preserve the Liskov's Principle?

I'm currently studying a course based on Software Design and I had a discussion in class with my professor and some classmates about a problem represented by the next scenario: Scenario Imagine ...
2
votes
1answer
77 views

Run Time Type Identification using Composition

It is said that programmers should prefer composition over inheritance. I was wondering if RTTI can be achieved as easily using composition.
7
votes
2answers
254 views

What makes OOP “good”? [duplicate]

It's fairly obvious that OOP is viewed as a sort of silver bullet of programming today. In any computer science course, the merits of OOP are heralded. I would like to know why people like OOP. To be ...
-4
votes
2answers
342 views

Why is C++ preferred over C for commercial applications? [closed]

I program in C mostly. However, it is pretty obvious that many more commercial applications are done in C++. As far as I can tell, C++ is a very complex language, with seemingly convoluted syntax and ...
0
votes
0answers
10 views

Not defined variables display [migrated]

So here is an issue: We have a pretty large CMS for fleets and sometimes people leave some optional input fields as blank, displaying that information on the screen really doesn't help anyone, and ...
10
votes
3answers
295 views

Object Oriented Programming in JavaScript. Is there life without it? [duplicate]

At our company we have pretty large body of PrototypeJS based JavaScript code, which we are porting to jQuery for several reasons (not really important here). I'm trying to set up coding guidelines to ...
2
votes
6answers
317 views

Naming functions that retrieve a value

I have this personal rule to start all function/method names with a verb. My verb of choice for functions or methods that get a value based on some data structure or object is get. I'm wondering if ...
0
votes
0answers
37 views

php OOP - cant change value from outside class [migrated]

this is my first attempt with oop i want to modify some values from a class, but i can't figure out how to do that from a different file / if i try to do that from where i have the class is working ...
64
votes
18answers
4k views

Is it poor programming practice to pass parameters as Objects? [duplicate]

So, we've got a guy who likes to write methods that take Objects as parameters, so they can be 'very flexible'. Then, internally, he either does direct casting, reflection or method overloading to ...
2
votes
2answers
111 views

MVC framework that uses classes instead of methods for actions

In most MVC frameworks, Controller class contains multiple methods, each representing one action. Then annotations and reflection is used to call those methods appropriately. But from OOP point of ...
-1
votes
2answers
41 views

Beans, DTOs, & Non-Internal Classes as Data in General - Acceptable or OOP-Murdering Antipatterns? [closed]

Am I not understanding encapsulation? What's with all this data out in the line of function-spaghetti disguised as one-method classes fire? Beans and DTOs are everywhere. Isn't it better design to ...
4
votes
1answer
88 views

Xerox SOLID example in PHP

There is a good example on Wikipedia regarding the violation of SOLID principles. The ISP was first used and formulated by Robert C. Martin while consulting for Xerox. Xerox had created a new ...
0
votes
3answers
220 views

The similarities between Functional Programming & Object Oriented-Imperative Programming? [closed]

The heading couldn't say it anymore better. I understand the differences between the paradigms but i would like to know the similarities between them. I'm looking for things that affect the program ...
1
vote
2answers
117 views

How to make big chunk of hardcoded menuitems in a programmable way

So in the javascript app, we have a lot of repeated chunk of menu items with the specific settings: URL, Name, Title, etc etc (these settings sometimes can be optional). Here is the gist of the ...
1
vote
2answers
168 views

Statistics collection engine for C++ systems

We have a research project with idea->prototype->statistics development cycle. Anyway, our final product is a prototype, so the statistics collection suite is not used persistently. Supposing I have ...
6
votes
7answers
287 views

Chain class behaviour

I have a Bird class. A bird can learn and a bird can fly (methods). A bird can only fly after it learns. Considering both methods are public. How can you make this clear to another fellow developer. ...
1
vote
2answers
172 views

Object Orientation done right with PHP [closed]

I've started to work with web development using PHP as server side programming language. In that time I didn't know the benefits of object orientation and had a hard time trying to write more ...
2
votes
2answers
110 views

Where should I parse data obtain with a DAO

I have a DAO that brings data from a web service, that data comes in a string, in the likes of: *NAME|John Doe *DATEOFBIRTH|1978-23-01*ID|anID123 (...) I have a DTO that I wanna fill up with the ...
1
vote
2answers
104 views

Search and Replace in MVC

What would be a good MVC/OOP/GRASP/SOLID structure for a search/replace functionality. Methods: search/searchNext/replace/replaceAll. I'm interested only in the PHP arhitecture and how a professional ...
3
votes
7answers
338 views

OOP (php) for beginners - some unclarities

I started reading some tutorials about OOP, because I want to learn the basics. I have a question about it. I understand how you can have a object "Car" and give it a color like this ...
-1
votes
0answers
7 views

java script date popup is not working in firfox [migrated]

The following is the function for date selection. The code is working in IE but it is not working in Firefox. The problem coming at selecting a day.iam not able to select a day in Firefox. function ...
1
vote
3answers
131 views

Is there any situation when there's no alternative to instanceof?

It seems to me that instanceof comes from the land of functional programming and is a watered down version of pattern matching and that the OO altenative to it should be dynamic dispatching. In OO ...
2
votes
6answers
430 views

OOP principles and method names

class Boxer: def punch(self, punching_bag, strength): punching_bag.punch(strength) class PunchingBag: def punch(self, strength): print "Punching bag punched with strength", ...
6
votes
4answers
334 views

Besides polymorphism, what's compelling about OOP? [duplicate]

When I first came to OOP (at first in Java, and then C++) after years of working in C and VB, it was amazing. The idea of extending existing behaviour and operating generically over things of related ...
-2
votes
1answer
221 views

Object-Oriented Programming With ANSI-C [closed]

I am trying to expand my understanding the history and involvement of OOP. Recently I have been looking into OOP in ANSI-C, which is described in Object-Oriented Programming With ANSI-C by Axel ...
0
votes
2answers
73 views

What is the convention regarding class names that may already exist in the ORM?

This is a generic question about class names and ORMs, but for context; I'm working on a Flask web app in Python using SQLalchemy. I'm struggling with naming a new class that will contain the ...
-4
votes
1answer
254 views

Is OOP becoming functional programming? [closed]

Every one knows immutability is the way to go - everyone recommends making your classes as immutable as they can be... but are immutable types still objects? I have doubt - to me there are simply ...
11
votes
2answers
547 views

General thought process for “How would you build this website/app” interview questions

I've collected a bunch of interview questions like "Describe how you would design a photo album application", "Describe how you would design this particular feature of this particular website" (e.g. ...
3
votes
4answers
284 views

Is it a good practice to create a ClassCollection of another Class?

Lets says I have a Carclass: public class Car { public string Engine { get; set; } public string Seat { get; set; } public string Tires { get; set; } } Lets say we're making a system ...
8
votes
3answers
360 views

Is a try and catch that does not throw an exception more efficient than a conditional?

I came across this example recently: If 999 times out of 1,000 an exception will not be thrown then the exception is only generated once. On the other hand a conditional would have been called ...
3
votes
3answers
272 views

Simple questions to test understanding of Dependency Inversion Principle

I am preparing a short (1-2 hour) presentation about DIP to several (~5) junior developers (1-3 yr xp) in the office. At the end of the presentation I want to know whether they understood what I was ...
4
votes
6answers
904 views

Is there any difference between interfaces and abstract classes that have abstract methods only?

Let's say we have an abstract class and let this class has only abstract methods. Is this abstract class different from an interface that has same methods only? What I am looking to know is if there ...
0
votes
1answer
146 views

JavaScript static methods retrieval

I have been thinking about it and wanted some feedback, recently I thought about doing it like this: function foo(){ if ( !foo.prototype.statics ){ foo.prototype.statics = { // ...
5
votes
5answers
467 views

Is there any difference between pointers and references? [duplicate]

References and pointers do the same thing as I know. Is there any difference between them? If there is no difference, why we call them reference not pointer?
2
votes
5answers
243 views

Do tools, like Windows Workflow, inhibit development growth? [closed]

I’ve had this gut feeling about Windows Workflow (WW) for a while now. And, until now, I couldn’t think of the right words to say in order to explain it. Since I think I have a good way to verbalize ...
10
votes
3answers
347 views

Dependency Inversion Principle: How to define “high-level policy” and “low-level detail” to other people?

I am trying to explain the dependency inversion principle to my (mostly junior) colleagues. How can we define which one is the "high-level policy" and which one is the "low-level detail" in a ...
0
votes
1answer
112 views

How does dependency inversion principle work in languages without interfaces?

In C#/Java, the dependency inversion principle is often demonstrated by high-level classes that depends on an interface/abstraction (that it owns). Low-level classes will implement the interface, thus ...
0
votes
1answer
179 views

Teaching `class`es and objects in C++ to university students

To learn classes and objects at my university, students are required to develop a simple game (nine-mens morris or something similar) using Java. Java is used because of its libraries and tool ...
6
votes
3answers
906 views

Why do some of object oriented languages let programmer use primitive types?

Why do some object oriented languages let the programmer use primitive data types? Aren't classes like Integer, Boolean, etc. enough?
8
votes
6answers
921 views

Should my code be DRY or readable if it can't be both?

I'm writing Ruby code for a simple encryption exercise and have frequently run across this dilemma (the exercise is a solitaire cipher if you must know). It is a question of whether I should pad out ...
2
votes
3answers
167 views

Factory Method: does the Product have to be a different class than the Creator?

I want to build three sites in PHP. I'm doing this as slowly, thoughtfully and carefully as I can, to learn as much about things like OOP and software architecture as possible. From past experience I ...
-1
votes
4answers
214 views

Immutable vs mutable object as returned parameter for class method [closed]

There is a class method (static method) in which I create and build some object. And for filling that object, I create it as mutable object. My mutable object is a subclass of immutable object. So ...
2
votes
2answers
203 views

Writing OOPS code in Non Object Oriented Language

I was reading some article on the internet as I was preparing for interview and I found out below statement- Writing object oriented code, even in non-object oriented language? Is this statement ...
10
votes
3answers
921 views

“Too object-oriented”

I come from a strong OO background, and I have recently started working in an organization which, although the code is written in Java, has a lot less emphasis on good OO design than what I am used ...
4
votes
3answers
312 views

Is it acceptable for child classes to “break” parent class functionality?

One of the devs that works with me is following the Open/Closed Principle to add functionality to a Model by extending from our framework ORM. class BaseModel extends ORM { ... } All our models ...
3
votes
2answers
158 views

java classes and database queries

Can someone please explain the best way to solve this problem. Suppose I have three classes Person Venue Vehicle I have a DAO method that needs to return some or all of these attributes from each ...
2
votes
2answers
187 views

What is a Service Locator?

I've heard the term pop all around. I've read various articles regarding the subject and heard two main definitions to the term "Service Location": A glorified Registry - Bad practice, global ...

1 2 3 4 5 15