Test-based programming Ask: “What should this software do?” Write a test first “Does this software do X correctly?” Fill in the code, and keep working.

Slides:



Advertisements
Similar presentations
Chapter 6 Differential Equations
Advertisements

INTRODUCTION Chapter 1 1. Java CPSC 1100 University of Tennessee at Chattanooga 2  Difference between Visual Logic & Java  Lots  Visual Logic Flowcharts.
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Matrix Methods (Notes Only)
11-Jun-15 Getting Ready for CIT Registering and labs If you are not yet registered (and want to be), be sure I have your name and student ID We.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Analysis of Algorithms 7/2/2015CS202 - Fundamentals of Computer Science II1.
PRE-PROGRAMMING PHASE
Sequential circuit design
Analysis of Algorithms Spring 2015CS202 - Fundamentals of Computer Science II1.
C++ Crash Course Class 1 What is programming?. What’s this course about? Goal: Be able to design, write and run simple programs in C++ on a UNIX machine.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
ITP © Ron Poet Lecture 1 1 IT Programming Introduction.
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
Introduction to Programming G50PRO University of Nottingham Unit 1 : Introduction Paul Tennent
6 Steps of the Programming Process
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Introducing Java.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
The Finite Element Method
Lecture 2 Fundamental Data Types. Variable Declaration.
Computer Programming I An Introduction to the art and science of programming with C++
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
EGR101-34R "lecture on hardware- software" FB 7/10/2004 Digital Electronics Logic Gates Logic gates work with the voltage level of the signals. They are.
Modeling motion subject to drag forces PHYS 361 Spring, 2011.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
Self-Documenting Code Chapter 32. Kinds of Comments  Repeat of code  Explanation of code  Marker in code  Summary of code  Description of code’s.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Design time and Run time Chris, Andrea, Martina, Henry, Antonio, Ole, Philippe, Hartmut, Anne, Jeff, Felix, Sebastian, Kurt.
How to Test Methods Computer Science 3 Gerb Objective: Test methods properly.
CSI 1340 Introduction to Computer Science II Chapter 1 Software Engineering Principles.
Software Development Introduction
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
Analysis of Algorithms Spring 2016CS202 - Fundamentals of Computer Science II1.
Unit 1 Review By: Mr. Jacobs.
Math Expression Evaluation With RegEx and Finite State Machines.
AP Calculus Unit 5 Day 6. Explain why this makes sense based on your knowledge of what an integral represents.
Analysis of Algorithms
Programming languages
Development and Testing Ch4.1. Algorithm Analysis
Analysis of Algorithms
Introduction SOFTWARE ENGINEERING.
Algorithm and Ambiguity
Understand the Programming Process
CS190/295 Programming in Python for Life Sciences: Lecture 1
Sequential circuit design
Coding Concepts (Basics)
Computer Science Testing.
Analysis of Algorithms
Chapter 1 Introduction(1.1)
Understand the Programming Process
Algorithm and Ambiguity
Herbert G. Mayer, PSU CS Status 8/2/2013
Review of Previous Lesson
FUNCTION MACHINES This is a function machine: Input output
Analysis of Algorithms
Presentation transcript:

Test-based programming Ask: “What should this software do?” Write a test first “Does this software do X correctly?” Fill in the code, and keep working until the test runs successfully

Designing a ‘Simple’ Computational Program Static Beam Deflection Exaggerated beam deflection

Desired Output Prediction of shape of beam deformed under static load More specific:

Necessary Inputs

Necessary Mathematics Math is what will connect the inputs and outputs

Mathematical Steps Translate inputs into mathematical terms (boundary conditions, loads) Solve the differential equation (numerically) Parse the numerical output to get user- desired output

Generality Hardest part of starting numerical code is finding the right level of generalization to start coding with too general means it takes too long to get going too specific can mean substantial investment in risky re-engineering later Rule of thumb: structure for the most common range of cases first, and get it running Re-engineering may never happen (false cost) may be easier after your experience (inflated cost) will have test cases (makes re-writing more reliable)

Generality in Beam Problem Beam Structure/Supports Mathematical Solving Technique

Implement first for cantilevered beams Initial conditions are Beam Structure/Supports

Loads are difficult to input as functions hard to input as a list of points with forces harder to integrate numerically with point forces For a first run, we’ll assume q(x) is uniform (constant) Range of Loads

Designing the software Need user input, mathematical formulation, solving, and expressing user output Will code in object oriented format, with beam being an object

Designing the software II

Necessary Functions

Where to test Remember, it’s good practice to think of the test before the code!

Where to test Remember, it’s good practice to think of the test before the code!

What are the tests? Input/Output for beam Integration Module

Test code vs. Functional Code

Implementation in Java

Getting Started with Java Download the Java Development Kit (JDK) (not the run-time environment, which just lets you run programs, not write them) Follow the tutorials to get a “Hello, world” program running Read up on the fundamentals of object-oriented programming Keep in mind: Once you get into programming, you don’t need to understand every line of someone else’s code imitation (also known as cut and paste) is the sincerest form of flattery. If appropriate, simply cite the source.

For next class Get Java running on a machine you can use Get a working program running Get the scaffold for a ‘beam’ class, which has inputs for the cantilevered case No internals need to be written yet Read the JUnit descriptions (as much as makes sense to you) Come with questions!

Resources Beam deflection Java Tutorials JUnit