2022 Developer Survey is open! Take survey.

New answers tagged

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 ...
user avatar
  • 1,397
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 ...
user avatar
  • 53.1k
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 ...
user avatar
  • 32.5k
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 ...
user avatar
  • 32.5k
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 ...
user avatar
  • 18.2k
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 ...
user avatar
  • 166
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 ...
user avatar
  • 47.9k
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 ...
user avatar
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 ...
user avatar
  • 7,606
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 ...
user avatar
  • 1,397
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 ...
user avatar
  • 4,293
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 ...
user avatar
  • 798
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 ...
user avatar
  • 47.9k
1 vote

Sudoku Tkinter generator

Avoid import *. For your case, it's easy enough to alias tkinter as import tkinter as tk, ...
user avatar
  • 47.9k
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 ...
user avatar
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 ...
user avatar

Top 50 recent answers are included