Notes

My latest writings


Wednesday, July 22, 2020

GoF Design Patterns in Java's core libraries


GoF Design Patterns
You can find an overview of a lot of design patterns in Wikipedia. It also mentions which patterns are mentioned by GoF. I'll sum them up here and try to assign as many pattern implementations as possible, found in both the Java SE and Java EE APIs.

Creational patterns

Abstract factory 

(recognizeable by creational methods returning the factory itself which in turn can be used to create another abstract/interface type)

Builder 

(recognizeable by creational methods returning the instance itself)

Factory method 

(recognizeable by creational methods returning an implementation of an abstract/interface type)

Prototype 

(recognizeable by creational methods returning a different instance of itself with the same properties)

Singleton 

(recognizeable by creational methods returning the same instance (usually of itself) everytime)


Structural patterns

Adapter 

(recognizeable by creational methods taking an instance of different abstract/interface type and returning an implementation of own/another abstract/interface type which decorates/overrides the given instance)

Bridge 

(recognizeable by creational methods taking an instance of different abstract/interface type and returning an implementation of own abstract/interface type which delegates/uses the given instance)
  • None comes to mind yet. A fictive example would be new LinkedHashMap(LinkedHashSet<K>, List<V>) which returns an unmodifiable linked map which doesn't clone the items, but uses them. The java.util.Collections#newSetFromMap() and singletonXXX() methods however

Composite 

(recognizeable by behavioral methods taking an instance of same abstract/interface type into a tree structure)

Decorator 

(recognizeable by creational methods taking an instance of same abstract/interface type which adds additional behaviour)

Facade 

(recognizeable by behavioral methods which internally uses instances of different independent abstract/interface types)

Flyweight 

(recognizeable by creational methods returning a cached instance, a bit the "multiton" idea)

Proxy 

(recognizeable by creational methods which returns an implementation of given abstract/interface type which in turn delegates/uses a different implementation of given abstract/interface type)


Behavioral patterns

Chain of responsibility 

(recognizeable by behavioral methods which (indirectly) invokes the same method in another implementation of same abstract/interface type in a queue)

Command 

(recognizeable by behavioral methods in an abstract/interface type which invokes a method in an implementation of a different abstract/interface type which has been encapsulated by the command implementation during its creation)

Interpreter 

(recognizeable by behavioral methods returning a structurally different instance/type of the given instance/type; note that parsing/formatting is not part of the pattern, determining the pattern and how to apply it is)

Iterator 

(recognizeable by behavioral methods sequentially returning instances of a different type from a queue)

Mediator 

(recognizeable by behavioral methods taking an instance of different abstract/interface type (usually using the command pattern) which delegates/uses the given instance)

Memento 

(recognizeable by behavioral methods which internally changes the state of the whole instance)

Observer (or Publish/Subscribe) 

(recognizeable by behavioral methods which invokes a method on an instance of another abstract/interface type, depending on own state)

State 

(recognizeable by behavioral methods which changes its behaviour depending on the instance's state which can be controlled externally)

Strategy 

(recognizeable by behavioral methods in an abstract/interface type which invokes a method in an implementation of a different abstract/interface type which has been passed-in as method argument into the strategy implementation)

Template method 

(recognizeable by behavioral methods which already have a "default" behaviour defined by an abstract type)

Visitor 

(recognizeable by two different abstract/interface types which has methods defined which takes each the otherabstract/interface type; the one actually calls the method of the other and the other executes the desired strategy on it)


Monday, October 24, 2016

Java/J2ee Must Read - Interview Topics

Core Java:

OOPS

  •     Abstraction
  •     Encapsulation
  •     Polymorphism
  •     Inheritance

Overloading, Overriding

 

Exceptions

  •     Checked & Un-Checked exception
  •     Customizing Exception
  •     Exception chaining and propagation

Enum

  •     General concepts
  •     How to create and use

Threading

  •     Basics
  •     Thread vs Process
  •     Life Cycle
  •     Interrupting Threads
  •     Thread pool concept
  •     Concurrency (Good to have)
  •     Executor service

Collections & Maps

  •     ArrayList, LinkedList with code examples
  •     HashMap, Hashtable, ConcurrentMap detailed implementation knowledge
  •     Hash code, equals concepts
  •     Sorting collection & Maps,
  •     Searching elements in Collection and Maps
  •     Comparator/Comparable utilization

Inner classes

  •     Types of inner classes
  •     Difference with others

Generics

 

Design Patterns

  •     Singleton, factory, builder
  •     Adapter, Proxy, Facade
  •     Strategy, Observer, Chain of responsibility

Data structures

  •     Trees, Stack, Queue, Linked List

More...

  •     Arrays based programs
  •     Serialization vs Externalization
  •     Programs : like Singleton,Mutable class, Prime num, Febinnocii series, Sorting techniques, Hashmap implementation, String based programs,
  •     Object class methods with examples

Note: Features of all the versions Java 5, 6, 7 and 8



Advanced Java:

JDBC:

  •     Steps to write basic JDBC program
  •     Types of JDBC Drivers
  •     Difference b/w Statement, PreparedStatement, CallableStatemnt
  •     Result Sets
  •     Stored Procedures, Batch Processing
  •     Different interfaces used in JDBC program

Servlets:

  •     Lifecyle
  •     Request dispatcher
  •     ServletContext vs ServletConfig
  •     Different Scopes
  •     Session Tracking Mechanisms

JSP:

  •     Implicit objects
  •     Flow of excecution
  •     Session Tracking, Cookies
  •     JSTL
  •     Custom jsp tags
  •     Different types of tags available in JSP like Directives, Actions, etc.

Hibernate:

  •     What is ORM
  •     Hibernate object lifecycle
  •     Single row operations like get() vs load()
  •     Eager loading vs Lazy loading
  •     Annotations
  •     All the interfaces using in Hibernate programs like Session, SessionFactory, Transaction.. etc
  •     Cache like first level and second level cache
  •     Different types of mappings
  •     Hibernate features
  •     Difference b/w SQL, HQL, Criteria API, Native SQL

Spring:

  •     IOC, Spring Core
  •     Dependency Injection (DI) like Setter, Constructor, Interface
  •     Spring Bean Lifecycle
  •     Spring MVC flow of execution
  •     Autowiring
  •     Different Scopes
  •     Annotations
  •     AOP concepts in depth
  •     RESTful Webservices
  •     Transaction Management
  •     Spring integration with different frameworks like Hibernate, JSF, Tiles, Log4j, and etc.
  •     Spring Security


Works

What can I do


Branding

Social media Branding is far and away the best technique a company has to boost engagement with its customer base. Even a minimum of involvement, such as making one post a day.

Web Design

Web design is the process of creating websites. It encompasses several different aspects, including webpage layout, content production, and graphic design.

Development

Web Development refers to building, creating, and an maintaining websites. It includes aspects such as web design, web publishing, web programming and database management.

Graphic Design

Graphic design is the process of visual communication and problem-solving through the use of typography, photography, and illustration. The field is considered a subset of visual communication and communication design.

Photography

Photography is the art, application and practice of creating durable images by recording light or other electromagnetic radiation, either electronically by means of an image sensor, or chemically by means of a light-sensitive material such as photographic film.

User Experience

User experience (UX) design is the process design teams use to create products that provide meaningful and relevant experiences to users. This involves the design of the entire process of acquiring and integrating the product, including aspects of branding, design.

Contact

Get in touch with me


Adress/Street

Bangalore, India