et286 lab lecture 2/16/2011 homework review coding style debugging

23
ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Upload: marvin-watkins

Post on 12-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

ET286 Lab Lecture2/16/2011

Homework ReviewCoding StyleDebugging

Page 2: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Homework Review

• An “internet” is simply a connection of two or more networks– This room is a network– This floor is an internet (small ‘i’)– This building is a larger internet– This campus is a larger internet– This campus internet connects to The Internet

Page 3: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Homework Review

• The Internet was born of a military research project through ARPA (ARPAnet)– The intent was to create a military communications

system that could survive massive destruction of large parts of the nation (nuclear war)

– IP-based networks (the most common type in use today) give up a bit of speed and require a bit more work from the computer, but are able to function despite hardware failures

– TCP: local network (LAN) communications– IP: Inter-network communications

Page 4: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Homework Review

• The Internet was born of a military research project through ARPA (ARPAnet)– The technologies responsible for our uses of The

Internet today (email and http/html) were products of “academic” and “commercial” research and development

– Tim Bernes-Lee of CERN (As in: The LHC) developed html and http to allow academics to have an easy way to publish their papers. He called it The World Wide Web after seeing how hyperlinking drew all the documents into a single massive connected “web”

Page 5: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Homework Review

• High Level Languages:– C, C++, COBOL, Python, Ruby– Compiled and Linked to generate chip-specific Machine Code– Before Compilation: machine-independent

• Interpreted Languages:– SQL, Java, PERL– Not Compiled. Will run on any machine with the right

interpreter– Interpreter is written in another high level language and

compiled for each target system (JAVA for Mac, JAVA for PC, JAVA for iphone, etc…)

Page 6: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Homework Review

• Low Level Languages– Assembly and Machine Language– Are not “compiled” but are “assembled”• Same basic process

– Generally machine-specific– As compilers get better, these are falling out of

fashion

Page 7: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Homework Review

• Procedural Languages– C– Data and operations on that data are separate parts of the

program– You tell the operation to work on specific data

• Object Oriented Languages– C++, Java– Data and operations on the data are combined into Objects– You tell the object to perform an operation, and then ask it

the results

Page 8: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Homework Review

• Get A Stapler!– Seriously– They are cheaper then a Starbucks Mochachino

• Each assignment should have:– Your name– Assignment Number– Class– Professor’s Name– Date Assignment is Due

Page 9: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Coding Style

Page 10: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Coding Style

Page 11: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Coding Style

Page 12: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Coding Style

• Use self-documenting variable names

– Value=pay*hr + otrt*othr; // WAT?

– TotalPay=HoursWorked*PayRate + Overtime * OTRate; //makes more sense

Page 13: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Coding Style

• When you work with a classmate, or find code online, YOU MUST DOCUMENT THIS IN YOUR COMMENTS– // code found at msdn.microsoft.com/blahblah 2/16/2011– // code written by Brian Lojeck, used with permission

• You must be able to explain all code you use• Handing in someone else’s program is still cheating

Page 14: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Coding Style

• Remember– You are not writing code for me– You are not writing code for Professor Hill– You are not writing code for yourself– You are writing code for the guy who is going to

try and use your program 5 years after you retire

Page 15: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Debugging

• Why?– Allows you to pause a program as it runs– Check status of variables while program is “live”– Helps find logical errors

Page 16: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Debugging

Page 17: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Debugging

Page 18: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Debugging

Page 19: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Debugging

Page 20: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Debugging

Page 21: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Debugging

Page 22: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Debugging

Page 23: ET286 Lab Lecture 2/16/2011 Homework Review Coding Style Debugging

Debugging