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)

8
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 ...
7
votes
3answers
600 views

Unit testing time-bound code

I'm currently working on an application that does a lot of time-bound operations. That is, based on long now = System.currentTimeMillis();, and combined with an scheduler, it will calculate periods of ...
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 ...
7
votes
8answers
2k 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 ...
6
votes
5answers
6k 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
4answers
445 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 ...
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
626 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
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 ...
16
votes
3answers
997 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
786 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?
11
votes
4answers
871 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 ...
9
votes
4answers
457 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
768 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. ...
6
votes
2answers
379 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
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 ...
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
5answers
653 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
3answers
564 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
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 ...
5
votes
5answers
834 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
393 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
3answers
373 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
512 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
2answers
553 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
1answer
274 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
2answers
267 views

Single responsibility vs procedural programming

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 ...
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
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 ...
3
votes
3answers
2k views

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

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 ...
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
354 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
1k 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 ...
1
vote
1answer
112 views

Domain-specific Interfaces

Are there any real benefits of using interfaces over abstract classes in a domain model? Does anyone have any experience using interfaces in a domain model in a real project? From a technical ...
1
vote
4answers
659 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 ...
1
vote
5answers
810 views

Php: Whats my next step? [closed]

So in college I started learning Php, mostly starting with the Larry Ullman books. I got a job at a company after, where I was able to learn some stuff from the higher up guys. Since then, I've done ...
0
votes
3answers
185 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 ...
23
votes
4answers
1k views

Why Java doesn't make use of encapsulation with some classes?

My question is related with System.in and System.out classes (there might be others like those in the Standard library). Why is that? Isn't that a bad practice in OOP? Shouldn't it be used like: ...
11
votes
4answers
1k views

How do I pass data the object-oriented way in PHP?

I find that even when working with a MVC framework (e.g. CodeIgniter), I regularly resort to passing nested arrays rather than objects. This doesn't follow my understanding of object-oriented well. ...
9
votes
7answers
1k 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, ...
7
votes
6answers
4k views

Are Get-Set methods a violation of Encapsulation? [duplicate]

Possible Duplicate: When are Getters and Setters Justified In an Object oriented framework, one believes there must be strict encapsulation. Hence, internal variables are not to be exposed ...
6
votes
4answers
898 views

“Extends is evil” vs. OCP?

As far as I have understood(?), the "Extends is evil" idea is in direct opposition to the Open Closed Principle? In here, the concept of OCP is presented as inherently using Extends: ...
6
votes
5answers
879 views

Is object oriented really good for kids?

I read, that Smalltalk was designed for kids or for education. So was it good at it? Better than the other languages? Was it good/easy also for average kid (I read that bright kids enjoyed). Is there ...
5
votes
1answer
2k views

Why is imperative programming preferred over functional programming? [closed]

Background: I am proponent of functional programming who works at a VB.NET shop where the prevailing mental model is imperative programming. Being that foundation of our system is WinForms I can ...
5
votes
6answers
5k 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 ...
5
votes
3answers
407 views

What is a good design model for my new class?

I am a beginning programmer who, after trying to manage over 2000 lines of procedural php code, now has discovered the value of OOP. I have read a few books to get me up to speed on the beginning ...
4
votes
8answers
329 views

Do objects with validation logic in their domain really represent their real world counterparts?

I asked a question about whether validation behavior should be treated the same as other types of behavior in regard to the concept of OOP being "data + behavior". I got some good answers back that ...
4
votes
3answers
785 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 ...