Open in app
Home
Notifications
Lists
Stories

Write
Dinesha Karunathilake
Dinesha Karunathilake

Home

Apr 22, 2021

OOP Design Patterns — Iterator Pattern

Suppose we have 2 types of collections (Array and a List) but we need to traverse both the collections in a client. //array for (int i = 0; i < taskList.length; i++) Task task = taskList[i]); //arraylist for (int i = 0; i < taskList.size(); i++) Task task = (Task)taskList.get(i); …

2 min read

OOP Design Patterns 9— Iterator Pattern
OOP Design Patterns 9— Iterator Pattern

Apr 22, 2021

OOP Design Patterns— Composite Pattern

When there is a hierarchical structure, there are 2 types of components Leaf nodes and Composite nodes. Usually in this type of scenario, we will have to check which type the component is before performing some action on them using an if-else block. The composite pattern provides us a way…

1 min read

OOP Design Patterns— Composite Pattern
OOP Design Patterns— Composite Pattern

Apr 22, 2021

OOP Design Patterns — Template Method Pattern

The Template Method Pattern: defines the skeleton of an algorithm in a method, deferring some steps to subclasses. The template method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure. Abstract class has a method called Template method which contains the structure of the algorithm but…

2 min read

OOP Design Patterns — Template Method Pattern
OOP Design Patterns — Template Method Pattern

Apr 22, 2021

OOP Design Patterns — Command Pattern

Definition: The command pattern encapsulates a request as an object, thereby letting you parameterize other objects with different requests, queue or log requests, and support undoable operations. Command public class LightOnCommand implements Command { Light light; public LightOnCommand(Light light) {…

2 min read

OOP Design Patterns — Command Pattern
OOP Design Patterns — Command Pattern

Apr 22, 2021

OOP Design Patterns — Introduction

Change is the inevitable character of anything and software is no exception. The job of a good engineer is to design the systems in a way to cope up with the change and for it to be maintainable. We have enough examples of codebases becoming unmaintainable after a few years…

1 min read


Apr 22, 2021

OOP Design Patterns 2 - Observer Pattern

The observer pattern defines a one to many dependencies between objects so that when one object changes state all of its dependents are notified and updated automatically This provides an object design where subjects and observers are loosely coupled: They interact but have very little knowledge of each other making…

1 min read

OOP Design Patterns 2 - Observer Pattern
OOP Design Patterns 2 - Observer Pattern

Nov 28, 2020

OOP Design Patterns — Factory Pattern

Encapsulate what changes: Object instantiation is something that is more prone to change. When a new type of object need to be added to extend functionality it will change. Encapsulating these changing parts is what we are focused on here. All factory patterns encapsulate the object creation Also, both the…

2 min read

OOP Design Patterns — Factory Pattern
OOP Design Patterns — Factory Pattern

Nov 28, 2020

OOP Design Patterns 3— Decorator Pattern

When in a software project, need comes to extend the behavior of the product by adding new functionalities, we could use inheritance by subclassing to extend the behavior of an object. But then inheritance is done at compile-time and methods are also available for other instances of that class. Because…

2 min read

OOP Design Patterns 3— Decorator Pattern
OOP Design Patterns 3— Decorator Pattern

May 29, 2020

OOP Design Patterns — SOLID Design Principles

SOLID is an important set of principles in OOP software development and the name is an acronym for the five principles it explains. 1. Single Responsibility Principle The idea of this principle sounds simpler than it actually is and it says that a class should do one thing. …

Oop Concepts

3 min read

OOP Design Patterns — SOLID Design Principles
OOP Design Patterns — SOLID Design Principles

Apr 10, 2020

Reactive Programming with RxAndroid and Kotlin

Apps nowadays need to meet the requirement of being robust and responsive. RxAndroid and Kotlin tools are equipped to help this process. They will help us take our apps to the next level. Reactive vs Imperative Programming Following are some characteristics of Reactive Apps Responsive: Makes the UI thread is responsive so that the…

Android

3 min read

Dinesha Karunathilake

Dinesha Karunathilake

Engineer, traveller, writer

Following
  • Dilani Alwis

    Dilani Alwis

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Knowable