Questions tagged [ooad]

Object Oriented Analysis and Design - use this tag for questions related to Object Oriented programming. Also include language tags such as java where appropriate.

Programming paradigm where entities are described as objects with features and capabilities. The main advantage of this approach is the ability to reuse and extend functionality of objects.

See also: Wikipedia entry on OOAD

256 questions
7
votes
4 answers

Issue in using Composition for “is – a “ relationship

I have system being developed for an HR system. There are Accountant employees and Programmer employees. For the first month of joining the company, the employee is not given any role. One employee can be an Accountant and a programmer at the same…
LCJ
  • 22,196
  • 67
  • 260
  • 418
6
votes
6 answers

Splitting objects into their most fundamental parts

Not sure if the title captures what I'm trying to say here. When designing in OO should I be splitting my objects up into their most specific areas - so if I have a factory object that deals with creating objects but later on i come across a way of…
Julio
  • 1,815
  • 7
  • 20
  • 22
6
votes
3 answers

Best practices with jQuery form binding code in an application

We have an application with a good amount of jQuery JSON calls to server side code. Because of this, we have a large amount of binding code to parse responses and bind the appropriate values to the form. This is a two part question. What is the…
Sean Chambers
  • 8,572
  • 7
  • 41
  • 55
6
votes
2 answers

Method Calling Public/Private Members or Methods Best Practice - C#.NET

What is the best practice for calling members/fields from a private method and public method? Should the private method always call private fields or should they call the public members? private string _name; public string Name { get {return…
traderde
  • 61
  • 1
  • 3
6
votes
4 answers

Builder Pattern : Why does the Director construct the object?

I am learning the Builder Pattern In the above link (Java example), I noticed that the Builder offers interface to construct multiple components. Along with invoking them, we call the getProduct() as well. The point I don't understand is that why…
phanin
  • 5,327
  • 5
  • 32
  • 50
6
votes
4 answers

In some Java code, why does the class Deck extend the Card class?

I am reading some code in Java, which I am not familiar with, but it seems weird that if a class is Deck (for a deck of cards), it already has an instance variable of an array of Cards, so why does Deck extend or inherit Card? I thought class A…
Jeremy L
  • 3,770
  • 6
  • 41
  • 62
5
votes
0 answers

Memory allocation when declaring a series of class objects in C++

class Data { double a, b, c; }; int main() { Data x, y, z; cout << sizeof(x) << endl; cout << &x << " " << &y << " " << &z << endl; } The output of the above code was: 24 0x7ffd911f5640 0x7ffd911f5660 0x7ffd911f5680 Here's my…
5
votes
2 answers

How can I grasp the concept of pure OOD?

I still have a little problem grasping the concept of pure OOD. Let's say we have a class Human and we live in a world where sometimes the human walks (the brain commands the legs), where sometimes trees disappear (the human notices that) and…
Kira M. Backes
  • 530
  • 3
  • 10
5
votes
3 answers

Impliment UML Ternary Association in java Code

I'm currently having some trouble implementing ternary associations in Code. I get the binary ones, but I am unsure about ternary Associations. this is typical scenario in a university. Lecturer can teach a one subject to one or more…
Susantha7
  • 898
  • 1
  • 20
  • 38
5
votes
6 answers

Encapsulation. Well-designed class

Today I read a book and the author wrote that in a well-designed class the only way to access attributes is through one of that class methods. Is it a widely accepted thought? Why is it so important to encapsulate the attributes? What could be the…
bancer
  • 7,475
  • 7
  • 39
  • 58
5
votes
1 answer

Javascript literal object and singleton pattern

Isn't the literal object instantiation in javascript a singleton? Of course there is no "self" instantiation if the object is not found, but there is only one "copy" of the object kept around. what are your thoughts?
Draconar
  • 1,147
  • 1
  • 17
  • 36
5
votes
5 answers

What's the best way to handle type indicators in object-oriented design?

We have a business model that requires, say, different types of vehicles to be identified. For example, motorcycle, boat, yacht, farm equipment, snowmobiles, heavy truck, light truck, passenger car, and "Other". I think there are two ways to handle…
Risser
  • 585
  • 7
  • 20
5
votes
8 answers

What's a good metaphor for Dependency Injection?

A metaphor that stuck with me when programming non-DI systems is "a person playing with his/her toys". A person being an object and the person's toys being anything that object creates, stores, initializes, and manipulates. The toys can dispatch…
Pup
  • 10,236
  • 6
  • 45
  • 66
5
votes
2 answers

PHP Abstract Method versus Default Method

I notice that when I define a method as abstract, the signature of child classes needs to be compatible with it. This robs me of an opportunity to use the type checking in the child class' signature. If I define the parent method as a concrete…
DatsunBing
  • 8,684
  • 17
  • 87
  • 172
5
votes
1 answer

Achieve strategy pattern when we have different return type

I have SaveManager Abstract class and my concrete classes TVSaveManager, DataSaveManager and VoiceSaveManager implementing SaveManager Abstract class. List lstPrdSaveManager; public SaveResponseModel…
Al.
  • 855
  • 1
  • 11
  • 24
1 2
3
17 18