Friday, 28 March 2008

Design Patterns in OOPs

Introduction:


For starting with Design Patterns, pre-requiste is one should aware with the Object oriented concepts.

Here, we will try to simplify the term and purpose of the Design Pattern.

First normal and very common query could be, What is Design Patterns, why they are used?

In a simple layman term, a design pattern is a general reusable solution to a commonly occurring problem in software design.

Defining Design Patterns more descriptively...

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code.

It is a simply a description for how to solve a problem that can be used in many different situations.

Design patterns is used to speed up the development process by providing tested, proven development methods or paradigms. Effective software design requires considering issues that may not become visible until later in the implementation.

Reusing design patterns helps to prevent subtle issues that can cause major problems, and it also improves code readability for coders and architects who are familiar with the patterns.
Digging into depth,
Design Pattern is categoried in three different sub patterns.

Creational Patterns
Structural Patterns
Behavioral Patterns.


Creation Patterns
This design pattern is all about class instantiation.

This pattern can be further divided into class-creation patterns and object-creational patterns.

Abstract Factory : Creates an instance of several families of classes

Factory : Creates an instance of several derived classes
Builder : Separates object construction from its representation

Prototype : A fully initialized instance to be copied or cloned
Singleton : A class of which only a single instance can exist

Structural patterns

This design patterns is all about Class and Object composition. Structural class-creation patterns use inheritance to compose interfaces. Structural object-patterns define ways to compose objects to obtain new functionality.

Adaptor : Match interfaces of different classes
Bridge : Separates an object’s interface from its implementation
Decorator : Add responsibilities to objects dynamically
Facade : A single class that represents an entire subsystem
Proxy : An object representing another object

Behavioral patterns
This design patterns is all about Class's objects communication. Behavioral patterns are those patterns that are most specifically concerned with communication between objects.

Chain of responsibilty : A way of passing a request between a chain of objects
Command : Encapsulate a command request as an object
Interpreter : A way to include language elements in a program
Iterator : Sequentially access the elements of a collection
Observer : A way of notifying change to a number of classes
State : Alter an object's behavior when its state changes
Visitor : Defines a new operation to a class without change




Now we will pick the popular and commonly used design pattern and explain in detail.
Staring with the Factory Pattern.


What is a "factory" and why would you want to use one?
A factory, in this context, is a piece of software that implements one of the "factory" design patterns introduced . In general, a factory implementation is useful when you need one object to control the creation of and/or access to other objects. By using a factory in RMI, you can reduce the number of objects that you need to register with the RMI registry.

Examples of Factories in the Real World:
The Bank
The Library
These two example is sufficient to understand the actual process of the Factory Patterns. These examples are from the real life.

Let's take the example, commonly illustrated in the text book, GoF.
Widgets in a GUI Environment.
This example explains , how an Abstract Factory can be used to create widgets for a GUI environment. By designing the client to use the Abstract Factory interface, different factories can be created to generate different sets of widgets without requiring changes to the clients. This example is not intended to illustrate a useful implementation of Abstract Factory, as Java's AWT and Swing do the work for you, but it does show how easily design patterns can be implemented in RMI.
One other point to notice is how the pattern is split between client and server. This split was arbitrarily chosen, and with RMIs object-oriented nature you could decide to make the split in the pattern elsewhere.

In General , this pattern consists of two class hierarchies, one of Products, and one of Creators. Each ConcreteCreator class creates instances of specific ConcreteProduct classes using a factory method.

The factory pattern can help solve your application issues. For example, developers often must reply to users based on each user’s machine, creating multiple hardware issues. The factory pattern can streamline the process. The concept is simple, but the solutions created with the factory pattern are powerful.

For more understanding, let's take one more example.
Communications breakdown
Consider the example of a data collection application where various field devices supply data to the application via TCP/IP sockets. The application was originally written to communicate with one device but was expanded when the company produced a newer version. Unfortunately, this new hardware did not speak the same language as the previous version. Marketing required the application to support both hardware versions, since customers might buy new units and install them in tandem with older units. The factory pattern eased the burden of supporting multiple device types.

In short and effective explanation of fatory pattern is :
=> if we have a super class and n sub-classes, and based on data provided, we have to return the object of one of the sub-classes, we use a factory pattern.

