Pre-conditions

From Computer Science Wiki
Pre-conditions[1]

Pre-planning is set up or preparation required before a solution is implemented. Packing your lunch is a pre-condition to eating lunch. Bringing your lunch to school is a pre-condition to eating your lunch at school. Logging in is a pre-condition to checking your online bank balance.

Pre-conditions are required because many processes require conditions to be executed. Could you eat your lunch if you didn't pack your lunch? Should you be able to check any bank balance without logging in?

You should be asking yourself "what needs to happen in order for ....... to happen ". This is a practice of thinking you should adopt.

Example[edit]

Scheduling a meeting is a classic example of the importance and need of multiple pre-conditions. In order to have a meeting with someone, we might have the following pre-conditions:

  1. an available place to meet
  2. a time to meet
  3. availability of the people to meet
  4. a topic or agenda

Standards[edit]

These standards are used from the IB Computer Science Subject Guide[2]

  • Identify pre-planning in a suggested problem and solution
  • Explain the need for pre-conditions when executing an algorithm

References[edit]

  1. http://www.flaticon.com/
  2. IB Diploma Programme Computer science guide (first examinations 2014). Cardiff, Wales, United Kingdom: International Baccalaureate Organization. January 2012.