Friday, January 17, 2014

Facade Design Pattern

The facade pattern collects a group of related objects and provides a single user interface to access these objects.

public abstract class Event {
      protected Calendar date;
      protected String place;
      protected String topic;

      public Event (Calendar date, String place, String topic) {
            this.date = date;
            this.place = place;
            this.topic = topic;
      }

      public abstract void addToSchedule();
}


public class Meeting extends Event {
   
      public void addToSchedule() {
            //add meeting to schedule
      }
}


public class Interview extends Event {
      public void addToSchedule() {
            //add interview to schedule
      }
}


//The single user interface
public class EventScheduler {
      private Event event;

      public void scheduleMeeting(Calendar d, String p, String t) {
            event = new Meeting(d, p, t);
            event.addToScehdule();
      }

      public void scheduleInterview(Calendar d, String p, String t) {
            event = new Interview (d, p, t);
            event.addToScehdule();
      }
}

---------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.


No comments:

Post a Comment