Now, we will focus on the positive and negative points on using the Factory Patterns.
Positives:
-Eliminates the need to bind application-specific classes into your code
-Provides hooks for subclassing. Creating objects inside a class with a factory method is always more flexible than creating an object directly. This method gives subclasses a hook for providing an extended version of an object.
-Connects parallel heirarchies. Factory method localises knowledge of which classes belong together. Parallel class heirarchies result when a class delegates some of its responsibilities to a separate class.
Negatives:
-Clients might have to subclass the Creator class just to create a particular Concreate object.

>














Tuesday, 25 March 2008

Fear About US Recession.. Impact on Jobs


US market recession is almost declared, till now it was just a fear about the condition, by the time Mr. Warren Buffett admitted in his recent Interview and accepted about the chances of recession in US, and it could go even worst till ever happened.

Since US market is predominately considerable and play a major role all over the world' s economy, in all trades and businesses. So it's quite obvious to get scared from this situation.
Being an IT professional it's an obvious concern and worry to look into and know what is the scenario. To know, the fact and figures why are the people really scared about.

Curiously and sacredly I tried to compile the scenarios, which is I am sharing with . Most of the data I have taken the reference with nytimes.

The job market took a serious and unexpected turn for the worse in August, raising fears that the risks of a recession are greater than many economists had believed.

According to "The New York Times" , the economy shed 4,000 jobs between July and August, with industries that are connected to the housing market — like construction and manufacturing — making the deepest cuts, the Labor Department reported today. It was the first employment decline since 2003, when the job market was still struggling to emerge from a long slump in the wake of the 2001 recession.

The unemployment rate held steady at 4.6 percent in August, which economists said was likely a statistical fluke as more people stopped looking for work and were therefore not counted by the government as unemployed.

“If the economy is not headed toward recession, it is very close to one,” said Mark Zandi, chief economist in one of the .com site interview.

Stocks fell broadly and sharply, as investors digested the idea that the economy had been weakening significantly even before the mortgage crisis hit financial markets last month. The Dow Jones industrial average closed down almost 250 points, or 1.9 percent.
The jobs report all but guarantees that the Federal Reserve will cut its benchmark short-term interest rate when its policy-making committee meets on Sept. 18. A quarter-point reduction to 5 percent remains the most probable move, although a half-point cut now cannot be ruled out, economists said.

The weakness of the employment data seemed to change the terms of the debate over the health of the economy. The chances of a recession over the next year now seem to be somewhere between one-quarter and one-half, economists interviewed today said.
“I think at least people need to start thinking about the housing market not just as some ring fence problem which is off on its own, and the rest of the economy is doing just fine,” said Nigel Gault, chief United Economist with Global Insight, an economic research firm in Lexington, Mass. “They need to start worrying about the health of the broader economy.”

The Bush administration tried to defuse concerns that the weak jobs numbers hinted at a wider economic slowdown.

In an interview , the Treasury secretary, said the report was “not totally surprising.”
“There will be news that isn’t always good news,” he said. “But I feel quite strongly that we have a resilient economy.”


For months, Fed officials and Wall Street forecasters have been predicting that the housing slump would slow the economy, but that other strengths — like corporate earnings, growth in other countries and strong wage growth — would keep the slowdown from being severe. That could still happen; in both the 1980s and 1990s economic expansions, employment fell at least once before quickly reversing course.

“The financial turmoil and extended problems in housing put the risks for the economy clearly to the downside — no question,” said Mickey Levy, chief economist for
Bank of America. “But there are also factors that suggest a longer period of slower growth, but not recession.”

One of the most worrisome signs in the jobs report was the government’s revision to its employment data for June and July. The new numbers show just under 70,000 jobs created in each of the two months, down from an average of almost 110,000 according to its initial estimates.

In 2005 and 2006, the average monthly job growth was slightly above 200,000.
The sharp slowdown this year suggests that some employers have already begun to see a downturn in their business and others believe that one is on the way. With falling house prices in most of the country and rising oil prices, consumer spending has slowed modestly in recent months.

