mkt 101 introduction to marketing
Download
Skip this Video
Download Presentation
Lecture 4: VALIDATING Your Design

Loading in 2 Seconds...

play fullscreen
1 / 42

Lecture 4: VALIDATING Your Design - PowerPoint PPT Presentation


  • 70 Views
  • Uploaded on

Why should I learn about marketing ? I’m in CSC to avoid this!. MKT 101 – Introduction to Marketing. Lecture 4: VALIDATING Your Design. Today’s Goal. Learn to validate & fix designs before coding What matters in comments & how these can help

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Lecture 4: VALIDATING Your Design' - silas


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
mkt 101 introduction to marketing

Why should I learn about marketing?

I’m in CSC to avoid this!

MKT 101 –

Introduction to Marketing

Lecture 4:VALIDATING Your Design

today s goal
Today’s Goal
  • Learn to validate & fix designs before coding
    • What matters in comments & how these can help
    • Techniques & tricks to avoid writing useless code
  • Javadoc v. regular comments: why have both?
    • Why both types of comments rely on marketing
    • Why is this vital for testing the proposed solution?
today s goal1
Today’s Goal
  • Learn to validate & fix designs before coding
    • What matters in comments & how these can help
    • Techniques & tricks to avoid writing useless code
  • Javadoc v. regular comments: why have both?
    • Why both types of comments rely on marketing
    • Why is this vital for testing the proposed solution?

Weeks of coding makes up for minutes of planning

how my homies roll1
How My Homies Roll

Already made

#YouSucka trending topic

reactions to your code
Reactions to Your Code

Passion Threshold

Suck Threshold

reactions to your code1
Reactions to Your Code

Passion Threshold

Suck Threshold

reactions to your code2
Reactions to Your Code

Passion Threshold

Suck Threshold

intuitive is key
Intuitive Is Key
  • Making people think is preying on their weakness
    • Explicitly state details needed to use code
  • People will assume that everything has purpose
    • Male nipples, appendix, Matt still talked about
    • If it serves no purpose, why would it be created?
    • Guessing game createdfrom unused parameters
    • Don\'t make user probe what return value means
intuitive is key1
Intuitive Is Key

It returned 5.

What the $#&@#* does5mean?

  • Making people think is preying on their weakness
    • Explicitly state details needed to use code
  • People will assume that everything has purpose
    • Male nipples, appendix,Mattstill talked about
    • If it serves no purpose, why would it be created?
    • Guessing game created from unused parameters
    • Don\'t make user probewhat return value means
intuitive is key2
Intuitive Is Key

I DEFINITELY need another drink…

  • Making people think is preying on their weakness
    • Explicitly state details needed to use code
  • People will assume that everything has purpose
    • Male nipples, appendix,Mattstill talked about
    • If it serves no purpose, why would it be created?
    • Guessing game created from unused parameters
    • Don\'t make user probewhat return value means
what to do with your design
What To Do With Your Design
  • Move on to next step: write your javadoc
    • Validate your thinking by forcing communication
    • Performs test that you are clear what method does
    • Team development easier, since method use known
    • If done well, will find helps develop 1st test set
what to do with your design1
What To Do With Your Design
  • Move on to next step: write your javadoc
    • Validate your thinking by forcing communication
    • Performs test that you are clear what method does
    • Team development easier, since method use known
    • If done well, will find helps develop 1sttest set
but we cannot document yet
But We Cannot Document Yet!
  • Of course, do not yet know details such as…
    • How method is coded or calls it makes
    • Which of the class’s fields used within method
    • How it computes result to get return value
    • Given an input, why specific algorithm used
  • javadoc does NOT need & should not include it
    • You may (or should be asking yourself): Why?
why not include details
Why Not Include Details?
  • You writecode once…
    • This is goal, idea is to solve problems not write code
    • Writing code is work & laziness means minimizing this
    • Once code bug free, do not want to look at it again
  • …but read comments often
    • If javadoc duplicates code, could just read code
    • Only provide what users need
why not include details1
Why Not Include Details?
  • You writecode once…
    • This is goal, idea is to solve problems not write code
    • Writing code is work & laziness means minimizing this
    • Once code bug free, do not want to look at it again
  • …but read comments often
    • If javadoc duplicates code, could just read code
    • Only provide what users need
