GithubHelp home page GithubHelp logo

refactoring-examples's People

Contributors

askmeerp avatar b1ger avatar cmnemoi avatar fahreeve avatar lex111 avatar maykon-oliveira avatar mdczaplicki avatar moritzwachter avatar neochief avatar tsabolov avatar zwieback avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

refactoring-examples's Issues

Again switch case

the last has: speed = bird.getSpeed();

but, to create the bird object shouldn't we again create use the swirch case? like this:

switch (type) {
      case EUROPEAN:
        Bird bird=new European();
      case AFRICAN:
       Bird bird=new African()
      case NORWEGIAN_BLUE:
        Bird bird=new NorwegianBlue()
    }

so, what is purpose for this solution actually? or is there something that i missed?

Replace method with method object example

class Gamma have
private importantValue1 and in method compute int importantValue1 and so on...
should it be better delete fields from class and use local variables in method ?
thx!

"Consolidate Duplicate Conditional Fragments" solution does not address the problem fully

See this problem: https://refactoring.guru/consolidate-duplicate-conditional-fragments

The problematic code is:

if (isSpecialDeal()) {
  total = price * 0.95;
  send();
}
else {
  total = price * 0.98;
  send();
}

The proposed solution is:

if (isSpecialDeal()) {
  total = price * 0.95;
}
else {
  total = price * 0.98;
}
send();

yet it still duplicates the logic of calculating the total.

A better solution would be something like this:

total = price * (isSpecialDeal() ? 0.95 : 0.98);
send();

Would this repo benefit from C++ examples?

Hey there! I stumbled upon your website and have been learning quite a lot about refactoring and design patterns. Thanks for the free content!

I was just wondering if you guys need C++ examples, or examples in any particular language. I see you have C# examples already; I know the two languages are fairly similar except for some OOP semantics, so I was debating the value of adding C++ to the list as a PR.

Thanks!

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.