39
            
            votes
        
            
                
                Accepted
            
        
            
        Chess game for my students
                    I would include a comment at the top of the file indicating the version of the relevant software you've used. A quick comment stating "Tested with Python 3.6 (installed through Anaconda)" or ...
                
            
       
        
            
                19
            
            votes
        
        
        Chess game for my students
                    Since @spyr03's extensive (and awesome) answer did not include it, here are some small comments.
You want this to be an example for your students of how code should look like. You should include a <...
                
            
       
        
            
                14
            
            votes
        
        
            
        Chess game for my students
                    When I think back to my student days, the most crucial point for me to understand code was always the entry point. In my experience, it takes a lot of experience to understand a code concept as a ...
                
            
       
        
            
                10
            
            votes
        
            
                
                Accepted
            
        
            
            
        A simple program with trains and inheritance
                    Coal_ already made some good points. Let's just elaborate on the one about private.
A class makes everything in it ...
                
            
       
        
            
                10
            
            votes
        
        
            
        A simple program with trains and inheritance
                    First, show your teacher the C++ Core Guidelines and various videos from conferences saying that you should not use naked new or ...
                
            
       
        
            
                10
            
            votes
        
            
                
                Accepted
            
        
            
            
        General purpose replacement for enum with FlagsAttribute
                    int NextFlag(string category)
I'd expect this to throw when it runs out of flags.
I really really don't like that the first flag just happens to be ...
                
            
       
        
            
                10
            
            votes
        
            
                
                Accepted
            
        
            
            
        Parsing SFV files to extract and store the hashes
                    This is pretty good! It makes me conscious of my own bias because it follows what I would consider to be my style, but anyway, I don't think there's a lot to pick on here.
Does ...
                
            
       
        
            
                9
            
            votes
        
        
            
            
        General purpose replacement for enum with FlagsAttribute
                    Is this as extendable as I think it is?
Does it work for multi-bit flags? For instance
...
                
            
       
        
            
                9
            
            votes
        
            
                
                Accepted
            
        
            
            
        Classes representing 2D points and pixels
                    A fine example how modern C# can make your life so much easier!
But first things first:
Errors and maybe errors
Your GetHashCode() is realy weak! Just take two example points (1|1) and (0|32) and ...
                
            
       
        
            
                8
            
            votes
        
            
                
                Accepted
            
        
        Better way to add fields to superclass in Java
                    Short answer: no, there's no better way.
There's also nothing wrong with this way of working. You're adding a field that every instance of this class needs to have for your program to work correctly. ...
                
            
       
        
            
                8
            
            votes
        
        
            
            
        
            
                7
            
            votes
        
            
                
                Accepted
            
        
            
            
        OOP modeling of a boat rental system
                    OK, Hello again.
So here are my comments:
You should not have an array of boats in class Rental, but just a reference to a single boat. That boat should be given in the constructor, and a getter and ...
                
            
       
        
            
                7
            
            votes
        
            
                
                Accepted
            
        
            
        OOP modelling of a car agency
                    (Since you're still a student, I might go over the top with some explanations.)
Code Style
Always format your code. Always. (CTRL+SHIFT+F in eclipse and CTRL+ALT+L in intellij). There's also the ...
                
            
       
        
            
                7
            
            votes
        
            
                
                Accepted
            
        
            
        Implementing different types of light sources in a Graphics project
                    Why is LightSource inheriting from IMovable and IRotatable if not every ...
                
            
       
        
            
                7
            
            votes
        
        
        Chess game for my students
                    One thing I don't see mentioned in spyr03's excellent review: I think it's unnecessarily inconsistent (and thus confusing) for you to use mixin classes to implement 100% of the ...
                
            
       
        
            
                7
            
            votes
        
        
            
            
        Parsing SFV files to extract and store the hashes
                    Here are some minor style issues to consider.
Naming
It is common to use plural nouns for array variable names.  For example,
in the from_path function, the ...
                
            
       
        
            
                6
            
            votes
        
        
        A simple program with trains and inheritance
                    Rather than using the distance formula with sqrt(dx^2 + dy^2), use std::hypot:
...
                
            
       
        
            
                6
            
            votes
        
        
            
        A simple program with trains and inheritance
                    I'm especially worried about the main because I know that one must be careful while instancing vectors of "inherited" objects.
I'm really new to C++, so I'm not going to attempt to help you there. ...
                
            
       
        
            
                6
            
            votes
        
        
            
            
        Model animals using inheritance in Java, revised
                    This is better, but you are still missing a lot of basic ideas. I'm going to continue to approach the code review by looking at concepts and suggesting what you need to consider and what you should ...
                
            
       
        
            
                6
            
            votes
        
            
                
                Accepted
            
        
        Abstract base class for binary serialization
                    Basically you have implemented the template method design pattern.
In your case your Serialize method acts as the template method. It contains certain commands (...
                
            
       
        
            
                6
            
            votes
        
            
                
                Accepted
            
        
            
        ostream that counts and discards the characters written to it
                    Areas of concern
Have I missed some important technical requirement when inheriting std::streambuf and std::ostream?
This is ...
                
            
       
        
            
                5
            
            votes
        
        
            
            
        A simple program with trains and inheritance
                    Since most of what I would have said is already in other reviews, I'll just mention one point not already suggested.
Consider a small change in interface
There's nothing currently wrong with the ...
                
            
       
        
            
                5
            
            votes
        
        
            
        Implementing different types of light sources in a Graphics project
                    Overriding RotateX, RotateY and RotateZ to prevent rotation of your point light source is ...
                
            
       
        
            
                5
            
            votes
        
            
                
                Accepted
            
        
            
        Polymorphism and inheritance in C99
                    First of all, the obvious remark is that this needs to be split in multiple files, with a .h/.c pair for each class. Since you haven't done so, you block the possibility to make this truly OO. 
It is ...
                
            
       
        
            
                5
            
            votes
        
            
                
                Accepted
            
        
            
            
        C# classes for system health metrics
                    A design pattern often used, is to have a non generic base type and a generic type derived from it or a type implementing a non generic as well as a generic interface. An example is
...
                
            
       
        
            
                5
            
            votes
        
        
            
        Exercise: Design a Stack
                    Questions:
Why do you use the class field _object? Does it serve any real purpose that a method-local variable cannot?
Why do you implement ...
                
            
       
        
            
                5
            
            votes
        
        
            
            
        Best approach for the Design Pattern for multiple schedulers using interface and abstract class
                    It seems not a good idea to hard code the different constants. I would inject them through the constructor (I am using properties instead of Get-methods):
...
                
            
       
        
            
                5
            
            votes
        
        
            
        C# Coffee Machine
                    I think you misunderstood the task.
In the original task, there was a clear distiction between drinks and ingredients. There was a list of ingredients, each with a name, a price and a stock. There was ...
                
            
       
        
            
                5
            
            votes
        
        
            
            
        Model animals using inheritance in Java
                    I'm not sure how to approach this. You say you've been assigned a problem, so this feels very much like coursework/homework.
Assuming this homework is to be assessed, it's more helpful for the ...
                
            
       
        Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
inheritance × 306object-oriented × 107
c# × 67
c++ × 65
java × 61
python × 51
javascript × 34
polymorphism × 22
beginner × 21
python-3.x × 18
design-patterns × 18
interface × 18
classes × 14
generics × 13
c++11 × 10
php × 8
template × 8
constructor × 7
linked-list × 6
serialization × 6
casting × 6
game × 5
reflection × 5
mixins × 5
.net × 4
 
         
         
         
         
         
         
         
         
         
         
         
        