Design & Testing: Part Yin and Yang Computer Networks (15-441) Fall 2007 Daniel Spangenberger.

Slides:



Advertisements
Similar presentations
Microsoft ® Office Outlook ® 2007 Training Retrieve, back up, or share messages Sweetwater ISD presents:
Advertisements

Microsoft ® Access ® 2010 Training Design the tables for a new database.
Extreme Programming Alexander Kanavin Lappeenranta University of Technology.
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
CIT 590 Unit testing.
Programming Types of Testing.
Linked Structures, Project 1: Linked List Bryce Boe 2013/10/16 CS24, Fall 2013.
E-commerce Project Erik Zeitler Erik Zeitler2 Lab 2  Will be anounced and scheduled later  We will deploy Java Server Pages on a Tomcat server.
API Design CPSC 315 – Programming Studio Fall 2008 Follows Kernighan and Pike, The Practice of Programming and Joshua Bloch’s Library-Centric Software.
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Design & Modularity Recitation 3 Dave Andersen Carnegie Mellon University.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
1 Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation –The new operator –The delete operator –Dynamic.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
Introduction To C++ Programming 1.0 Basic C++ Program Structure 2.0 Program Control 3.0 Array And Structures 4.0 Function 5.0 Pointer 6.0 Secure Programming.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
CIT 590 Unit testing. Agenda Debugging attempt 2 (because I am stubborn) What is unit testing Why? Unit testing framework in Python.
Estimation Wrap-up CSE 403, Spring 2008, Alverson Spolsky.
Chocolate Bar! luqili. Milestone 3 Speed 11% of final mark 7%: path quality and speed –Some cleverness required for full marks –Implement some A* techniques.
TESTING.
Pragmatic Projects Prepared by Doug Glidden. Pragmatic Projects Pragmatic Teams Ubiquitous Automation Ruthless Testing It’s All Writing Great Expectations.
Computer Science II 810:062 Section 01 Session 2 - Objects and Responsibilities.
INFO 637Lecture #81 Software Engineering Process II Integration and System Testing INFO 637 Glenn Booker.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 12 1 Microsoft Office Access 2003 Tutorial 12 – Managing and Securing a Database.
Choose between Access and Excel Right questions, right program If you’re having trouble choosing between Access and Excel, take a moment to answer an important.
Team Skill 6: Building the Right System From Use Cases to Implementation (25)
CSC 221: Computer Programming I Fall 2001  top-down design  approach to problem solving, program design  focus on tasks, subtasks, …  reference parameters.
1 Principles of Computer Science I Prof. Nadeem Abdul Hamid CSC 120 – Fall 2005 Lecture Unit 10 - Testing.
07 Coding Conventions. 2 Demonstrate Developing Local Variables Describe Separating Public and Private Members during Declaration Explore Using System.exit.
Announcements  If you need more review of Java…  I have lots of good resources – talk to me  Use “Additional Help” link on webpage.
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 2.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Conferring With Writers Part II March 28, “ ’Choice leads to voice,’ literacy consultant John Poeton says when talking about writing. We know that.
Sylnovie Merchant, Ph.D. MIS 161 Spring 2005 MIS 161 Systems Development Life Cycle II Lecture 5: Testing User Documentation.
Chapter 8 Lecture 1 Software Testing. Program testing Testing is intended to show that a program does what it is intended to do and to discover program.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
CS5103 Software Engineering Lecture 02 More on Software Process Models.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
Ideas from ARC about the CORBA FL interface Interface ideas learned from K9 and K10 (Lorenzo) CORBA usage and wrapping ideas learned from MIRO (Hans)
ENEE150 – 0102 ANDREW GOFFIN Project 4 & Function Pointers.
Digging into the GAT API Comparing C, C++ and Python API‘s Hartmut Kaiser
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
Lecture 4 Page 1 CS 111 Online Modularity and Virtualization CS 111 On-Line MS Program Operating Systems Peter Reiher.
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
Exceptions Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
 Software Testing Software Testing  Characteristics of Testable Software Characteristics of Testable Software  A Testing Life Cycle A Testing Life.
