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)

3
votes
2answers
303 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
225 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
7answers
902 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
1answer
1k 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
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
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 ...
2
votes
3answers
1k 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 ...
1
vote
4answers
516 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
734 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 ...
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: ...
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
3k 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
5answers
751 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 ...
6
votes
8answers
2k views

C++ to friend or not to friend

I have an object oriented programming with c++ course this semester at college and we were learning about friend functions. I instinctively dislike them for their ability to bypass the security that ...
5
votes
4answers
811 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: ...
5
votes
3answers
371 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 ...
5
votes
9answers
2k 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 ...
4
votes
3answers
225 views

OOP and relational databases [duplicate]

I see a lot of talk in the OOP world about principles and laws such as Open/Close and Loose Coupling, I can understand how they are so high valued, However I seem to have ran into a problem with ...
4
votes
4answers
288 views

Should single purpose utility app use a class

When writing a small utility app, that does just one thing, should that one thing be encapsulated in a seperate class, or just let it be part of whatever class/module is used to start the application? ...
3
votes
2answers
464 views

Extend the class or create an instance?

I'm reading Pro PHP and jQuery and want to rebuild the example. The author is creating a database connection class: class DB_Connect { protected $db; protected function __construct($dbo = NULL){ ...
3
votes
2answers
551 views

Something similar to Objective-C categories in other languages?

I understand Objective-C categories and how they become useful, but I always have a hard time explaining the concept to other programmers that are not familiar with Objective C. Maybe I'm just bad ...
3
votes
1answer
217 views

Can methods in an OOP language be considered as some kind of closure?

Consider a method m of a class A in an object-oriented language like Java or C++. In the body of the method m it is possible to reference the member variables of the object on which the method is ...
3
votes
1answer
379 views

Which one is a better practice a static factory method of the same class or a separate factory class with methods?

I have seen this at many places. a Parent class has a static method to create objects of the right subclass and at times we have a dedicated factory class with instance methods to create object of ...
2
votes
2answers
175 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 ...
2
votes
3answers
338 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
2answers
236 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 ...
2
votes
2answers
253 views

Programming structural question, controlling lots of states and specific transitions between states case by case

This is a theory question for me just to try and write better code. I am pretty new so hopefully I am using terms like state in the correct way. How I should be thinking about this problem? I am ...
2
votes
3answers
1k views

Does mobile based (Android) development, benefit from Object Oriented Programming?

My development on Android is based on scientific programs and while I'm building these most of the code is in one or two long classes. When I come to deploy these programs I try to decouple everything ...
2
votes
2answers
2k views

What are the pros and cons of multiple inheritance? [closed]

What are the consequences of allowing multiple inheritance in a programming language? Why does multiple inheritance tend to violate the very essence of OOP? Is that what differentiates a pure OOP ...
2
votes
5answers
2k views

Best way to learn Java if you already have an OOP background, like ActionScript 3? [closed]

I'm looking to learn Java, but I don't want to get a book that is going to tell me what an object is, how OOP works, etc. I know this from my existing ActionScript 3 work. One idea is to look at all ...
1
vote
2answers
274 views

Classes shouldn't call other classes? [closed]

I've just finished reading The Art of Unit Testing, by Roy Osherove. It was an interesting book, but I'm having trouble with something he mentions near the end (section 11.2.2): Identifying ...
1
vote
2answers
110 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 ...
1
vote
1answer
113 views

Use of # in answers/documentation when referring to methods of a class

When looking through Java documentation or answers for Stack Overflow / programming forum questions, I often see people referring to methods like String#format, Object#clone etc, rather than ...
1
vote
5answers
1k views

Learning PHP OOP [closed]

I have been coding PHP for about 2 years now and I THINK that I have a very good grasps of the fundamental parts of PHP, i.e. Functions foreach/IF statements sessions/cookies POST/GET Amongst a ...