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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
2
votes
Abstract Factory Design Java
static {
factoryMap = new HashMap<String, LoggingFactory>();
}
private static HashMap<String, LoggingFactory> factoryMap;
can be simplified to ...
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 ...
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.
...
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 ...
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 ...
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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'...
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 <...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
abstract-factory × 41design-patterns × 14
java × 13
c# × 9
c++ × 8
object-oriented × 8
python × 5
inheritance × 3
factory-method × 3
beginner × 2
python-3.x × 2
php × 2
c++11 × 2
.net × 2
swift × 2
generics × 2
classes × 2
spring × 2
interface × 2
role-playing-game × 2
game × 1
parsing × 1
datetime × 1
unit-testing × 1
comparative-review × 1