Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A program plans train journeys between the towns of a country. A designer has this list of facts about each train.
The departure station and time; the arrival station and time; the stations where it stops; the colour of the train; the name of the driver; whether it has seats for wheelchair users; the number of the platform; the price of a ticket.
Every computer system is made of sub-systems, which are made of further sub-systems. Decompose a problem into its inputs, processes, outputs and storage. Abstraction keeps only the details that matter. A structure diagram shows the system at the top and its parts on each level below.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Step 1. Keep. The stations and times (departure, stops, arrival), the platform, the price, and the wheelchair seats. Each one changes which train a passenger chooses or how they catch it.
Step 2. Leave out. The colour of the train and the name of the driver. Neither changes the journey, so the planner does not need them.
Step 3. The name. Keeping the details that matter and removing the others is abstraction.
Answer: (a) keep stations, times, platform, price and wheelchair seats; leave out the colour and the driver's name, because they do not affect the journey. (b) Abstraction.
Watch out. Some answers depend on the users. If the program were for the train company's staff rota, the driver's name would matter. Abstraction always starts from the problem being solved.
Log in to join the discussion.
Loading…