State and local government agencies, many of them dealing with budget shortfalls connected to the housing slump, have also cut an average of 27,000 jobs a month over the last three months. But economists said the declines in government employment, especially in schools, may have reflected seasonal quirks that made the job market look worse last month than it truly was.
Hospitals, doctors’ offices, restaurants and retailers all added jobs in August.

But the bright spots were few and far between. Employment in the finance sector — which includes real estate agencies and accounts for about 8.5 million of the country’s 138 million jobs — was flat in August, which could be a sign that the government numbers have not yet captured some of the mortgage-related job cuts now occurring.

The surveys that made up the Labor Department report measured employment from Aug. 12 to Aug. 18, when the credit squeeze and subsequent stock market turmoil were under way but not fully felt. Since then, some large lenders like Countrywide and
Lehman Brothers have continued to lay off workers. And just today, IndyMac Bancorp, a large mortgage lender, said it would be cutting about 1,000 jobs over the next several months.

“There probably was not that much influence in the data from the credit shock,” said Richard Berner, chief United States economist at
Morgan Stanley. “So I think more weakness in the economy is likely. The economy is clearly losing momentum.”

The extent to which the economy continues to lose momentum will determine the Fed’s course of action. The price of a futures contract tied to Fed policy shows that the central bank will probably cut the benchmark rate, now at 5.25 percent, to 4.5 percent by the end of the year. But a growing number of economists are saying that might not be soon enough.

Mr. Gault of Global Insight, who is forecasting a half-point cut on Sept. 18, said it would send “an important message that the Fed sees there are real problems here, there’s a real threat, and it needs to have a response that’s commensurate to that threat.”

Although the unemployment rate held steady at 4.6 percent, the percentage of adults with jobs fell to 62.8 percent, from 63 percent in July and a peak of 63.4 percent in December. The number of people who were neither working nor looking for work — and thus considered neither employed nor unemployed by the government — rose by almost 600,000 in August.

“That’s a sign of economic weakness,” Mr. Anderson, of
Wells Fargo, said. “Perhaps people just gave up trying to find jobs.”
The number of people with part-time jobs who said they would prefer to full time has also been rising in recent months. In August, the Labor Department classified 4.5 million workers as “part time for economic reasons,” up from 4.3 million in July.

Wage growth, which often lags behind job growth, did continue at roughly its recent pace. Average hourly earnings for rank-and-file workers — who make up about four-fifths of the work force — have increased 3.9 percent over the last year, to $17.50. Inflation has been running at about 2.5 percent a year.

Wall Street had eagerly awaited the jobs report because it was the most significant economic data released since financial markets began to tumble in early August. If the jobs report had been merely lackluster, it might have been welcomed by investors as a sign that a Fed rate cut all but certain and the economy was still growing at a healthy pace.

The reversal in job growth, however, was far different from the gain of roughly 100,000 jobs that Wall Street was expecting, raising worries that corporate profits will weaken as the market upheaval moves beyond the housing and financial sectors.
<<All these data, statistics and above figure stats, I have complied through internet sites and other sources.>>

Friday, 21 March 2008

DON'T CHALLENGE MECHANICAL FOR IT...


General Motors REPLY TO BILL GATES...

At a recent computer expo (COMDEX), Bill Gates reportedly compared the computer industry with the auto industry and stated, "If GM had kept up with technology like the computer industry has, we would all be driving $25.00 cars that got 1,000 miles to the gallon."

In response to Bill's comments, General Motors issued a press release Stating:

"If GM had developed technology like microsoft, we would all be driving cars with the following characteristics (and I just love this part, esp 7th point and 10'th point):

1. For no reason whatsoever, your car would crash twice a day.

2. Every time they repainted the lines in the road, you would have to buy a new car.

3. Occasionally your car would die on the freeway for no reason. You would have to pull to the side of the road, close all of the windows, shut off the car, restart it, and reopen the windows before you could continue. For some reason you would simply accept this.

4. Occasionally, executing a maneuver such as a left turn would cause your car to shut down and refuse to restart, in which case you would have to reinstall the engine.

5. Macintosh would make a car that was powered by the sun, was reliable, five times as fast and twice as easy to drive - but would ! run on only five percent of the roads.

