New answers tagged object-oriented
0
votes
Snake game as console app in c++
Your code is good. The items I'm going to flag are minor or because I'm an old school developer and not fully comfortable with all this modern C++ shiz. :)
It appears that all your code is in one ...
3
votes
Minesweeper implementation in C++
Separate IO from business logic. From the game point of view it doesn't matter how the user asks to perform the action. With CLI it is "X Y", or "mark X Y", or wharever; with GUI ...
2
votes
Accepted
Minesweeper implementation in C++
Unnecessary memory allocations
You are using new and delete in many places where it is not necessary to do any memory ...
2
votes
Accepted
Adapter pattern in C++ via Inheritance and Composition
Incorrect use of inheritance
There is a problem with class AdapterInheritance. It contains both the member variables of ...
5
votes
Accepted
Blackjack game in C++
General Observations
Playing is fun. There one upgrade could be allowing the player to double down their bet. The program could use some error handling, when the program prompted me with "cash ...
5
votes
Accepted
Create and view a family tree
This is by no means exhaustive, more a list of general highlights on what to focus on rather that deep analysis of the implementation.
Some general pieces of advice first:
Use some coding conventions ...
5
votes
Accepted
Abstract class with different derived signatures in Python
Pretty good!
Overall you have reasonable types, especially Array (though that should only be declared once). But your use of ...
0
votes
Object-oriented design implementation of an Elevator
To model Elevator better, you may have following two options:
Singleton class Elevator which has existence independent of Person.
Rename Elevator to ElevatorTrip. This way ElevatorTrip can exist ...
2
votes
Accepted
Insert row into database using static or non-static method
I think, in "Object-oriented programming", it makes perfect sense to explicitly craft your scripts to handle objects. The ability to chain methods together can help to make your code less ...
1
vote
Accepted
UpdateCustomer - implementation in C++
First thing I'd say is that it will help document your code if you make function arguments const references when you aren't changing them. It might also help performance, but thats normally less ...
1
vote
Class to calculate values of equation ρ = m / v
("Data classes" is entirely the wrong end to get the knack of OO modelling, design & coding.
Look for introductions/tutorials/examples where the are ...
2
votes
Class to calculate values of equation ρ = m / v
I agree that the class is not the right way to organize these calculations unless you will store the values and implement the calculations as part of a larger system. If you are not storing any values ...
12
votes
Accepted
Class to calculate values of equation ρ = m / v
This is not a good application of a class. You will never have all three members to initialise the class, so they all have to be marked Optional. Your class does ...
1
vote
Sudoku Tkinter generator
Avoid import *. For your case, it's easy enough to alias tkinter as import tkinter as tk, ...
3
votes
Tic-Tac-Toe vanilla JS Pseudo OOP
Answering Questions
How to implement a MVC pattern? Right now, the state and HTML elements are global variables, but I think this could be stored in state and UI classes Also, I'm having troubles ...
1
vote
Tic-Tac-Toe vanilla JS Pseudo OOP
It's good for what it is, and the end result looks nice.
I want to suggest you look into Typescript for type safety and readability, a framework like React/Vue/Angular/Svelte to avoid having to do DOM ...
Top 50 recent answers are included
Related Tags
object-oriented × 3767java × 715
python × 674
php × 662
beginner × 462
c++ × 457
c# × 448
javascript × 407
design-patterns × 377
python-3.x × 266
game × 199
performance × 143
classes × 123
inheritance × 109
algorithm × 94
mvc × 93
vba × 87
ruby × 86
playing-cards × 76
programming-challenge × 75
array × 67
mysql × 65
jquery × 63
pdo × 63
ecmascript-6 × 61