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)

7
votes
1answer
365 views

What are some techniques I can use to refactor Object Oriented code into Functional code?

I've spent about 20-40 hours developing part of a game using JavaScript and HTML5 canvas. When I started I had no idea what I was doing. So it started as a proof of concept and is coming along ...
1
vote
2answers
245 views

Go with an object-oriented perspective [duplicate]

My OOP JavaScript question is at the very bottom if you want to skip my introduction. In an answer to the question Accessing variables from other functions without using global variables, there's a ...
5
votes
3answers
454 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 ...
1
vote
1answer
156 views

How do I create a mutually-incompatible type library in Java?

Folks, this seems like it should be straightforward, but I'm drawing a blank here. As a simplified example, consider an abstract class called Number with an abstract method add(). I want to create ...
3
votes
2answers
194 views

Dependency properties outside the realm of WPF?

Is there a more general concept or name for what WPF calls "dependency properties"? I imagine this is not a WPF-ism and in fact other libraries or frameworks have employed a similar approach? If so, ...
2
votes
2answers
464 views

Is it a Single Responsibility Principle violation?

I'm designing an OO graph library and at the moment I'm trying to figure out the design for a GraphEdge class. I've added setters and getters for it's nodes, direction and weight. This seemes ...
1
vote
1answer
139 views

Design pattern for complex view creation in sheet music

I've got a bunch of Note-Models with properties like pitchand duration. In music notation, these notes must now be placed into a certain bar on a certain line on a certain page, and so on. Many more ...
-1
votes
1answer
361 views

How to reconstruct this application using design pattern

I am engaging in redesigning a linux c++ server application. The application acts as file relayer in the form of receiving file packets (incuding control packets and data packets) from client A, ...
3
votes
3answers
143 views

Representational Equality versus Value Equality

I am coding a system where I have objects which represent a set of resources. These resources are identifiable (they have an ID). There can only be one resource with the same ID, and so multiple ...
3
votes
3answers
130 views

Perform operations in the entry-script, or create a class which just instantiates and calls methods?

I'm building a perl application which does the following operations: Copy a bunch of files (class fileFetcher ) Parse each file (class fileParser) Store some data from each file in a database (class ...
4
votes
1answer
710 views

Getting rid of Massive View Controller in iOS?

I had a discussion with my colleague about the following problem. We have an application where we need filtering functionality. On any main screen within the upper navigation bar, there is a button ...
3
votes
1answer
282 views

How come javascript, being a prototype based language, doesn't have an easy way to access the prototype?

May be this is a stupid question, but I'm kind of intrigued. Being JavaScript a prototype based language, with its pseudo-class function constructors sort of half baked (remember JavaScript: The Good ...
1
vote
1answer
73 views

Variable type object

Is there a language with something like the following construct? var_type(TYPE_1, TYPE_2,..., TYPE_N) obj; and now its possible to: TYPE_17 staticTypeVariable17; obj = staticTypeVariable17; ...
0
votes
2answers
353 views

Separation of Concerns, Data Access Layer

I was thinking about this earlier today and figured I would get some input on the matter. When I develop applications I would usually have the Data Access Layer on another project, incase it could be ...
1
vote
1answer
142 views

Design for migrating to Multitenant architecture

We are in a process of redesigning our product code in such a way so as to support multitenancy. Currently the implementation is such that one product deployment caters to only one customer. Thus ...
4
votes
1answer
225 views

OOP Design - Possible wrong approach makes it impossible to implement it in code

This last semester i've had lectures about OOP design, i understood most of what i was supposed to but there is something that i can't get right. I'm pretty sure that the models i create are wrong ...
1
vote
1answer
70 views

IXRepository and test problems

Recently had a doubt about how and where to test repository methods. Let the following situation: I have an interface IRepository like this: public interface IRepository<T> where T: class, ...
1
vote
4answers
2k views

Keeping track of all objects of a class

I'm new to object-oriented programming, and I keep running into this issue. (I'm programming in Java) I've been a bit reluctant to ask about this, since it seems like such a basic issue, but I can't ...
2
votes
5answers
438 views

