How to apply OOP to real world examples without putting all logic in Manager classes?

I’m lately trying to implement a specific problem using an object-oriented approach. I get the main principles and its advantages, but I fail to apply it to a real world problem. Most examples one could find consist of Cats or Dogs being implementations of Animal. These however don’t give me enough understanding how to model below problem regarding another frequent example: a school administration system.

Imagine a school having Students, Courses, Professors, and Notes. My implementation would be something like this:

class Person {     string name;     int age;      Person(string name, int age) { = name;         this.age = age;     } }  class Student extends Person {     double gpa;      Student(string name, int age) {         super(name, age);     } }  class Professor extends Person {     string roomNumber;      Professor(string name, int age, string roomNumber) {         super(name, age);         this.roomNumber = roomNumber;     } }  class Course {     string name;     Professor professor;     Students[] student;      Course(string name, Professor professor) { = name;         this.professor = professor;         this.students = new Student[];     }      void enrolStudent(Student student) {         students.add(student);     } }  class Note {     Course course;     Student student;     double value;      Note(Course course, Student student, double value) {         this.course = course;         this.student = student;         this.value = value;     } } 

Now the Student has a bunch of Notes and we want to calculate its GPA. This could be either straightforward averaging its Notes‘ values or more complex logic using weights and/or ignoring optional courses.

Now my question is: where do we put this logic? Ideally I would have a function double calculateGpa() on Student so you could call student.calculateGpa(), but having this logic on Student would break the SRP in my view. It also does not belong to any other class listed here. A class called GpaCalculator or NotesManager would be another guess but that seems to me too much like moving all the logic away from the domain and into classes that do not represent a real object but just actions (see also this answer).

If that would be the way to go here, why wouldn’t I then just write a pure, static, stateless function in a class called NotesHelper? Creating a manager class to just have one function double calculate(), and using its instance instead of a static function feels to me like making it look like OOP while it isn’t really. I feel like there should be a better approach, probably one I didn’t think of, or maybe I am wrong here. Could you guys give me some pointers?


SRP violation confusion based on examples

I am trying to gain better understanding on SRP and when I was checking out a Pluralsight video by Scott Allen, I saw code like this:

public class DiskBook : Book     {         public DiskBook(string name) : base(name)         {         }          public override event GradeAddedDelegate GradeAdded;          public override void AddGrade(double grade)         {             using(var writer = File.AppendText($  "{Name}.txt"))             {                                 writer.WriteLine(grade);                 if(GradeAdded != null)                 {                     GradeAdded(this, new EventArgs());                 }             }         }          public override Statistics GetStatistics()         {             var result = new Statistics();              using(var reader = File.OpenText($  "{Name}.txt"))             {                 var line = reader.ReadLine();                 while(line != null)                 {                     var number = double.Parse(line);                     result.Add(number);                     line = reader.ReadLine();                 }             }              return result;         }     } 

Now here Diskbook is responsible to manage grades and Statistics class responsibility is to calculate statistics based on grades but this makes me wonder that having GetStatistics method in DiskBook class doesnt break SRP?

Because as per my understanding if there will be some changes inside Statistics class, then I will have to change logic in GetStatistics method which means now I have 2 reasons to change DiskBook class. Clear SRP violation?

Also in .net framework we have DbConnection class which creates DbCommand like below:

public abstract class DbConnection : Component, IDbConnection, IDisposable {     protected abstract DbCommand CreateDbCommand(); } 

I know this won’t be violating SRP since it is designed and created by .net team but I would like to understand why this is not violating SRP and when does it make sense to do something like this?

What is artificial intelligence with examples?

Artificial intelligence (AI) is a robust innovative AI technology that makes the system self-sufficient to imitate the human working style. According to experts, the intersection of artificial intelligence solutions and energy sector grow as a magical locale. It compresses and analyzes humongous amounts of data produced by the energy industry while providing solutions for solving future problems. Webtunix AI is an artificial intelligence company that provides the best services for lidar annotation, artificial intelligence services, data science and business intelligence consultant services in the USA, Canada, China, Australia, and New York.

Examples of exact computation of Kolmogorov complexity?

First question: It is known that Kolmogorov Complexity (KC) is not computable (systematically). I would like to know if there are any “real-world” examples-applications where the KC has been computed exactly and not approximately through practical compression algorithms.

Second question and I quote from the “Elements of Information Theory” textbook: “one can say “Print out the first 1,239,875,981,825,931 bits of the square root of e.” Allowing 8 bits per character (ASCII), we see that the above unambiguous 73 symbol program demonstrates that the Kolmogorov complexity of this huge number is no greater than (8)( 73) = 584 bits. The fact that there is a simple algorithm to calculate the square root of e provides the saving in descriptive complexity.” Why take the 584 bits as an upper bound for the KC and not include the size of the actual “simple algorithm” that calculates the square root of e?? It is like cheating…

third person essay examples

essay for the great gatsby to kill a mockingbird essay conclusion essay on video games objective essay example city essay argumentative essay examples on abortion blessing in disguise essay examples of essays about life argumentative essay video example of exposition essay
essay on mars planet…

third person essay examples

lyric essay examples

good topics for cause and effect essays what is your future plan essay essay on hawaii persuasive essay samples high school horror movie essay essay on karl marx my family essay example contrast essay essay on good manners
homosexuality essay…

lyric essay examples

bullying essay examples

essay editor apa sample essays respect essay for students essay on being a leader essays on yoga legalizing weed essay college essay sample foreign policy essay cause and effect of air pollution essay essay writing for high school students
generation essay…

bullying essay examples