Engineering and Debugging an App Chapter 15

Slides:



Advertisements
Similar presentations
Design Time Here We Go!.
Advertisements

Chapter 1 - An Introduction to Computers and Problem Solving
靜宜大學資管系 楊子青 1 Programming Your App’s Memory 靜宜大學資管系 楊子青
Traffic Light Behavior IF A=1 AND B=0 Car Sensors B A.
B-1 Lecture 2: Problems, Algorithms, and Programs © 2000 UW CSE University of Washington Computer Programming I.
CS350/550 Software Engineering Lecture 1. Class Work The main part of the class is a practical software engineering project, in teams of 3-5 people There.
IEG 3080 Tutorial 1 Wilson Ip. Outline Lecture reviews: Some basics of Software Engineering principle Some basics of OOP How to use Visual Studio.NET.
Introduction to a Programming Environment
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
1 KAN’S INTRO AND OVERVIEW MODELS Ch1 & 2 in his book Steve Chenoweth, CSSE.
Introduction to High-Level Language Programming
The Study of Computer Science Chapter 0 Intro to Computer Science CS1510, Section 2.
A First Program Using C#
Dr. Ken Hoganson, © August 2014 Programming in R STAT8030 Programming in R COURSE NOTES 1: Hoganson Programming Languages.
Programming Translators.
Functions Part I (Syntax). What is a function? A function is a set of statements which is split off into a separate entity that can be used like a “new.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
What is Programming? Computer programming is about telling the computer what it is we want it to do We tell the computer what we want it to do by sending.
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
Debuggers in Python. The Debugger Every programming IDE has a tool called a debugger. This application does NOT locate or fix your bugs for you! It slows.
Software Development. Software Development Loop Design  Programmers need a solid foundation before they start coding anything  Understand the task.
WATERFALL DEVELOPMENT MODEL. Waterfall model is LINEAR development lifecycle. This means each phase must be completed before moving onto the next!!! WHAT.
1 Project designed and created by M. Shajith Kumar.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
How To Program An Overview Or A Reframing of the Question of Programming.
Getting ready. Why C? Design Features – Efficiency (C programs tend to be compact and to run quickly.) – Portability (C programs written on one system.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
Instructional Technique #2 Use Explicit Instruction to Convey Critical Content.
Introduction to Programming and App Inventor. Introduction What is a computer program? Introducing App Inventor Getting hands on with App Inventor.
Advanced Software Engineering Dr. Cheng
CSC 108H: Introduction to Computer Programming
Pepper modifying Sommerville's Book slides
FOP: Multi-Screen Apps
Component 1.6.
Software Development.
Pseudocode and comments
AP Computer Science Principles
Learning to Program D is for Digital.
Introduction to the C Language
FOP: Buttons and Events
Unified Modeling Language
1. Welcome to Software Construction
How to improve your grade in Religious Education
Worked Examples - Incremental Software Development Worked Example
Understanding an App’s Architecture
Introduction to Programmng in Python
Lesson 10: Building an App: Color Sleuth
Chapter 16 – Programming your App’s Memory
Programming Your App to Make Decisions – Conditional Blocks
COMP 350: Object Oriented Analysis and Design Lecture 2
What’s New in Colectica 5.3 Part 1
Introduction to Object-Oriented Programming
Functions Inputs Output
Introduction to the C Language
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
HAPPY NEW YEAR! Lesson 7: If-statements unplugged
Programming.
Introduction to AppInventor
Mastering Memory Modes
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Chapter 1 Introduction.
Pseudocode and comments
ECE 352 Digital System Fundamentals
Software Development Techniques
The Study of Computer Science Chapter 0
Software Engineering and Animations
Logical Architecture & UML Package Diagrams
Presentation transcript:

Engineering and Debugging an App Chapter 15 AppInventor Engineering and Debugging an App Chapter 15

Adapted from intro to Chapter 15 Apps covered in this book’s early chapters are small software projects and don’t require much engineering.  As projects become more complicated, you’ll realize that the difficulty of building software increases rapidly for each bit of complexity you add--it is nowhere close to a linear relationship. To build even moderately complex software you need forethought, planning, blueprints, user and system testing, and, in general, techniques and skills that are more engineering than programming. For most of us, it takes a few hard knocks before we realize this fact. At that point, you’ll be ready to learn some software engineering principles and debugging techniques. If you’re already at that point, or if you’re one of those few people who want to learn a few techniques in the hope of avoiding some of those growing pains, this chapter is for you.

Software Engineering Principles Involve end-users early and often Build simple prototype early Add incrementally to prototype Code/test incrementally Design logic for app BEFORE coding Divide, layer, conquer Comment as much as possible Trace blocks with pencil/paper to understand program execution

Design for Real People with Real Problems User-centered design What percentage of programs see ‘light of day’? A program often begins life as a solution to one person’s particular ‘pain point’ and then evolves to a larger, more general app

Build a Quick Prototype Something that illustrates core functionality Not refined, but gives rough idea Listen, listen, listen!!!

Incremental Development Big Bang: create 30 blocks of code, debug ‘em, run … not a good plan Code a little, test a little, repeat … much better plan

Design Before Coding Understand the logic of the app FIRST TRANSLATE into code SECOND Get AWAY from the computer to think about your app Document your design ideas Write them into your code screen as comments Importance of commenting code

Divide, Layer, Conquer Divide project into manageable chunks: A, B, C Layer: break into simple to complex layers Add blocks for simple behavior Test Add another layer of complexity Understand what it is to WRITE a program; what it is to RUN a program Read closely: First 3 paragraphs under ‘Understand Your Language: Tracking with Pen and Paper’ Tracing execution – example of p232

Tracing Execution – an example

Tracing execution, another example . . . First, draw some memory cell boxes for all pertinent variables: QuestionLabel.Text currentQuestionIndex

Tracing execution, another example . . . Next, think about what happens when the app begins, not from the end user’s perspective, but what happens internally in the program All the component properties are set based on their initial values in the Component Designer. All variable definitions and initializations are performed. The blocks in the Screen.Initialize event handler are performed.

Tracing execution, another example . . . As a result of the Screen1.Initialize here’s what the memory cells contain: QuestionLabel.Text currentQuestionIndex Which president implemented the “New Deal” during the Great Depression? 1

Next, trace what happens when the user clicks the ‘Next’ button: First, the currentQuestionIndex is incremented. At an even more detailed level, the current value of the variable (1) is added to 1, and the result (2) is placed in currentQuestionIndex. The if statement is false because the value of currentQuestionIndex (2) is less than the length of QuestionList (3). 

So, now the memory cells contain . . . QuestionLabel.Text currentQuestionIndex Which president granted communist China formal recognition in 1979? 2 Trace the ‘Next’ button logic through a second time. What happens with the ‘if’ statement? Why? We’ve uncovered a ‘bug’ in the program! The last question in the list never appears – it goes back to the first question after the second question is done. How can we fix it?

Tracing code . . . Adapted from Ch15 When you can trace an app to this level of detail, you become a programmer, an engineer. You begin to understand the mechanics of the programming language, absorbing sentences and words in the code instead of vaguely grasping paragraphs. Yes, the programming language is complex, but each “word” has a definite and straight-forward interpretation by the machine. If you understand how each block maps to some variable or property changing, you can figure out how to write or fix your app. You realize that you are in complete control. Now if you tell your friends, “I’m learning how to let a user click a Next button to get to the next question; it’s really tough,” they’d think you were crazy. But such programming is very difficult, not because the concepts are so complex, but because you have to slow down your brain to figure out how it, or a computer, processes each and every step, including those things your brain does subconsciously.

Debugging an App Trace Watch variables – RC any variable def block – choose Watch Test individual blocks – RC block, choose DoIt Can be used not only to test individual blocks but also to do incremental development Activate/deactivate blocks – RC block, choose Activate/Deactivate

Summary … adapted from Ch15 App Inventor’s visual nature gets you started building an app right away, and you don’t have to worry about a lot of low-level details. But App Inventor CANNOT figure out what your app should do for you, much less exactly how to do it. Though it’s tempting to just jump right into the Designer and Blocks Editor and start building an app, it’s important to spend some time thinking about and planning in detail what exactly your app will do. It sounds a bit painful, but if you listen to your users, prototype, test, and trace the logic of your app, you’ll be building better apps in no time.