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….… Read more ...



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

Scenarios based Java OO concepts & GoF design patterns

Read more ...


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.… Read more ...



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…

Read more ...


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.… Read more ...



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.… Read more ...



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.… Read more ...



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.… Read more ...



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?… Read more ...



Don't be overwhelmed by the number of Q&As & tech stacks as nobody knows everything, and often key Q&As at the right moment makes a difference.

500+ Java Interview FAQs

Java & Big Data Tutorials

Top