OOP concept: is it possible to update the class of an instantiated object?

I am trying to write a simple program that should allow a user to save and display sets of heterogeneous, but somehow related data. For clarity sake, I will use a representative example of vehicles. ...
4
votes
2answers
249 views

Dividing monopoly streets in groups

I'm new to object-oriented programming, to java, and to programming in general, and as my first real project I'm trying to program the board game Monopoly. What I've got so far is an array that can ...
3
votes
2answers
476 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){ ...
19
votes
4answers
1k views

How do purely functional languages handle modularity?

I come from an object oriented background where I've learned that classes are or at least can be used to make a layer of abstraction that allows for easy recycling of code which can then either be ...
5
votes
1answer
182 views

How Do You Organize Your Methods in OO Progamming [duplicate]

Whenever I am programming in an object-oriented language, I am always faced with what order and how to group the methods for an object. Are there any standards for this, or any suggestions?
2
votes
1answer
139 views

Is every object rounded to the same size in Java?

According to this answer every object in Java is of the same size? Is the answer talking about the object itself or the reference to the object? Here's the statement: every object size is rounded ...
4
votes
5answers
1k views

Tic tac toe class diagram

I'm in a software engineering class and I want to practice some skills on the most basic case possible : tic tac toe. I know this is overkill but I want to do it in "proper" OOP. I designed a class ...
2
votes
1answer
209 views

Aren't structured programming and object oriented programming complementary?

It seems there is a lot of discussion on the web about the differences between these two paradigms, and how OOP is somewhat better than structured programming. But aren't they complementary? From my ...
4
votes
5answers
319 views

How does the concept of a class change when passing data to the constructor instead of method parameters?

Let's say we're making a parser. One implementation could be: public sealed class Parser1 { public string Parse(string text) { ... } } Or we could pass the text to the ...
1
vote
3answers
179 views

Which closely represents Aggregation?

I know Aggregation is a has-a relationship, but I encountered a question in a test which did not make sense (and had grammatical mistakes as well) Which of the following statements correctly describe ...
0
votes
2answers
2k views

What is a Package Diagram? and What is a Sequence Diagram? [closed]

In many interviews I've been asked this question. What is a Package Diagram? and What is a Sequence Diagram? and difference between Package Diagram and Sequence Diagram. Thanks in Advance. Edit ...
7
votes
1answer
454 views

Object oriented vs vector based programming

I am torn between object oriented and vector based design. I love the abilities, structure and safety that objects give to the whole architecture. But at the same time, speed is very important to me, ...
0
votes
2answers
222 views

Is it useful to use encapsulation in dynamic typed, interpreted programming language?

For what I know, encapsulation is useful because: if you use directly an attribute and change its type in a static typed language you have to change all the code that uses the class. On the ...
0
votes
1answer
178 views

How to store an object state/data for later processing?

What do you think would be the most effective solution to maintain an object status through a life cycle? The goal to be able to be continue from any state any time. During the life cycle likely to ...
4
votes
1answer
312 views

Java language constructs to enforce design decisions

What constructs in OOP languages (specifically Java) allow you to enforce design decisions and intent? I think some examples would be the 'final' keyword, access modifiers, template methods, perhaps ...
2
votes
3answers
1k views

What does 'enumerable' mean?

My background in mathematics is very poor (i.e. last relevant math class taken was high school Trigonometry two years ago - another story for another time). I'm reading 'Javascript: The Definitive ...
1
vote
2answers
109 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 ...
13
votes
3answers
1k 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
171 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 ...
6
votes
2answers
435 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
99 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
524 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 ...
-1
votes
2answers
841 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 ...
9
votes
3answers
2k 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 ...
27
votes
1answer
5k views

Multiple Interfaces in Java - Good or bad [closed]

I'm coming out of an interview just now and the interviewer asked me if a Java interface can "extend" more than one interfaces. I was thinking multiple inheritance is disallowed in java so got that ...
1
vote
6answers
366 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 ...
79
votes
18answers
7k 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 ...
3
votes
2answers
526 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 ...
4
votes
1answer
473 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 ...
1
vote
2answers
124 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
308 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
360 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. ...