Giter VIP home page Giter VIP logo

emilybache / tennis-refactoring-kata Goto Github PK

View Code? Open in Web Editor NEW
703.0 20.0 1.3K 1.51 MB

This is a Refactoring Kata based on the rules of Tennis

Home Page: https://youtu.be/XifUs1FhWRc

License: MIT License

C++ 9.95% Python 6.33% C# 6.09% Go 2.09% Java 5.81% JavaScript 7.02% Objective-C 3.20% OCaml 1.57% Perl 2.58% PHP 3.64% Ruby 2.17% Scala 2.47% Makefile 0.14% HTML 2.12% ABAP 5.20% Groovy 1.91% TypeScript 29.86% Swift 2.73% Kotlin 3.56% CMake 1.54%

tennis-refactoring-kata's Issues

Java: use build management tool

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.

GTest translation for C is not very good

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 :-)

Sugerencia code smell Speculative Generality

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.

Test in typescript project are not working

Node Version

14.15.4

Npm version

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

Introductory text is not helpful

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?

C#: Improve the out-of-the-box-experience

For people not used to using NUnit, the following things would be of great help:

  • Provide a solution file
  • Change csproj to a ClassLibrary project, remove then obsolete Main.cs
  • Add nuget package for NUnit
  • Provide a hint how to install the NUnit VsTestAdapter

I will send a pull request.

Sugerencia para code smell Switch Case

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.

CS Tests dont run

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.

Sugerencia code Smell Primitive Obsession

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.

Question to difference in Pythonv vs Java/TypeScript/C# of TennisGame3

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.