OOAD clarification on multiplicity or cardinality

I am confused about the cardinality/ multiplicity when designing class diagrams. My main confusion is when to represent 1---* relationship. For ex in case of passenger and seat classes, passenger will be allotted to one seat, where as the seat can be

inject the correct type to my business class using Autofac

I currently have a business class whose constructor takes in a repository implementation. There are multiple implementations of this repository. At runtime I want to decide which repository implementation should be supplied. I am new to using DI fram

OOP - Where is Responsibility

I have a class named as A and another Class named as B. Class A contains Class B as a property. I have a business logic. Based on the value of a property in Class B, I have to calculate the value of another property in Class A. To do this calculation

Different user views same object or different object?

Let's say I have an web app that have two user. The applicant sends in the application form, and the case handler process the application. Different users have different views of the application form. Physically, it might be the same application form

Association between Classes and Interfaces

I have a question about modeling associations between classes and interfaces. As far as I know, an interface specifies what an object can do; without providing the state or functionality (When to use an interface instead of an abstract class and vice

Notification by e-mail of use

I have a question in modelling Use Case. 1) If a actor(or user) registers an account in a System and if the System sends Successful Registration Email notification to the actor. Should it be considered as separate use case for email notification or i

Factory or DI adapted to inheritance

I have different kinds of Quotes, like Boat quote, Motorcycle quote, CarQuote which all derive from Quote class. When a client wants to get quote I need to just return Quote. I can implement in two ways: Factory: public class QuoteFactory{ public Quo

Abstract method relative to the interface method

It has been asked 100 times, but they all have different answers. so I dare put this question again. Why we can't move all the abstract method to interface? I know there is template pattern which can be implemented using abstract method, but then it

Try / catch in the builder - Recommended practice?

Something I've always been curious of public class FileDataValidator { private String[] lineData; public FileDataValidator(String[] lineData){ this.lineData = lineData; removeLeadingAndTrailingQuotes(); try { validateName(); validateAge(); validateTo

Class design issues

Currently, I have the following class design : AnimalHandler (A base class for all animals) TigerHandler extends AnimalHandler, LionHandler extends AnimalHandler, LeopardHandler extends AnimalHandler and so on. TigerHandler, LionHandler, LeopardHandl

Copy an object in different ways

I am looking for design principles/patterns to copy an object in different ways. For example, I have the following options to copy an object of type ACCOUNT class. 1) Clone Exactly 2) Clone All except credit details 3) Clone for Credit reversal (nega

Transforming sequential cohesion into functional cohesion?

As described on this website, A module with (only) procedural cohesion is one supporting different and possibly unrelated activities, in which control passes from one activity to the next. Page-Jones gives an example of a module (whose name might be

Manage client / server messages?

From my client/server I receive serialized data, once the data is deserialized, it goes into a command handler where receivedData.Action is the ClientMessage: Command._handlers[receivedData.Action].Handle(receivedData.Profile); The command handler wi

Attribute Values ​​for Simple Domain Objects

Let's say you've got a domain model class for a Song. Song's have a tempo attribute (an int) that should always be a positive number. Should this requirement be part of the domain model or externally (such as in a SongManager / business logic layer c

Divide objects into their most basic 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 c

Cohesion & amp; Coupling

What is the difference between cohesion and coupling? How can coupling and cohesion lead to either good or poor software design? What are some examples that outline the difference between the two, and their impact on overall code quality?Cohesion ref

Abstract base class to force each derived class to be singleton

How do I make an abstract class that shall force each derived classes to be Singleton ? I use C#.When you want to enfore compile time checking, this is not possible. With runtime checking you can do this. It's not pretty, but it's possible. Here's an

Company & amp; Contacts Help with object design

I am hoping that someone (or some people) could help us with a problem that we have wrangled with for a few days. How to organize our business objects given the attached diagram? We are looking for any assistance (ideas about where to or how to searc

Decorators and virtual methods

The decorator design pattern is a very good solution for extending a class functionality. For instance if I want pre and post processing methods on an existing class method I can create a decorator and override the existing method in the base class a

OOAD Book Recommendation: From Theory to Practice

I am on the quest to be a good OO-developer. OO intrigues me, because I understand the patterns, know why composition gives you more flexibility then inheritance, and more of such wisdom. However, I came to the conclusion that I know how to implement

Why do we use Interface? Is it only for standardization?

Why do we use Interface? Is it only for Standardization?Purposes of Interfaces create loosely coupled software support design by contract (an implementor must provide the entire interface) allow for pluggable software allow different objects to inter