Code Monkey home page Code Monkey logo

kata-securitymanager-ts's Introduction

Security Manager Kata

The goal here is to refactor this codebase

What is refactoring ?

It means changing the codebase without impacting the observable behaviours

For example:

  • if the execution crashes for one input, after refactoring the execution should still crash for this input
  • if the execution write something in the console, the formatting should still be the same in the console
  • if someone imports my project in another project, his or her project should still work after the refactoring

What are the issues ?

  • Tests

There are no tests, maybe we could do something about this

Note that as there are no tests, you can't be sure you introduce a regression, so how could you make sure you don't introduce a regression ?

  • Dependencies

The method have two implicit dependencies, this could be useful to get rid of them

  • Security

The password security is not really strong enough, could you make it more secure ?

  • TypeScript

This codebase is not really idiomatic TypeScript, do you think you could make it more idiomatic ?

This means that usually, a codebase written in TypeScript shouldn't look like this

What is an implicit dependency ?

function updateUser(string newName) {
    this.name = newName; // explicit dependency
    this.modificationDate = Date.now(); // implicit dependency
}

An explicit dependency is a dependency passed as argument in a function or a class An implicit dependency is not passed as argument, thus you can't know your function or class has this dependency only by looking at it's signature

import { tokenGenerator } from '@myCompany/token-generator';

class UserUpdater {

    constructor(
        private repository: UserRepository, // explicit dependency
    ) {
        this.token = tokenGenerator(); // implicit dependency
    }

}

Source

https://www.devjoy.com/blog/legacy-code-katas/

kata-securitymanager-ts's People

Contributors

fredericespiau avatar

Stargazers

Guilherme Gomes avatar

Watchers

James Cloos avatar  avatar

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.