Session 7 Introduction to Inheritance. Accumulator Example a simple calculator app classes needed: –AdderApp - contains main –AddingFrame - GUI –CloseableFrame.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
(c) University of Washington10-1 CSC 143 Java Errors and Exceptions Reading: Ch. 15.
Exceptions Lecture 11 COMP 401, Fall /25/2014.
Week # 4 Quality Assurance Software Quality Engineering 1.
CSCE 240 – Intro to Software Engineering Lecture 3.
Chapter 6 Functions The Tic-Tac-Toe Game. Chapter Content In this chapter you will learn to do the following: 0 Write your own functions 0 Accept values.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
Software Development. The Software Life Cycle Encompasses all activities from initial analysis until obsolescence Analysis of problem or request Analysis.
CSC 108H: Introduction to Computer Programming
The Object-Oriented Thought Process Chapter 03
Modularity Most useful abstractions an OS wants to offer can’t be directly realized by hardware Modularity is one technique the OS uses to provide better.
Tracking and Squashing Bugs
Presented by Muhammad Abu Saqer
Design, Modularity & Testing
Mary Torjussen A2 ICT Week 1.
Microsoft Office Access 2003
Computer Science Testing.
CSE 303 Concepts and Tools for Software Development
EEC-492/693/793 iPhone Application Development
COP 3330 Object-oriented Programming in C++
Project Iterations.
Testing Slides adopted from John Jannotti, Brown University
Presentation transcript:

Design & Testing: Part Yin and Yang Computer Networks (15-441) Fall 2007 Daniel Spangenberger

Design: Outside the Box Two types of applications Data-centric What type of data and what does it look like? Where do we store it Protocol-centric How do I talk to the world? Mostly about interfaces

Design: Inside the Box How do I access my data? Interfaces! How do I store my data? Implementation! Interfaces alleviate implementation pain Wrap a good interface around an implementation

Lessons to Be Learned Lesson One Don’t Repeat Yourself (DRY principle) How much copy and paste do you use? Put it in a separate function! Design a small set of orthogonal interfaces to your modules Adhere to them!

Lessons to Be Learned Lesson Two It’s OK for code to be shy It’s preferred! (unlike for you) Shy code... Doesn’t expose itself in public Doesn’t stare at others’ privates Surely doesn’t touch others’ privates! Doesn’t have a whole lot of friends

Lessons to Be Learned Shyness (Example One) Which is better? int send_msg_to_user(int user_id, user_sock, char* msg); int send_msg_to_user(struct user_t*, char* msg);

Lessons to Be Learned Shyness (Example Two) int send_to_user(char *uname, char* msg) { struct user *u; for (u = userlist; u; u = u->next) { if (!strcmp(u->uname, uname))... Consider factoring this into a separate function: void find_user(struct user *u, char* uname)

Lessons to Be Learned Lesson Three Keep it simple No premature optimization Even in the optimization contest, optimization generally not too important... Throw out unnecessary features / requests Not so important in

Lessons to Be Learned Lesson Four Be Consistent Naming Style Doesn’t matter what you choose, but choose something (no memcpy vs bcopy) Decide and document memory ownership Make it explicit in interfaces!

A Note: Error Handling Detect at the low level malloc() returns null! Report at high level Not a good idea to abort() Print an error message and attempt to continue...

The Testing Mindset Think like the adversary (like security!) Your goal is breaking the code If you can’t, you probably haven’t tried hard enough This ensures that in five days you won’t spend five hours tracking down that bug... Think about your code Then write tests to exercise it Hit the corners!

Testability Test at all levels! From the user’s perspective From the code’s perspective Bugs are easiest to find in a local scope Unit test things if possible Make granular integration tests!

Testing Methods Unit Integration Regression Performance

Unit Tests Tests specific features in a vacuum Generally reserved for internals... Hash tables... Linked lists... Read/write buffers... Always in the language of the product Use CUnit for 441 projects

Integration Tests “Do multiple pieces fit together?” Tests a major user-facing feature Does JOIN work? Does PRIVMSG work with nine targets? Generally utilizes a tool outside the product We will provide you with some samples

Blackbox vs Whitebox Blackbox Implementation-agnostic test cases Typical end-user use cases Whitebox Implementation-aware test cases Mainly for the corner cases/implementation details

Regression Tests Shows how a commit affects the product General idea: Record what tests passed at rev N See what tests pass at rev N+1 Look at the difference If it wasn’t broken before you regressed Could be reression on unit, integration, or performance

More Regression New features may uncover latent bugs Write new test cases when found! Make sure the test does what you think it does

Performance Testing General principle: Kick the shit out of it Two approaches: Isolate subsystems for analysis Test the gamut for the big picture Regression testing is valid for performance too! Make sure you don’t make performance worse at commit a

Want more? Joel Spolsky will give you some info (if you can take him!) There is the ACE framework Presentation on patterns for network apps s/NP-Patterns.ppt s/NP-Patterns.ppt