Git Product home page Git Product logo

pfwtfp-removing-excess-code's Introduction

Removing Excess Code

Objectives

  • Code Along,Recognize common anti-patterns that lead to excess code
  • Identify unused and/or excessive expressions
  • Interpret existing functions to derive purpose
  • Recognize how refactoring code improves readability

Introduction

In this lesson, we will be looking in more detail at part of the process of refactoring - removing excess code.

Tidying up code serves multiple purposes. It makes it easier for our future selves to understand what we've written. But more than that, it also improves our current understanding of the code we've written.

Recognize Common Causes of Excess Code

  • Provide a few code examples that are convoluted, contains extra/unused variables, irrelevant steps for students to clean out.
  • Simple at first to help the student understand the process. Each example can be a slightly different problem.

Some anti-patterns to discuss:

  • Assigning inputs to variables
  • Unused inputs
  • Assigning variables and not using them
  • Overly complicated loops
  • Multiple nested if statements

Applying

  • Using a final, larger code example, go through the process of on unknotting and cleaning up the code by looking for the anti-patterns discussed in the previous section

Conclusion

  • Reiterate value of tidying up code

Resources

pfwtfp-removing-excess-code's People

Contributors

maxwellbenton avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.