A school management app built using Golang and OOP

Cecilia Orji
3 min readApr 2, 2022

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.

above is a response on the go.dev/faq documentation answering the question if GO is an OOP language

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.

step 1: an applicant DB, principal and applicants structs with its fields
step 2: a method where the principal can admit applicant

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 …
a students, classes and courses structs and a slice of type Students used as the student DB

Steps taken in achieving this project;

  1. Created a struct containing the necessary fields for principal, students, applicants, classes, courses, teachers, and staffs.
  2. Principal, teachers and non-academic staff was embedded in the staff struct, courses and classes struct was embedded in the students struct.
  3. 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 ).
  4. The databases were populated with their fields of mock data.
  5. Methods was created for the different players in the school like the examples given above.
a terminal printout of the studentDB

Below is a link to the repository on github: https://github.com/vivcis/-a-school-management-system-using-OOP-

--

--

Cecilia Orji

A Golang developer | love programming as it helps to solve problems | hobbies : listening to radio, reading and a good Kdrama