what should comments say
What Should Comments Say?
  • javadoc works with design & does not repeat it
    • For each class what instances do & where to use
    • What a method does & when it should be called
    • Given a methods actions, what method’s results are
    • Meaning of return values & any special “magic” values
    • For each real error: when exception will be thrown
    • How to call method including examples (with return)
good javadoc
Good javadoc

/**

* Perform the basic work needed when a button is

* pushed. This will illuminate the light in the

* button. The first time a button is hit it will

* also send a message to the elevator controller.

*/

public void pushButton() { /* Code goes here… */ }

how does javadoc test design
How Does javadoc Test Design?
  • What if do not know enough to write javadoc?
    • Can you write code you cannot describe what it does?
how does javadoc test design1
How Does javadoc Test Design?
  • What if do not know enough to write javadoc?
    • Can you write code you cannot describe what it does?

Hint:

how does javadoc test design2
How Does javadoc Test Design?
  • What if do not know enough to write javadoc?
    • Can you write code you cannot describe what it does?

Hint:

Your

Design

Sucks

Donkey

Balls

what is the goal again
What is the Goal Again?
  • Javadoc!= Java and should not be confused
    • If comments are good, easier to understand than Java
  • Only details users need to use method or class
    • For this to work must make sell its simplicity
    • Show important connections to well-known examples

@see class @see #method @see class#method

    • Explicitly state any "magic" param or return values
    • Provide examplesto clarify how it will work
other details to describe
Other Details To Describe
  • State all assumptions to prevent future bugs
    • When calling this method, what else will happen?
other details to describe1
Other Details To Describe
  • State all assumptions to prevent future bugs
    • When calling this method, what else will happen?
    • Any assumptions upon which method relies
other details to describe2
Other Details To Describe
  • State all assumptions to prevent future bugs
    • When calling this method, what else will happen?
    • Any assumptions upon which method relies
    • Once method completes, details needed for later
programming by contract
Programming By Contract
  • Precondition true at start when method called
    • Ensuring these met responsibility of calling method
  • Postconditions true at end of the method call
    • Guaranteeing this responsibility of called method
    • Only if preconditions met must this happen, however
programming by contract1
Programming By Contract
  • Precondition true at start when method called
    • Ensuring these met responsibility of calling method
  • Postconditions true at end of the method call
    • Guaranteeing this responsibility of called method
    • Only if preconditions met must this happen, however
good javadoc example
Good Javadoc Example

/** * Perform the basic work needed when a button is * pushed. This will illuminate the light in the * button. The first time a button is hit it will * also send a message to the elevator controller.<br/> * * Precondition: lit.isOff(); controller is set<br/> * * Postcondition: !lit.isOff() && * request sent to elevator controller */public void pushButton() {}

what s next
What\'s Next?
  • Could start to write code at this point in project
    • But doing this means still may find many bugs
    • Fixing these hard if calling many other methods
    • Ideal if we could 1stcheck that method actually works
  • Remember key trait of successful programmers
successful programmers
Successful Programmers
  • Could start to write code at this point in project
    • But doing this means still may find many bugs
    • Fixing these hard if calling many other methods
    • Ideal if we could 1stcheck that method actually works
  • Remember key trait of successful programmers
outlining a method
Outlining a Method
  • Write pseudocodeoutline of how method works
    • Can be written assuming other methods they work
    • Can ignore coding details, so simpler & easier to write
  • Once done writing, tests check algorithm works
    • Fix errors BEFORE coding to limit debugging needs
  • Can then make the algorithm into comments
    • Check code against comment, since that passed tests
    • Plain English description makes reading code easier
outlining a method1
Outlining a Method
  • How to write algorithm: what details important?
    • Can skip punctuation of any sort:this is not code
    • Should include major loops, but can write in English
    • Important to translate: each action to take is explicit
    • Can write “swap values” or group assignments
    • Using shorthand fine, but translation to code clear
for next lecture
For Next Lecture
  • Week #2 homework available on Angel page
    • Due by 5:00PM Tuesday
    • Submit assignment via e-mail & (possibly) paper
  • Reading for Friday linked to from Angel schedule
    • Discuss range of possible tests to perform
    • How often to test code as we are writing it
    • Present methods of handling failed test
ad