February 13, 2009

Quotes: He who seeks, Comfort of feeling safe with a person, Wisdom and Enlightenment and New Paradigms for Full Engagement

Category: Life,Personal development,Quotes,Spiritual,Work — by Amit Chaudhary @ 4:47 pm

Architect Moshe Safdie’s Poem:

He who seeks truth shall find beauty

He who seeks beauty shall find vanity

He who seeks order shall find gratification

He who seeks gratification shall be disappointed

He who considers himself the servant of his fellow being will find the joy of self expression

He who seeks self expression shall fall into the pit of arrogance

Arrogance is incompatible with nature

Through nature and the nature of the universe and the nature of man we shall seek truth
If we seek truth, we shall find beauty.

-From TED Talk by Moshe Safdie: What makes a building unique?

Bio & Links to his buildings in the talk

Golden Temple

Comfort of feeling safe with a person

Oh the comfort, the inexpressible comfort of feeling safe with a person, having neither to weigh thoughts nor measure words, but pouring them all right out,

just as they are — chaff and grain together — certain that a faithful hand will take and sift them,

keep what is worth keeping, and with the breath of kindness blow the rest away.

-George Eliot (pen name of Mary Ann Evans), novelist (1819-1880)

Wisdom and Enlightenment

Knowing others is wisdom;
Knowing the self is enlightenment.
Mastering others requires force;
Mastering the self requires strength.

-Tao Te Ching, Translated by Gia-Fu Feng & Jane English

New Paradigms for Full Engagement

Old Paradigm                         New Paradigm
Manage time                            Manage energy
Avoid stress                             Seek stress
Life is a marathon                    Life is a series of sprints
Downtime is wasted time       Downtime is productive time
Rewards fuel performance       Purpose fuels performance
Self-discipline rules                 Rituals rules

-The book, The Power of Full Engagement, page 6.

Photo of Golden Temple, Amritsar India courtesy voobie on Flickr.

• • •

February 12, 2009

Design Patterns in Java (JDK) and Java Frameworks

Category: Software development — by Amit Chaudhary @ 6:47 pm

Recently I was reading up on Design Patterns & Java to refresh my knowledge and was pleasantly surprised to see a pretty large number of patterns used in the JDK(Java SDK or rather the Java standard library) and Java Frameworks such as Hibernate and Spring. I have seen this in STL among others to a lesser degree.
Here are some, in no particular order:

The links are to Wikipedia Design Pattern pages which I liked over the Portland pattern repository for overview:

  • Factory pattern: Any method which creates an objects, initializes it and returns it. socket.getInputStream(), Executors.newFixedThreadPool(), Collections.singleton(), etc
  • Decorator pattern: Use to wrap\convert Streams adding functionality to them. Not Adapter pattern due to added functionality. Wrap a FileInputStream into a Reader and use .readLine() to read lines.
  • Chain-of-responsibility pattern: The streams as above, the Streams chained handle the request and pass it after operating on it. Criteria, an alternative to HQL in Hibernate.
  • Strategy pattern: Concrete strategies to implement family of algorithms which are interchangeable. All collections are strategies, accessible using a common interface, depending what what is stored, Map interface can be HashMap, TreeMap, LinkedHashMap
  • Template method pattern: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. java.util.AbstractCollection expects iterator, size, add and provides addAll, clear, contains, containsAll, isEmpty, remove, etc.
  • Singleton pattern: Java Security Manager, System.getSecurityManager(); Socket accept and other permissions
  • Prototype pattern: Has a Cloneable marker interface, which indicates to Object.clone() that it is legal\safe to make a field copy. Should not be done for open files, self-allocated memory, ….
  • Observer pattern: Built in support in JDK including Observer interface & Observable classes.

There are many more such as Thread pool pattern, Inversion of control which forms the basis of Spring framework and so on.

• • •
Powered by: WordPress Theme based on Sharepoint like theme from: ADMIN-BG