Coder Social home page Coder Social logo

wdi_week2_day2_hw's Introduction

#Methods

###Prereqs

  • Data types
  • Conditions
  • Loops

###What are methods (Learning Objectives)

  • Define a function
  • Explain why you would use a function
  • Inputs and outputs (arguments)
  • Why DRY code?

###How to teach this topic #####Suggested ways to introduce the topic

  • A lecture describing what methods are and how they can be used
    • Concepts of DRY
    • Reusability
  • Codealong / demo: prompts involves rewriting the prompts lab from conditionals into functions
  • Lab: ruby_calculator
    • This lab is a bit complex, and may require the instructor to walkthrough the requirements step-by-step as the students fill in the necessary code along the way.

#####How to break it down

  • Demonstrate reusability of code, inputs and outputs
  • Work with inputs and returning data of various types
  • Show how you can use all the code concepts learned thus far within a method
    • Practice defining and calling functions

#####Potential questions, difficulties, and problems

  • Variable scope and methods

  • Variable naming (method's parameter vs variable name outside the method being passed in)

    val = "string"
    def output(str)
      puts str
    end
    

###Why Methods?

  • Now we can introduce the concepts of "DRY code" and begin organizing our code better

wdi_week2_day2_hw's People

Contributors

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