Skip to main content
Share Your Experience: Take the 2024 Developer Survey
9 votes
Accepted

naive C++ stack template class

Design review So, basically, you would like to remake std::stack. That’s cool, it’s not a bad learning project at all. It is actually possible to make a much better ...
indi's user avatar
  • 11.4k
8 votes
Accepted

Room light controller

Undoing is not the same as executing the opposite command Deduplicator already mentioned this issue, but to clarify it with an example: What if you execute ...
G. Sliepen's user avatar
  • 57.5k
7 votes
Accepted

Extensible sorting algorithm collection

This is a bad example The class Client adds no value to the code whatsoever, in main() you can just call a strategy directly: <...
G. Sliepen's user avatar
  • 57.5k
6 votes
Accepted

A simple text editor

It's indeed a naive implementation Using a single std::string to store the contents of a document is a very naive design for a text editor. While it might be good ...
G. Sliepen's user avatar
  • 57.5k
6 votes

Extensible sorting algorithm collection

I haven't looked extensively, but a couple things immediately stand out to me. Comparison operator In your base class, the interface ISortingStrategy, you accept a ...
cariehl's user avatar
  • 917
6 votes

Room light controller

When you want to support undoing (and redoing) commands, you have basically these options: Save only the commands. This is simple and saves space, but undoing a command means plaing back all commands ...
Deduplicator's user avatar
  • 19.3k
6 votes
Accepted

Using builder pattern and facade pattern in real project

When to use design patterns I wonder if it is suitable to use builder pattern and facade pattern here. The patterns from the book Design Patterns rely exclusively on object oriented features, and ...
G. Sliepen's user avatar
  • 57.5k
4 votes

Semi-generic data loading utility class

single responsibility The review context only says "file 1", but hopefully we're using an instructive name like data_loader.py. I do thank you for the ...
J_H's user avatar
  • 27.6k
3 votes
Accepted

Poker bets on Python

sys.path import sys, os; sys.path.insert(0, os.path.join(os.getcwd(), '')) No, please don't do that. Prefer to have bash set the PYTHONPATH env var properly before ...
J_H's user avatar
  • 27.6k
3 votes

Poker bets on Python

You are calling ask() from within def ask():. This can lead to a stack overflow if it is repeated often enough, like when the <...
Raimund Krämer's user avatar
3 votes

naive C++ stack template class

Thanks to @indi. I have been reading @indi's answer and modifying my implementation for almost two hours. I really can't imagine how long it takes to write this detailed answer. I modify the code with ...
John's user avatar
  • 365
2 votes

Room light controller

Thanks a lot to @G. Sliepen, @Deduplicator. For the reader who reads this post in the future. I do little modification which is detailed explained in the comment for G. Sliepen's inplementaion. ...
John's user avatar
  • 365

Only top scored, non community-wiki answers of a minimum length are eligible