Skip to main content
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 ...
spyr03's user avatar
  • 3,032
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 <...
Graipher's user avatar
  • 41.1k
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 ...
Lars Wissler's user avatar
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 ...
Quuxplusone's user avatar
  • 19.4k
5 votes
Accepted

Abstract Factory in C++

Decide Which Pattern You are Implementing Do you actually want an abstract factory type that can hold different types of factories? Are you going to need, say, a hash table that looks up factories of ...
Davislor's user avatar
  • 8,344
3 votes
Accepted

The Abstract Factory design pattern as a Database Operations program

Does the above code implements the Abstract Factory design pattern correctly? No. First, it is wildly overcomplicated. It seems ridiculous to need four different class hierarchies just to do a ...
indi's user avatar
  • 13.7k
3 votes

Chess game for my students

It has been some time since I asked the question. I used your advice to improve the code and gave it as an exercise to my students. It's been a tremendous success. I will detail some of the ...
Infinity's user avatar
  • 505
3 votes
Accepted

Mocking objects using abstract factory

Here're a couple of issues that struck me most... Instead of writing lengthy if/else if/else trees you should use early returns with simple ...
t3chb0t's user avatar
  • 44.3k
2 votes
Accepted

Deserializing a customly formatted string

OK, so I'll try to review that which you have provided. Since you didn't post all the relevant code, I might have misunderstood some of your descriptions, so I'll base my review on how I understood ...
Stingy's user avatar
  • 2,138
2 votes
Accepted

Abstract Factory Design Pattern

Includes The includes for std::string seem confused: #include <string.h> That's the C null-terminated string library, ...
Toby Speight's user avatar
  • 81.7k
2 votes

Abstract Factory Design Java

static { factoryMap = new HashMap<String, LoggingFactory>(); } private static HashMap<String, LoggingFactory> factoryMap; can be simplified to ...
Vogel612's user avatar
  • 25.3k
2 votes
Accepted

Combat game - character factory

The CharacterFactory class is created so that I'll be able to handle Orc and Human classes in a more abstract way or so. You try to stay DRY which is very good, but this idea would be better ...
Ludisposed's user avatar
  • 11.6k
2 votes
Accepted

Abstract Factory Pattern in Python

As your code presently stands, you don't need the derived Factory classes. They don't do anything different from each other, so they can all be handled by a concrete base class. ...
AJNeufeld's user avatar
  • 34k
2 votes
Accepted

A refactored payment service, handling several payment schemes

Overall I agree with you, not the review you've been given. I think the sole exception here is their feedback on your AccountExists introduction. I cannot ...
Flater's user avatar
  • 5,542
2 votes

A refactored payment service, handling several payment schemes

AccountExists() doesn't seem a good choice here, as the extra call to the database could be unnecessary to the current project since ...
iSR5's user avatar
  • 5,608
2 votes

Using Factory Design Pattern in Rest Controller of Spring

If you are free to change the request mappings, you should make the distinguishion between "manga" and "conga" in a more restful manner by using the @PathVariable annotation: ...
TorbenPutkonen's user avatar
1 vote

Python3 tokenizer abstract baseclass ( Without the permission to be instantiated directly )

Should a abstract class even contains a init method? In better languages, a typical pattern is to declare abstract constructors as protected so that children can ...
Reinderien's user avatar
  • 65.3k
1 vote

Take meal orders from breakfast, lunch and dinner menus

If things really look the same, they probably are. You were right to add a class hierarchy to implement the common aspects only once, but you seem to have fallen into a few traps. All my comments are ...
Anab's user avatar
  • 385
1 vote

Abstract Factory Implementation C#

The main idea behind abstract factory is that you have multiple different products (sometimes referred as product family) and multiple different factories and you want to centralise the common theme ...
Peter Csala's user avatar
  • 9,849
1 vote
Accepted

Using Factory Design Pattern in Rest Controller of Spring

Welcome to CodeReview. By the code you have shown, using the factory pattern may be overengineering. Unless you plan on adding more services, just use the ...
Miguel Alorda's user avatar
1 vote
Accepted

Best practice for factory pattern in c++?

I’ll start by answering the questions. Questions Is the usage of factory pattern here justified ? 🤷🏼 Going just by what’s visible in the code and your commentary, I don’t see any purpose to ...
indi's user avatar
  • 13.7k
1 vote

Building an email generator using abstract factory pattern

Design patterns provide means to solve common problems. Every pattern has its purpose and allows to solve a particular problem (or more precisely, a class of problems with common aspects). You should ...
slepic's user avatar
  • 5,505
1 vote

Some way to create factory pattern for spring application

Your repositories should have a common method save() and your mappers a mapToTest() that you can define as your interface or base class. Also your test-objects should have a common interface or base ...
Chaarmann's user avatar
1 vote
Accepted

Mock customer DAO using abstract factory pattern in React

render() should know nothing about the source of the data. It only has to know about the ICustomerDAO.listCustomers(). If props are known in the constructor, the DAO objects must be set there too. I'...
A Bravo Dev's user avatar
1 vote

Design Pattern - Abstract Factory Pattern Implementation in PHP

The class Products seems better named as Product (singular) since a table is a type of product, as is a chair. The methods in <...
Sᴀᴍ Onᴇᴌᴀ's user avatar

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