6. The oil, water temperature, and alternator warning lights would all be replaced by a single "This Car Has Performed an Illegal Operation" warning light.

7. The airbag system would ask "Are you sure?" before deploying.

8. Occasionally, for no reason whatsoever, your car would lock you out and refuse to let you in until you simultaneously lifted the door handle, turned the key and grabbed hold of the radio antenna. (Read CTR-ALT-DEL)

9. Every time a new car was introduced car buyers would have to learn how to drive all over again because none of the controls would operate in the same manner as the old car.

10. You'd have to press the "Start" button to turn the engine off. "

Are you Serial Killer!!!

Test your self...

A woman, while at the funeral of her own mother, met a guy whom she did not know. She thought this guy was amazing.

She believed him to be her dream guy so much, that she fell in love with him right there, but never asked for his number and could not find him.
A few days later she killed her sister.

Question: What is her motive for killing her sister?

Management Lesson...

Big John doesn't pay!

One fine day, a bus driver went to the bus garage, started his bus, and drove off along the route. No problems for the first few stops - a few people got on, a few got off, and things went generally well. At the next stop, however, a big hulk of a guy got on. Six feet eight, built like a wrestler, arms hanging down to the ground. He glared at the driver and said, "Big John doesn't pay!" and sat down at the back.

Did I mention that the driver was five feet three, thin, and basically meek? Well, he was. Naturally, he didn't argue with Big John, but he wasn't happy about it. The next day the same thing happened - Big John got on again, made a show of refusing to pay, and sat down. And the next day, and the next! .

This grated on the bus driver, who started losing sleep over the way Big John was taking advantage of him. Finally he could stand it no longer. He signed up for body building courses, karate, judo, and all that good stuff.

By the end of the summer, he had become quite strong; what's more, he felt really good about himself. So on the next Monday, when Big John once again got on the bus and said, "Big John doesn't pay!"

The driver stood up, glared back at the passenger, and screamed, "And why not?" With a surprised look on his face, Big John replied, "Big John has a bus pass."

Management Lesson :
"Be sure there is a problem in the first pla ce before working hard to solve one."

Saturday, 8 March 2008

What is ESP, Do you believe in?

"ESP, extra-sensory perception, is most commonly called the "sixth sense." ESP is an ability beyond the normal.
It means you have experiences with spirits, future events, and psychic dreams. ESP is an ability that most cant control, but a lot of people are gaining knowledge, and warnings from it. So ESP is what it says: Extra Sensory Precept ion.

I personally believes in; there is some super natural happening that is beyond our control. There is something which is controlling ourselves. I strongly believe in palmistry , astrology, numerology and the behaviour psychology of humans studies . There could be any future predictions can be done on the combination of all these and that too very accurate.

There would be many who disagree with me, in this context.

I believe every one is having some sixth sense or ESP , which could clearly indicate about the good or bad happenings , in the form of different omens . Everyone is having the ability, whether or not its just sensing things, or dreaming things. Whether the people believe it or not, this is having all of us.
It's just a matter of sensing and concentrating over.

There are many evidences which is helpful in demonstrating that ESP does exist. I was going through some forum or some book, that ESP cannot be explained or quantified by physical laws; and furthermore, that the mind (consciousness) and the brain are two separate entities. Simultaneously, research in quantum physics points to the existence of a second, non material universe. So, the time is fast approaching when Western scientists must come to terms with the Eastern mystical concept: "that an extrasensory force exists in another realty, and intersects and integrates with the physical world."

There are much more studies or the believing which could be framed in this categories , like
if someone can tell a lot about you without knowing you. This is known as cold reading, and it's based upon observing the way you look and act. Like it can easily be guessed , the way you dress tells a lot about your social standing, and there are lots of other little things to look for. This I guess we can develop the ability using Human Psychology.

One more thing I am interested in is Aura. Aura is an energy around you. Studies evolves around energy colors like : Blue, green, red, black, white, orange, yellow, sky blue.

But I don't know much details about this , and definitely would like to know much about Aura. That how these energy color impact on us positively or negatively . How we can make the maximum benefits of these color energies.

Thailand


