Blog Archives

01: Can you design classes & interfaces using OO?

Q1. How would you go about designing a “farm animals” application where animals like cow, pig, horse, etc move from a barn to pasture, a stable to paddock, etc? The solution should also cater for extension into other types of animals like circus animals, wild animals, etc in the future….



02: Scenarios based Java OO concepts & GoF design patterns – naive Template Method pattern

Scenarios based Java OO concepts & GoF design patterns


03: Scenarios based Java OO concepts & GoF design patterns – Strategy Pattern

The following post improves on the design flaws listed in the previous post entitled 02: Scenarios based Java OO design & GoF design patterns – naive Template Method pattern. Scenario: A company named XYZ Retail is in the business of selling Books, CDs and Cosmetics. Books are sales tax exempt…



Class invariant & designing by contract in Java

Q1. What is a class invariant? A1. Class invariant is — what must be true about each instance of a class? If an invariant fails then there could be a bug in either calling-method or called-method. It is convenient to put all the expressions required for checking invariants into reusable…



How would you go about designing with UML diagrams

This extends 12 UML Interview Questions & Answers. Q1. How would you go about designing a system as described below? A barn that contains animals such as cows and horses. A farmer milks the cows in the farm, and the animals eat hay that are stored in the barn. The…



Part 1: Badly designed Java classes & interfaces

4 Part practical design concept series Part 1: Abstraction | Part 2: Single Responsibility Principle | Part 3: Open Close Principle | Part 4: Dependency Inversion Principle. Q. Can you review the following code and discuss why they are not properly designed. How will you go about improving the design?…



Part 2: Badly designed classes & interfaces – Single Responsibility Principle (SRP)

4 Part practical design concept series Part 1: Abstraction | Part 2: Single Responsibility Principle | Part 3: Open Close Principle | Part 4: Dependency Inversion Principle. Java design principle Single Responsibility Principle which states that a class should have only one reason to change. Q. What is wrong with…



Part 3: Badly designed classes & interface – Open Closed Principle (i.e OCP)

4 Part practical design concept series Part 1: Abstraction | Part 2: Single Responsibility Principle | Part 3: Open Closed Principle | Part 4: Dependency Inversion Principle. Java Open closed principle to design states that a class must be open for extension & closed for any modifications. Q. What is…



Part 4: Badly designed classes & interfaces – Dependency Inversion Principle (i.e. DIP)

4 Part practical design concept series Part 1: Abstraction | Part 2: Single Responsibility Principle | Part 3: Open Close Principle | Part 4: Dependency Inversion Principle. Q. What is wrong with the following code snippet? How will you go about refactoring it?



300+ Java & Big Data FAQs - Quick Prep

Java & Big Data Tutorials

Top