emilybache / tennis-refactoring-kata Goto Github PK
View Code? Open in Web Editor NEWThis is a Refactoring Kata based on the rules of Tennis
Home Page: https://youtu.be/XifUs1FhWRc
License: MIT License
This is a Refactoring Kata based on the rules of Tennis
Home Page: https://youtu.be/XifUs1FhWRc
License: MIT License
Not sure if that was an intention, but the test suit didn't find that out ;)
...or, rather, they take the user to a page offering them to buy the domain name.
Having used the Java version of the kata I've found it a bit complicated to "get the code into the IDE", e.g. make the IDE recognize the source folders etc. (at least using Eclipse). I think this could be made easier by using a build management tool like Maven or Gradle as the corresponding plugins for Eclipse and IntelliJ allow to easily import Java projects managed by one of the tools mentioned. Additionally, dependencies like JUnit or Hamcrest could be declared so that users of the kata would need to add them manually to the project (or depend on their IDE to user the version shipped with it).
Would this be a welcomed pull request? If so I could provide a build file for Maven and/or Gradle.
Many of the teams I coach in C use googletest, so it seemed like a good idea to have gtest as an alternative to cmocka. So I had a go at a translation, and put it in the subfolder 'c_gtest'. Unfortunately my skills with C and gtest and CMake are really not up to it, and there is a lot of duplication in the test code, and if we're honest, more than's necessary in the production code header files. Anyway I thought I'd put it out there as an issue in case there's anyone who would like to improve on my attempts and send me a pull request :-)
Hola, he leido tu código y he encontrado lineas de código en la clase TennisGame2 que no tienen ningún uso ni aportan funcionalidad a tu programa, por lo que te recomendaría usar una técnica de refactorización para solucionar esto.
Técnica de refactorización: Te recomiendo que elimines esta parte de tu código y la pongas cuando realmente vayas a usarla para que no compliques el entendimiento del mismo
Ojala te sirva de ayuda.
14.15.4
6.14.10
After installing dependencies and running npm run test
the outcome is:
> [email protected] test C:\Users\Carlotta\workspaces\Tennis-Refactoring-Kata\typescript
> TS_NODE_FAST=true mocha --compilers ts:./node_modules/ts-node/register 'tests/**/*.test.ts'
"TS_NODE_FAST" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `TS_NODE_FAST=true mocha --compilers ts:./node_modules/ts-node/register 'tests/**/*.test.ts'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Carlotta\AppData\Roaming\npm-cache\_logs\2021-08-31T10_58_41_043Z-debug.log
PS C:\Users\Carlotta\workspaces\Tennis-Refactoring-Kata\typescript> code .
PS C:\Users\Carlotta\workspaces\Tennis-Refactoring-Kata\typescript> npm run test
> [email protected] test C:\Users\Carlotta\workspaces\Tennis-Refactoring-Kata\typescript
> mocha --compilers ts:./node_modules/ts-node/register 'tests/**/*.test.ts'
Warning: Could not find any test files matching pattern: 'tests/**/*.test.ts'
No test files found
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `mocha --compilers ts:./node_modules/ts-node/register 'tests/**/*.test.ts'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Carlotta\AppData\Roaming\npm-cache\_logs\2021-08-31T10_59_15_620Z-debug.log
The introductory text suggests that refactoring is just a means to spend some billable hours on a project. That paints a dangerously wrong picture to some people. Wouldn't it suffice to say that e.g. "you" have been tasked with adding a new feature to the program and decided to clean up first?
For people not used to using NUnit, the following things would be of great help:
I will send a pull request.
Hola, revise tu proyecto y hay cosas que podrías cambiar para facilitar el entendimiento del mismo.
En tu clase TennisGame1 tienes una sentencia switch case en el método getScore(), la cual no esta mal pero sin embargo "daña" tu código visualmente por lo que te recomiendo refactorizar este método.
Técnica de refactorización: Para este tipo de code smell te recomiendo extraer esta sentencia en un nuevo método y con el fin de deshacerte del switch-case puedes usar enum, para encapsular los casos del switch.
I cloned the repo. Try to run the CSharp tests but an error occurs:
"No test is available in D:**\Tennis-Refactoring-Kata\csharp\Tennis\bin\Debug\net5.0\Tennis.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again"
I'm not sure how to fix this.
Hola, revisando tu código detalladamente he detectado un code smell bastante común, primitive obsession este code smell se debe a que usas string para crear los jugadores lo cual complica un poco añadir nuevas funcionalidades al programa.
Técnica de Refactorización: Te recomiendo refactorizar este code smell usando clases en lugar de datos primitivos, podrías crear una clase Player que guarde los datos basicos del jugador y una clase PlayerGameDetails que guarde los datos del jugador referente al juego como su puntaje.
Espero te sirva de ayuda.
First of all thanks for the great collection of Katas
In TennisGame3 WonPoint(playerName)
all languages I checked implement it like this:
WonPoint(playerName)
if playerName == "player1"
So if in "production" we want to know the score of Nadal vs Djokovic Nadal will never score a point or better said each point Nadal scores is counted for Djokovic.
In Python it is different:
if n == self.p1N
Is this difference intentional? Maybe to provoke the question if bugs should be fixed while refactoring.
Hi there,
Just a quick one:
The link from the article on http://coding-is-like-cooking.info/category/code-kata/ to this page is broken.
I am referring to the code in the text "You can get the starting code here.", which points to https://github.com/emilybache/Refactoring-Katas, but rather should point to https://github.com/emilybache/Tennis-Refactoring-Kata/
Cheers,
Yorgos
P.S: Thanks for sharing all this! : )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.