Another beautiful destination of southeast destination... Thailand. Captital is Bangtok
It is having rich natural beauty, inspiring temples, and famous for the it;s hospitality.

Taiwan



Amazing Taiwan...
Taiwan is located in Southeast Asia, to the southwest of to the west is the Taiwan Strait beyond which is China.

Taipei, is the capital to this small Island. Taiwan is having it's own repo and identity in Southend Asia.

Taiwan is like a small, crowded island filled mostly with electronic factories, and if you stay in Taipei or along the west coast you might indeed maintain the illusion, but the island has some surprisingly lofty peaks and it's definitely worthwhile to explore the mountains and national parks of interior.

It's so beautiful hitech small and enchanting country.






Friday, 7 March 2008

Way to Seoul..



Seoul International Fireworks Festival !!!

...Struck at midnight in Seoul



When: Oct 2007; Annual festival.
Where: Hangang River Citizen's Park, Seoul
















Fortunately, the day we planned for the Seoul trip , was also the Day was engaged for the Seoul International Fireworks Festival ... It was amazing , astonishing , wonderful and my life time experience for such a beauty and liveliness.


Candidly, it was too crowd that day... all trains , Metros, buses were over packed from there original capacity. I was not excepting such a huge crowd. Though I am very used to see the crowd n population but still i was feeling bit suffocating.

Ultimately after some struggle , we reached around the place from where I was comfortable to see the actual fire show. There were amazing .. crowd ....crowd ....crowd ever where on the ground and the sparkling fires on the air.












About this Festival , I have had read in some books earlier. But could not believe and express , How i was feeling at that particular span of time. All were localites and the foreigners from many more countries enjoying the show. I was mum and indeed feeling the warmth of the fire of fireworks. Ppl making the strange noises as soon as any rocket or any thing sparkling going towards the sky... and the light not only coming thru the sky.. but the reflection from the River just making it sizzling...

Later, I came to know about the festival :Live classical and pop performances, light and laser shows set the scene for the dazzling firework display over Seoul's Hangang River Citizen's Park at the annual Seoul International Fireworks Festival.




















The festival sends over 55,000 fireworks into the sky and welcomes many big names in the pyrotechnic industry.

So many thing not only happening over the sky , but besides me too... young couples also enjoying each other's company and the show.

Ohoo, I was indeed missing my SLR at this moment, but I had my 8 mega pixel Sony digicam, with having the limited battery backup. But I manage to take the some cool pics as well the video of the show.

After the fire show over, at around 10:00PM at nite, we move towards looking something to eat. Just in this situation it was just a matter of realization to me, that the too much crowd is just a only uncontrollable and unmanageable situation. But it was just a matter of few hour , as soon as the crowd shattered, all the thing become like it was before , the clean , neat and tidy.




















We had something to eat in McDo' situated the Hang river bank. Took some pics.
Enjoying the real big event really made us tied. Went to the near by Metro station took the train, manage to reach just a half way. Our destination was the Suwon city but it was the 12:00 nite , sorry no train available, guard in platform updated , so the next train is only in the morning 5:00 am.


What to do???? we were 8 actually, some wanted to go back to guest house which was in Suwon city some wanted to enjoy the nite life of the ittewon market.
OK majority wanted to have rest and go back to suwon, asked for taxi . Initially no taxi walla was willing to go that far at this mid night, if one agree was asking for the too much fare and we at least need two taxis . So again decided , majority call was to save money. So how to pass the time 5-6 hrs without doing anything . We struck in between the Seoul and suwon, no taxi wala wanted to go to itewon as it was not so far , to get them enough money . seeing the 8 guys that to foreigners in the midnight.








We were helpless, we were stuck .. midnight at foreign land where there is again the language problems in general.
Spending around 1-1.5 hrs discussing what to do, I got reason to smile for a moment to myself Thanks to Departmental store, Thanks to my capability to drink( it provide us especially me the reason to smile for dat particular moment). We could get at least the beers and smoke. just for a shake of passing the time. We did that and we did it too hard.

Suddenly one of us who thinks "consuming alcohol is not a good habit" roaming here and there just to avoid the drunkers ...........calling shouted,

