History homework class I'm yrying to practice some OO PHP and I'm just wondering if what I'm doing is okay or not. Please tell me if there are any alarms in my method so that I can stop doing it and learn a better way.

In my conditional statement, I was following the rule of no else keyword, based on this article by William Durand, which talks about Object Calisthenics.

I also don't know if I'm using the abstract properly, being that I learned it just a few minutes ago - but it works, so I suppose it's being used correctly.

&lt;?php

        abstract class Homework
        {
            protected $coursesTaken = 0;
            protected $minimumCourses = 10;

            abstract function completedOrNot();
        }

        class HistoryHomework extends Homework
        {
            public function __construct($coursesTaken)
            {
                $this-&gt;coursesTaken = $coursesTaken;
            }

            public function completedOrNot()
            {
                if ($this-&gt;coursesTaken &gt;= $this-&gt;minimumCourses)
                {
                    return "You completed the course in " . $this-&gt;coursesTaken
                    . " classes, but you only needed " . $this-&gt;minimumCourses
                    . " classes to complete the course! \n\n";
                }

                return "Sorry, you did not complete this course. You only took "
                . $this-&gt;coursesTaken . " classes, and you need a minimum of "
                . $this-&gt;minimumCourses . " to pass. \n\n";
            }
        }

        $student1 = new HistoryHomework(11);
        echo $student1-&gt;completedOrNot(); // You have completed the course in 11 classes, but you only needed 10 classes to complete the course!

        $student2 = new HistoryHomework(7);
        echo $student2-&gt;completedOrNot(); // Sorry, you did not complete this course. You only took 7 classes, and you need a minimum of 10 to pass.
It's opinion-driven, but general points:


You return large strings. Use try/catch for custom errors and warnings.
Manage specific messages separately from your OOP (for example, language files).
Separate layers, such as presentation, application, business logic, etc.


About the further structure: correct, but you didn't post serious logic.

There are many patterns to solve problems, such as Model-View-Controller (separating responsibilities), Adapter pattern, Factory pattern, etc. Read more here.