Giter Site home page Giter Site logo

behavior-strategy-implementation's Introduction

Behavior, Strategy, Implementation

What?! Coding exercises, without writing any code?! 100%

The main objective of these exercises is practicing how to Learn from Code, to be given source code you don't understand and to study it until you could write it yourself. Keep these three words in mind as you complete your writeups:

  1. Behavior: What does a function do? What are it's arguments and it's return value? How could you use it in a program?
  2. Strategy: How could you transform the arguments to the return value in small steps, focusing on the data not the code. This is the realm of flow charts, diagrams, and pseudocode.
  3. Implementation: Which language features and which lines of code can you use to make your strategy a reality?

There are many strategies for creating the same behavior, and there are many ways to implement the same strategy.

By studying multiple solutions to the same challenge, written by more experienced programmers, you will learn how to approach and solve coding challenges on your own.

Index


Codewars

These exercises are based on Codewars, a website with progressive programming challenges in many different languages. You can learn more about Codewars by reading the Codewars Wiki.

Normally people log into Codewars to solve Katas and progress through the ranks (Kyus). You'll be going there to forfeit challenges and study other people's solutions.

TOP


Exploring

These exercises are about exploring other people's code, not writing your own. You will be more confident Creating your own code in the future if right now you focus on Reading and Modifying others'.

Easy is Ok

Don't push too fast through the Kyu levels, your goal here is to practice analyzing code, not to solve harder and harder problems. You can learn everything you need to studying easy challenges.

Codewar users write some (overly) clever solutions simple problems. You can learn a lot about JavaScript and programming from them. The less you struggle to understand the problem the more you can lean from their code.

Forfeit!

Don't spend time trying to pass the challenges you want to write up. Unlock and forfeit the challenges right away. There is plenty of time in your future to pass challenges on your own, right now your focus should be on understanding others' solutions. This will help you build a mental library of techniques that will serve you better in the long run than being stuck on your own blank page.

After you've finished your analysis give it a go, see if you can't find your own solutions. But first focus on understanding the problem and understanding other's solutions.

Sandbox

Experiment with and step through several solutions before choosing the two you want to write up.

  • Copy-paste different solutions into JS Tutor or the debugger and practice stepping through them with different arguments.
  • Change the variable names to something that helps you understand their role in the function
  • Paste the solutions in the Kata's Train page and see what happens when you change the code. What changes can you make that still pass the tests? What changes make the tests fail?

After you've chosen the solutions you want to write up, use the sandbox.js files in this repo to study solutions in the VSCode debugger while you write up your analysis. Stepping through the code side by side with your Markdown writeup pages will make your time a lot more productive.

Experimenting with the function will be the best way to understand it's behavior and the most effective way to come up with good example use cases.

Forks

Writing about code can be harder than actually writing it! Spend a little time every day reading through other forks of this repo. How do others write about strategy? What kinds of examples do others come up with? What refactor options do others think of?

When you find someone's work that's especially helpful go ahead and give them a star! Let them and everyone else know that their work is worth studying. You can also watch their repos to get notifications whenever they commit new changes.

Sharing

Did you find a fun challenge with many good solutions to study? Do you have a great trick for studying Codewars? Is there a resource you found online that helped you?

Share it! Open an issue in this repository and label it helpful.

TOP


Writeups

The end goal of these exercises is to write a markdown file analyzing different people's solutions to the same programming challenges. Along the way you will learn many important "soft skills" including: how to read and write documentation, how to understand source code, how to interpret test cases, and how to explain your code to others.

Sections

Your writeups should have these sections:

  • Motivation: (just under the title) Describe the challenge in plain english and give an idea of when/why/how this function might be useful in real life.
  • Syntax: What does someone need to know to use the function? This includes the types of all parameters, and the return value.
  • Examples: Write a few use cases. These show how the function could be used in a real program. Practice finding interest edge cases, it's good for you ;)
  • User Solutions: Analyze the solutions written by (at least) 2 different users, include:
    • Their Solution: Copy-paste their code into your writeup
    • Strategy: Describe how they approached solving this problem. This section should not include any mention off JavaScript syntax or language features. (this will take some practice)
    • Implementation: What code did they write to make their strategy a reality? Include references to the language features they used.
    • Possible Refactors: What changes could you make to the function that would still pass the tests, without changing the strategy? A good first step is listing other language features that could be used.
  • Notes: Write any extra notes to help you and others review your writeup.

Example

There's an example writeup to study in the 8 Kyu directory. Hopefully this will help you get the feel for it. What you can't learn from this example you can learn by studying other people's writeups and asking for help.

Template

There is also a template writeup you can use to get started. It has all the required sections along with a description of what goes in each section. When you copy over the markdown to a new file, delete the explanations and fill in the sections with your own analyses.

behavior-strategy-implementation's People

Contributors

gelilaa avatar colevanderswands avatar

Watchers

James Cloos 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.