Hey !!! we got the place where we could spend rest of the night.. Ahaaa the massage center open 24x7 very close to railway station . We all decided to spend the night there and go back by early morning metro train. All of sudden all the tried faces sparking like fireworks , Candidly we were feeling like we got some thing great.

Spent whole night there relaxing, massaging , bathing with water temperature. We were quite energetic by now. Now it was a turn to decide, again . Whether go back to Seoul and just visit the rest of the places which we left day before, or to go Suwon city guest house.

Group splitted over this opinion, being a travel freak I decide to move on towards Seoul.

Aaah!!! it was rite decision I guess, reaching Seoul took the tourist bus, the fare was nominal only 10000 Won for full day , visited no. of decided place to freak.


Manage to visit several places. It was a great two days visit. The fireworks show was the worth experience of life time , And also not able to forget that night in some unknown place, where all of happening happened.


Just sharing my few pics from my cutiee cutiee digicam of 8 mega pics. Which I manage to get at that particular moment. Though I am very very find of photography , still I don't consider this taken pictures is my best. these all pics are originally from my camera.

It's just a matter of perfect timing click.

Look at the view , amazing and astonish.
























Wow , captured feather flying in the sky...

Hosts responsive enough ;on festival day.
<>

Friends !! Welcome to Seoul International Fireworks Festival ...
<>

Wednesday, 5 March 2008

Way to South Korea...












Short trip to South Korea ...


Recently I visited to South Korea, it was the short trip , but very exciting. It's not so big country but it is an exciting, developed managed country . Korea is littered with fortresses, temples and palaces, many of them UNESCO World Heritage sites. The capital Seoul winds around the Han River(above snap, shows Han river view at night) punctuated by futuristic skyscrapers in one of the most densely populated areas in the world.






















River Han is a main centric attention during the visit, Han River once marked the southern boundary, the city has sprawled across to the southern side with some 2 dozen bridges crossing it and one subway tunnel underneath. Across the Han River the modern city is dominated by Korea's World Trade Center, and the Coex Mall, a shopper's delight.

Seoul has grown into a cosmopolitan city replete with a variety of modern facilities and world renowned shopping areas such as Namdaemun Market, Dongdaemun Market, Itaewon and Insa-dong. The nightlife is brilliant.

Seoul is indeed incredibly full of different attractions. Due to some time shotage , i was manage to roam around some places only. Sharing some of the pics related to my visit.








Seoul tower is amazing. The Children’s Grand Park is one of the largest children's parks in Asia. It includes a zoo, a botanical garden, an amusement park, outdoor concert stages and physical training facilities.Other great attractions of Seoul include the Kyongbokkung Palace, the Toksugung Palace, the Changdokkung Palace.



Incheon is a big newly build airport , which is close to Seoul, the capital.


I had to travel to Suwon City , the city developed during football world cup. It is having the head quaters of the electronics giant Samsung.




Overall it was the nice trip , I like the country , the culture the facilities. The people really respond well , I astonished to notice about them they are not unfamiliar to Indians and Indian culture. I received well and equally good response, as foreigner .





Captured very soothing place to live in...






I manage to get the air Tickets in of Thai airways while going to South Korea.
And while coming back , I got the direct flight of Asiana Airways.

She walks in Beauty...

She walks in Beauty...

SHE walks in beauty, like the night
Of cloudless climes and starry skies;
And all that 's best of dark and bright
Meet in her aspect and her eyes:
Thus mellow'd to that tender light

Which heaven to gaudy day denies.
One shade the more, one ray the less,
Had half impair'd the nameless grace
Which waves in every raven tress,
Or softly lightens o'er her face;

Where thoughts serenely sweet express
How pure, how dear their dwelling-place.
And on that cheek, and o'er that brow,
So soft, so calm, yet eloquent,

The smiles that win, the tints that glow,
But tell of days in goodness spent,
A mind at peace with all below,
A heart whose love is innocent!-- Lord Byron, (George Gordon)

The poetry by Lord Byron , indeed an amazing one. Every time i read it, it's skech a very lively image infront of my deep big eyes...

Being poetic by nature , i really appreciate it's each n every line. Infact i can feel the way she is mving infront of me... Especially the first four lines , it could be a great start to any poetry or your imaginations.