A school management app built using Golang and OOP
Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects(according to educative.io).
Four Principles of OOP
The four pillars of object oriented programming are:
- Inheritance: child classes inherit data and behaviours from parent class
- Encapsulation: containing information in an object, exposing only selected information
- Abstraction: only exposing high level public methods for accessing an object
- Polymorphism: many methods can do the same task
GO is not purely an OOP language and it can be seen below.
GO achieves inheritance using composition. It achieves Encapsulation by capitalising identifiers which can be exported in the package in which it is defined but uncapitalised identifiers cannot be exported. Interfaces are used to create abstraction and polymorphism which can be used by multiple types.
A school as we know is made up of staffs and students. The project involved creating a struct of these key players in a school and then creating a method for each of the functions performed by the key players.
Examples of functions performed by a principal includes;
- admit applicant(s) into the school,
- expel a student,
- sack a teacher,
- employ a teacher, and so on …
Steps taken in achieving this project;
- Created a struct containing the necessary fields for principal, students, applicants, classes, courses, teachers, and staffs.
- Principal, teachers and non-academic staff was embedded in the staff struct, courses and classes struct was embedded in the students struct.
- A slice of student database of type students was used as the students database, which is a global variable( var StudentDB []Students ), same was done for teachers( var TeacherDB []Teachers ) and applicants ( var ApplicantDB []Applicants ).
- The databases were populated with their fields of mock data.
- Methods was created for the different players in the school like the examples given above.
Below is a link to the repository on github: https://github.com/vivcis/-a-school-management-system-using-OOP-