In this lesson we will learn about:
A pattern is something that repeatedly occurs in many different programming problems.
Patterns exist everywhere. If you were to look at how your day is organised from school to college, you would see that it follows a pattern:
This pattern holds true for each day of the week for most students in most schools and colleges.
This pattern can then be applied to any systems that track and monitor student data, including attendance, punctuality and recording homework marks. Such systems are known as Information Management Systems (IMS).
This is because most schools and colleges follow the same pattern.
This means that one program solution can be used by many different educational organisations.
Recognising patterns – things that are common within or between problems or programs – is one of the key areas of computational thinking.
Think about what you did yesterday, are doing today and are going to do tomorrow. Can you identify any patterns?
Once you identify patterns in your problem, you might find that you need to use the same pattern again and again within your problem.
For example, you might want to display a graph of student attendance. This may be needed by:
This would have the same graph pattern being used twice within the program.
Think about any of the computer programs you are using in your school or college. Can you spot any patterns that might be used by students in other schools?
Once you identify a common pattern, there is more than likely going to be an existing solution to the problem.
For example, you might want to search for a student in a school IMS. To do this, you would need to use a searching algorithm, like a binary or linear search. We will look at searching algorithms later on in the course.
Also, looking at the graph drawing problem from the previous section, Python contains a module called Matplotlib. Matplotlib is a low-level graph plotting library that serves as a simple way of drawing and visualising graphical data.
Matplotlib is open source and can be used freely by anyone. This could be used as a solution for drawing graphs of student attendance.
Matplotlib is one of the modules you are required to know for Paper 1 and the Employer Set Project.
You need to create a relational database. How many different programs are there that will allow you to solve this problem?
Once you have identified a pattern you can speculate whether it can be reused in your existing program or used in another program.
You can also examine the pattern to identify any software or hardware components you might need.
For example, you identify that you need a login system for a program.
You identify the login pattern:
Based on this, you can predict you will need:
Have a look at the following website about the Gang of Four design patterns: https://www.tutorialspoint.com/design_pattern/design_pattern_overview.htm
Can you spot any patterns about the patterns?
So to summarise what we have learned in this lesson: