Loops, Databases, Procedures, and Lists Dr. José M. Reyes Álamo.

Slides:



Advertisements
Similar presentations
Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language.
Advertisements

Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
String and Lists Dr. Benito Mendoza. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list List.
Programming with App Inventor Storing Data
CIS101 Introduction to Computing Week 12. Agenda Your questions Solutions to practice text Final HTML/JavaScript Project Copy and paste assignment JavaScript:
Cpeg421-08S/final-review1 Course Review Tom St. John.
Chapter 6 Problem Solving and Algorithm Design Nell Dale John Lewis.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
CIS101 Introduction to Computing Week 12 Spring 2004.
Introduction to AppInventor Dr. José M. Reyes Álamo.
Unit 2 — Building Web Part B) Designing the Web. Phase 1: Planning a Web Site Like an architect designing a building, adequately planning your Web site.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
EMT1111 Logic and Problem Solving Dr. José M. Reyes Álamo Lecture 1.
EMT1111 Logic and Problem Solving Fall 2012 Dr. José M. Reyes Álamo Lecture 1.
EMT1111 Logic and Problem Solving Dr. José M. Reyes Álamo Lecture 1.
A Computer Science Tapestry 1 Recursion (Tapestry 10.1, 10.3) l Recursion is an indispensable technique in a programming language ä Allows many complex.
Week 4 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Introduction. 2COMPSCI Computer Science Fundamentals.
COMPUTER PROGRAMMING. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may repeat code.
EMT1111 Logic and Problem Solving Dr. José M. Reyes Álamo Lecture 1.
Variables, operators, canvas, and multimedia Dr. José M. Reyes Álamo.
Java™ How to Program, 9/e Presented by: Dr. José M. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
Functions, Procedures, and Abstraction Dr. José M. Reyes Álamo.
Week 4 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
PHP Constructs Advance Database Management Systems Lab no.3.
7 1 User-Defined Functions CGI/Perl Programming By Diane Zak.
EMT 2390L Lecture 9 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
1 FUNCTIONS - I Chapter 5 Functions help us write more complex programs.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Software Engineering Principles Dr. José M. Reyes Álamo.
Variables, operators, canvas, and multimedia Dr. José M. Reyes Álamo.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
CS 104 – Fall 2011 Exploring Computer Science Lecture 20: November 14, 2011 Procedural Abstraction and List Processing.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Programming Fundamentals. Topics to be covered Today Recursion Inline Functions Scope and Storage Class A simple class Constructor Destructor.
Sequencing How to get better. Getting better – Level 3 Putting Instructions in a Sequence You can put instructions into a sequence You understand that.
Language Find the latest version of this document at
Python 1 SIGCS 1 Intro to Python March 7, 2012 Presented by Pamela A Moore & Zenia C Bahorski 1.
11 Using the Keyboard in XNA Session 9.1. Session Overview  Discover more detail on how the XNA keyboard is implemented  Find out how to use arrays.
Control Flow (Python) Dr. José M. Reyes Álamo. 2 Control Flow Sequential statements Decision statements Repetition statements (loops)
Variables, operators, canvas, and multimedia Dr. Reyes.
Introduction to Logic and Conditional Block Dr. José M. Reyes Álamo.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
Control Structure  What is control Structure?  Types of Controls  Use the control structure in VBScript.  Example Summery.
String and Lists Dr. José M. Reyes Álamo. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list.
Generating XML Data from a Database Eugenia Fernandez IUPUI.
Component 1.6.
Pamela Moore & Zenia Bahorski
Announcements Final Exam on August 17th Wednesday at 16:00.
Loops, Databases, Procedures, and Lists
Variables, operators, canvas, and multimedia
Lesson 09: Lists Topic: Introduction to Programming, Zybook Ch 8, P4E Ch 8. Slides on website.
Working with Databases (I) 靜宜大學資管系 楊子青
Algorithms Take a look at the worksheet. What do we already know, and what will we have to learn in this term?
Algorithm Discovery and Design
Introduction to AppInventor
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
CSE 115 November , 2008.
CS 1111 Introduction to Programming Spring 2019
Unit 3 lesson 2-5 The Need For Algorithms- Creativity in Algorithms – Simple Commands - Functions Day 18.
CISC101 Reminders All assignments are now posted.
Programming Lists of Data 靜宜大學資管系 楊子青
IPC144 Introduction to Programming Using C Week 4 – Lesson 1
Functions, Procedures, and Abstraction
C++ Object Oriented 1.
Martin Rinard, Jiasi Shen, Varun Mangalick
Software Engineering and Animations
Presentation transcript:

Loops, Databases, Procedures, and Lists Dr. José M. Reyes Álamo

2 Outline  Loops  Databases  Procedures  Lists

Loops

4 Some times you need to repeat… While the test is TRUE do

5

6 Some times you need to repeat… For each element in the list do

7

8 Some times you need to repeat… For each value of i in the range of start to end on steps of step do

9

Databases

11 Permanent Storage TinyDB –Persistent storage in your device TinyWebDB –Persistent storage in the Web

12 TinyDB Item (tag)Quantity (valueToStore) Pasta1 Box Sauce1 Jar Grocery List

13

14

Procedures

16 What is a procedure? A procedure is a named sequence of blocks that encapsulate some functionality and can be called from any place in your app.

17 More about procedures Procedures are an abstraction since they represent a recognizable name for a sequence of lower-lever instructions. In other programming languages procedures are called functions or subprograms.

18 Why are procedures useful? Procedures can be a good tool to develop large apps. –You create new functionality by using procedures. –You can use them to break down a large problem or project into more manageable sub problems. –While designing the app, you can define a procedure ignoring the details of how it works and refer to the empty procedure. When your finish your design, you can add code to the empty procedures to complete the functionality of your app. –You can put chunks of code in one place and call it from various places in your app.

19 Two blocks to define procedures The procedure block collects a sequence of blocks together. –When you create a procedure, AppInventor automatically generates a call block and places it in the My Definitions drawer. –You use the call block to invoke the procedure. The procedureWithResults block works similarly to procedure but also returns a result. –After the procedure executes, the result is returned to the block connected to the return socket.

20 Refactoring

21 Refactoring Refactoring is programming technique that consist on reorganizing the code, for example create a procedure to substitute redundant code, to make it easier to maintain and easier for the programmers to work with.

Lists

23 What is a list? They are variables that instead of holding a single value, they hold several values distinguished by an index. Simple variables –score = 100 –phoneNumber = Lists –bestScores = [100, 98, 89] –myContactsPhoneNumbers = [ , , ]

24 What is a list? Simple variables –score = 100 –phoneNumber = Lists –bestScores = [100, 98, 89] –myContactsPhoneNumbers = [ , , ]

25 List operations

26 OpenLab and Blackboard Check OpenLab for any new lab. Check Blackboard for any new quiz. Project: –Brainstorm an idea –Get professor's approval –Post your idea in your portfolio –Must work in teams of 2 or 3 –It must be an app and the topic is open: a game, a tool, an enhanced version of a previous app

27 OpenLab and Blackboard Finish your labs and post them in OpenLab. Finish quizzes on Blackboard. Work on your project the next few weeks. Study for the Final Exam.