Giter VIP home page Giter VIP logo

guessing-game's Introduction

Guessing game

Story

Your friend Victor has done some kind of game in Python but he did it in a somewhat ugly way (no offense, Victor only started coding a couple of weeks ago).

As writing easy-to-understand and easy-to-maintain (in short: clean) code is really important in programming, it's your job to help him to make his code more readable and maintainable!

What are you going to learn?

  • code comprehension (understand written code)
  • clean code refactoring (making code more easy to read and maintain without changing any feature)

Tasks

  1. Read the code and try to understand first without running it. Use comments to write in the next to the code what you understand from it. Commit and push your work. Remove the comments after pushing. Disclamier: In real life you shouldn't comment your program this way. For a real programmers starting_number = 5 is something obvious. This task is just to check if it's obvious for you too.
    • Every line of the program has comments next to it describing what's going on in it. Example comments:
starting_number = 5 # assign 5 to variable starting_number
numbers = [1, 2, 3] # initialize list with values and assign it to variable numbers
for number in numbers: # loop through list numbers (assign each value to variable number)
- Comments use proper technical language, are short and specific enough to understand what's going on
- One sentence comment is added at the top of the file describing what this program does
- The modifications are committed with the commit message "add code comprehension comments" and pushed into the remote repository
  1. Make the program more easy to understand and more easy to modify (maintain). Do it step by step and commit after each modification. Push your changes.
    • Running the program results in the exact same behavior before and after refactoring.
    • Variable names in the program are meaningful nouns and not abbreviated
    • Function names in the program are meaningful verbs and not abbreviated
    • There are no unnecessary (dead) code or comments in the program
    • There are no duplicating code parts or code parts doing the same thing differently in the program
    • There are no function that doing more than one thing in the program
    • After each modification the changes are committed, the program is runnable and results in the exact same behavior than at the beginning
    • Commit messages are meaningful

General requirements

None

Hints

  • Always keep the features of the original code (don't even change a dot or newline).
  • Always keep the code in a runnable state.
  • Commit early commit often.
  • Pay attention to create not only readable but maintainable code as well.

Starting your project

Background materials

guessing-game's People

Contributors

agnesrausz avatar

Watchers

 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.