design patterns used in core java (j2se) source code

These are some of the design patterns used in core java API that I have gone through in my experience:

Decorator and Bridge patterns – java.io

Observer pattern is available as standard API

Iterator Pattern – All collection classes

Template Pattern – Arrays.sort() and Collection.sort()

Singleton Pattern – Runtime, Calendar

Factory Pattern – Wrappers of primitive data type’s valueOf methods [Integer.valueOf()]

Other most commonly used patterns:
Decorator: Java IO
Strategy Pattern: If you’ve ever used dependency injection, you’ve used the strategy pattern.
Facade: Any service APIs implement this pattern.
Singleton: Used in caching
Builder: While Writing Unit Tests
Prototype: Cloning
Adapter: asList , toString
Chain Of Responsibility: Logging
Factory: Action Mapping
MVC: Web frameworks
Proxy: Web services
Template

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Mawazo

Mostly technology with occasional sprinkling of other random thoughts

amintabar

Amir Amintabar's personal page

101 Books

Reading my way through Time Magazine's 100 Greatest Novels since 1923 (plus Ulysses)

Seek, Plunnge and more...

My words, my world...

ARRM Foundation

Do not wait for leaders; do it alone, person to person - Mother Teresa

Executive Management

An unexamined life is not worth living – Socrates

javaproffesionals

A topnotch WordPress.com site

thehandwritinganalyst

Just another WordPress.com site

coding algorithms

"An approximate answer to the right problem is worth a good deal more than an exact answer to an approximate problem." -- John Tukey

%d bloggers like this: