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)

15
votes
8answers
4k 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 ...
15
votes
5answers
917 views

Is SRP (Single Responsibility Principle) objective?

Consider two UI designers who want to design "user attractive" designs. "User attraction" is a concept that is not objective and only resides in the mind of designers. Thus designer A could for ...
13
votes
7answers
1k views

How do you keep track of large projects?

When dealing with a project that has many different files, I always seem to loose track of how the parts interact with one another. I've never really had much of a problem understanding smaller ...
11
votes
4answers
2k views

Object Oriented Programming: getters/setters or logical names

I'm currently thinking about an interface to a class I'm writing. This class contains styles for a character, for example whether the character is bold, italic, underlined, etc. I've been debating ...
11
votes
3answers
2k views

Class Versus Struct

In C++ and other influenced languages there is a construct called Structure (struct), and another called the class. Both are capable of holding functions and variables. Some differences are: Class ...
2
votes
2answers
189 views

Problems with OO design for application with pluggable components

I'm trying to refactor an ugly code and make it easly extendable in the future. The application should be nothing else but a series of components that have input(s) and output(s). The components ...
0
votes
2answers
9k views

Simple real-world PHP OOP example?

I'm trying to learn PHP OOP, but when I've followed tutorials, all the examples seem to involve things like: class Human { $_sex; public function setSex($sex) { $this->_sex = ...
15
votes
4answers
903 views

best way to “introduce” OOP/OOD to team of experienced C++ engineers

I am looking for an efficient way, that also doesn't come off as an insult, to introduce OOP concepts to existing team members? My teammates are not new to OO languages. We've been doing C++/C# for ...
11
votes
6answers
700 views

What changes are too big to be made easy by proper design?

This is a rather vague question, but it's something I've never felt has been answered in a satisfactory way when reading about proper design. Generally, when learning about Object Oriented ...
11
votes
1answer
974 views

Why did object-oriented paradigms take so long to go mainstream?

I read this question and it got me thinking about another fairly recent thing. Object oriented languages. I'm not sure when the first one was created, but why did it take so long before they became ...
11
votes
4answers
960 views

Nested Classes: A useful tool or an encapsulation violation?

So I'm still on the fence as to whether or not I should be using these or not. I feel its an extreme violation of encapsulation, however I find that I am able to achieve some degree of encapsulation ...
10
votes
3answers
2k views

What is the principle of least astonishment?

In programming what is called Principle of Least Astonishment? How is this concept related to designing good APIs? Is this something applicable to only object oriented programming or does it permeate ...
8
votes
5answers
2k views

Functional programming readability

I'm curious about this because I recall before learning any functional languages, I thought them all horribly, awfully, terribly unreadable. Now that I know Haskell and f#, I find it takes a little ...
8
votes
9answers
3k views

Does object-orientation really affect algorithm performance?

Object orientation has helped me a lot in implementing many algorithms. However, object-oriented languages sometimes guide you in "straightforward" approach and I doubt if this approach is always a ...
8
votes
8answers
3k views

OOP technology death [closed]

I've heard many times about the aspect-oriented programming, mostly that it is the "next generation" technology in programming and is going to 'kill' OOP. Is it right? Is OOP going to die or what ...
7
votes
11answers
1k views

What language should be used to teach object-oriented design and development in university?

My understanding is that C++ is usually offered as the 1st OOP language, and as the 2nd programming language (after C) in my country (Bangladesh). I've taught it several times, and the problem I've ...
6
votes
5answers
9k 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?
5
votes
5answers
692 views

Should I always encapsulate an internal data structure entirely?

Please consider this class: class ClassA{ private Thing[] things; // stores data // stuff omitted public Thing[] getThings(){ return things; } } This class exposes the ...
5
votes
4answers
567 views

How much effort should I invest in creating loosely coupled designs?

I am currently learning about design patterns. I think most people would agree that these patterns are great tools, but should be used with moderation and not as the answer for everything. Using them ...
5
votes
3answers
3k views

Should I use friend classes in C++ to allow access to hidden members?

Here is my situation (a simple example). Say I have a class called HiddenData Then I have another class called StoreHiddenData And finaly a class called OperateHiddenData Here's the thing, my ...
4
votes
3answers
2k views

Injecting dependencies (DI) in c++ applications

I am playing with dependency injection, but i am not sure I am doing it right. Especially, I am not sure what should be the correct way to build classes with injected dependencies. Say I have a class ...
3
votes
2answers
656 views

Implementing the Interface Segregation Principle

Does this IConvertible interface satisfy the Interface Segregation Principle (ie. the "I" in SOLID)? Here is the definition: public interface IConvertible { TypeCode GetTypeCode(); bool ...
3
votes
7answers
1k views

Inheritance using non-abstract base class

This post is based on the question http://stackoverflow.com/questions/49002/prefer-composition-over-inheritance/11758048#comment15634305_11758048. Some people said - check whether there is “is-a” ...
3
votes
4answers
645 views

Using lambdas to improve encapsulation

Just as many people believe tenaciously in small functions, some people believe lambdas should only contain small code fragments. An often overlooked advantage of lambdas however, is using them you ...
2
votes
3answers
2k views

Specific reasons to create own array class over using std::array?

What specific conditions or requirements should you create your own array over using std::array? Here is my background: I'm developing a small simple library that a small group of people will use ...
2
votes
7answers
1k views

Architectural patterns for interaction beyond MVC? [closed]

We all know the venerable Model-View-Controller pattern used to design interaction [mostly] with human users. It is the de-facto standard in OOP environment. What are some other architectural ...
1
vote
4answers
761 views

How do you evaluate learning C# from videos for a beginner? [closed]

I have an idea about programming in general so I know what a variable and a method is but I didn't program before. I liked C# because of Visual Studio and I only tried Hello word program in it. I ...
16
votes
3answers
1k views

Newbie question about Decorator design pattern

I was reading a programming article and it mentioned the Decorator pattern. I've been programming for awhile but without any kind of formal education or training, but I'm trying to learn about the ...
15
votes
11answers
808 views

Have objects delivered in terms of code reuse?

I have often heard it said that objects have not delivered in terms of code reuse. Do you agree? If you believe that they haven't, why not?
9
votes
4answers
466 views

How to avoid general names for abstract classes?

In general it's good to avoid words like "handle" or "process" as part of routine names and class names, unless you are dealing with (e.g.) file handles or (e.g.) unix processes. However abstract ...
9
votes
2answers
874 views

Paradigms fit for UI programming

This is a more specific question (or actually two, but they are related) coming from the comments of OOP technology death where someone stated that OOP is not the right paradigm for GUI programming. ...
7
votes
4answers
326 views

Is Visitor Pattern valid in this scenario?

The goal of my task is to design a small system which can run scheduled recurring tasks. A recurring task is something like "send an email to administrator every hour from 8:00 am to 5:00 pm, Monday ...
6
votes
2answers
447 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 ...
6
votes
7answers
2k views

What exactly is OO reuse?

And why is it often talked about? Like I know what OO programming is obviously... but people always say "Oh OO reuse is the biggest programming myth ever". What exactly does this mean?
6
votes
15answers
2k views

Why OOP is enforced in Java and C#? [closed]

In many other languages like C++ and Javascript, OOP is optional. Procedural code is ok. But in languages like Java and C#, OOP is somewhat enforced. Everything is to be a part of a class or an ...
6
votes
3answers
1k views

Why make JavaScript class based?

JavaScript is a prototype language. To turn it into a class based language adds little value? I am not talking about best-practice here. I remember reading an article from way back, which claimed that ...
5
votes
3answers
630 views

OO - are large classes acceptable? [duplicate]

Despite many years in IT, I still struggle with OO design. One particular problem I seem to keep ending up with is large classes, often containing many hundreds of lines of code. The OO world talks a ...
5
votes
5answers
871 views

In C++, is it a reflection of poor software design if objects are deleted manually?

With the advent of smart pointers, is it a sign of poor design if I see objects are deleted? I'm seeing some software components in our product that people are still doing this. This practice strikes ...
4
votes
6answers
420 views

Do you have to have boxing of primitives in OO language?

Is boxing of primitives required in OO languages to keep them consistent with the rest of the object system (generics etc.)? Or is it avoidable - is it possible to avoid any additional performance ...
4
votes
2answers
293 views

Single responsibility vs procedural programming [duplicate]

Single responsibility (from SOLID) is like making me create classes with only one public method. But if it's so, it would be possible use static methods, and go back to procedural programming. What's ...
4
votes
3answers
380 views

MVP Pattern Philsophical Question - Security Checking in UI

I have a philosophical question about the MVP pattern: I have a component that checks whether a user has access to a certain privilege. This privilege turns on or off certain UI features. For ...
3
votes
3answers
546 views

Why not apply Interface Segregation Principle to “extreme”

Providing that clients would typically consume just one method, though methods would be conceptually related, why not always apply the Interface Segregation Principle to the extreme and have [many] ...
3
votes
1answer
301 views

Object Calisthenics - reducing to two attributes

I'm refactoring an expense tracker system using Object Calisthenics. I'm able to bring my Class down to five attributes. How do I go forward from here? This is my class right now. public class ...
3
votes
3answers
2k views

Is the singleton pattern prone to thread safety problems?

Is the singleton pattern prone to thread safety problems? If so, what are the best methods to work around them?
3
votes
2answers
648 views

Using Map in Java (or other strongly-typed languages) to work with unstructured data

After looking at the core data type for frameworks that deal with unstructured data in java: json java library: JsonObject Mongodb java api: BasicBSONObject SolrJ (Solr java client): SolrDocument ...
3
votes
1answer
2k views

Non-OOP languages advantages and good uses

I'm a C# developer, but I also know Java, JavaScript, XSLT, a little of C and Perl, e some other that I may have forgotten. Still, the paradigm I'm most familiar to is OOP. I have always thought ...
2
votes
2answers
336 views

Initialization of objects in a system using dependency injection

This is a follow up question to the following post: Injecting dependencies (DI) in c++ applications In a system that uses DI, someone, somewhere should be responsible to create the various objects ...
2
votes
1answer
1k views

Where should variables be declared [duplicate]

Considering I have a for loop in a method of a class. Should the incremented variable be declared as member of the class, or should it be declared in the method it uses it(or even in the for loop, ...
2
votes
3answers
359 views

To store data or not?

I'd like to ask you about one simple thing. I have class A that do something (for example counts something ). There is also one class B that handle some parameters to this class (class A is member of ...
2
votes
3answers
2k views

How to handle large scale js+jquery projects using well written, Object-Oriented JavaScript and jQuery code? [closed]

I love the whole user experience/interface thing and put a lot of jQuery and JavaScript (pure JavaScript for HTML5 stuff, like canvas, file API, etc). The problem I face now is that my codes are ...