Home » Author Archives: Mohamed Sanaulla (page 3)

Author Archives: Mohamed Sanaulla

Introduction to Default Methods (Defender Methods) in Java 8

java-logo

We all know that interfaces in Java contain only method declarations and no implementations and any non-abstract class implementing the interface had to provide the implementation. Lets look at an example:                 public interface SimpleInterface { public void doSomeWork(); } class SimpleInterfaceImpl implements SimpleInterface{ @Override public void doSomeWork() { System.out.println('Do Some Work implementation ...

Read More »

Chain Of Responsibility Design Pattern Example

java-logo

Avoid coupling the sender of a request to the receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. The main intention in Chain Of Responsibility is to decouple the origin of the request and the handling of the request such ...

Read More »

Test Driven Development – A Win-Win strategy

java-interview-questions-answers

Agile practitioners talk about Test Driven Development(TDD), so do lot of developers who care about their code quality and workability. And I once upon a time, not so long ago managed to read about TDD. The crux of TDD as I have understood is: Write Test, and fail Code, make the tests succeed Automate the tests Refactor the code to ...

Read More »

Another aspect of coupling in Object Oriented paradigm

software-development-2-logo

I had previously written a post related to coupling and cohesion here and that was more of a basic definition of both the terms. In this post I would like to throw some light on the tight dependency on the type of the component in use. Generally we would aim to design classes such that they interact via the interfaces ...

Read More »

SOLID – Liskov Substitution Principle

software-development-2-logo

Liskov Substitution principle (LSP) states that, Methods that use references to the base classes must be able to use the objects of the derived classes without knowing it This principle was written by Barbara Liskov in 1988. The idea here is that the subtypes must be replaceable for the super type references without affecting the program execution. This principle is ...

Read More »

SOLID – Open Closed Principle

software-development-2-logo

Open Closed Principle (OCP) states that, Software entities (Classes, modules, functions) should be OPEN for EXTENSION, CLOSED for MODIFICATION. Lets try to reflect on the above statement- software entities once written shouldn’t be modified to add new functionality, instead one has to extend the same to add new functionality. In other words you don’t touch the existing modules thereby not ...

Read More »

SOLID – Single Responsibility Principle

software-development-2-logo

The Single Responsibility principle (SRP) states that: There should never be more than one reason for a class to change. We can relate the “reason to change” to “the responsibility of the class”. So each responsibility would be an axis for change. This principle is similar to designing classes which are highly cohesive. So the idea is to design a ...

Read More »

Java 7: try-with-resources explained

java-logo

This article examines the use of the try-with-resources statement. This is a try statement that declares one or more resources. A resource is as an object that must be closed after the program is finished with it. The try-with-resources statement ensures that each resource is closed at the end of the statement. Any object that implements the java.lang.AutoCloseable or java.io.Closeable ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.