Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms.

Slides:



Advertisements
Similar presentations
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 15 Programming and Languages: Telling the Computer What to Do.
Advertisements

Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Computers Are Your Future
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Introducing Programming a general discussion. What is a Program? Sets of instructions that get the computer to do something Programs may be a few lines.
Programming System development life cycle Life cycle of a program
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Computers: Tools for an Information Age
© Prentice Hall CHAPTER 3 Computer Software.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 1 Program Design
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
CSCI N201: Programming Concepts Copyright ©2005  Department of Computer & Information Science Introducing Object-Oriented Programming (OOP)
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Building Applications.
CS102 Introduction to Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
Copyright ©2005  Department of Computer & Information Science Introducing Programming.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
A First Program Using C#
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
INTRODUCING COMPUTER SCIENCE CSCI N341: Client-Side Programming.
CS 0004 –Lecture 1 Wednesday, Jan 5 th, 2011 Roxana Gheorghiu.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
UNIVERSITI TENAGA NASIONAL “Generates Professionals” CHAPTER 4 : Part 2 INTRODUCTION TO SOFTWARE DEVELOPMENT: PROGRAMMING & LANGUAGES.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Introducing Computer Science & Algorithms. Goals By the end of this lecture you should … … understand Computer Science as the study of algorithms … understand.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Chapter 11 An Introduction to Visual Basic 2008 Why Windows and Why Visual Basic How You Develop a Visual Basic Application The Different Versions of Visual.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Visual C++ Programming: Concepts and Projects
CSCI N201: Programming Concepts Copyright ©2005  Department of Computer & Information Science Introducing Computer Science.
Copyright ©2005  Department of Computer & Information Science Introducing Computer Science: The Study of Algorithms.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
The Programming Process Define the problem* Make or buy software? Design the program * Code (write) the program Test (debug) the program Document the.
Module 4 Part 2 Introduction To Software Development : Programming & Languages Introduction To Software Development : Programming & Languages.
I Power Higher Computing Software Development Development Languages and Environments.
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.
1.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Introduction to Computer Programming using Fortran 77.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 1: Introduction to Computers and Programming.
 By the end of this lecture, you should …  Understand the three pillars of Object- Oriented Programming: Inheritance, Encapsulation and Polymorphism.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
IS 350 Course Introduction. Slide 2 Objectives Identify the steps performed in the software development life cycle Describe selected tools used to design.
CSCI N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Introducing N241.
ICS 3UI - Introduction to Computer Science
Lecture 1 Introduction Richard Gesick.
CSCI-235 Micro-Computer Applications
An Introduction to Programming and VB.NET
Computer Programming.
The Programming Process
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Presentation transcript:

Copyright ©2004  Department of Computer & Information Science Introducing Computer Science & Algorithms

Copyright ©2004  Department of Computer & Information Science Goals By the end of this lecture you should … … understand Computer Science as the study of algorithms… understand Computer Science as the study of algorithms … understand the difference between procedural-type languages and object- oriented languages… understand the difference between procedural-type languages and object- oriented languages … understand the program development cycle… understand the program development cycle

Copyright ©2004  Department of Computer & Information Science Types of Computers Personal Computer - a computer operated by one person at a time. AKA “Client” computers.Personal Computer - a computer operated by one person at a time. AKA “Client” computers. Server – a computer whose resources and processors are shared by multiple usersServer – a computer whose resources and processors are shared by multiple users VB.Net concerns itself mainly with programming for the client computerVB.Net concerns itself mainly with programming for the client computer

Copyright ©2004  Department of Computer & Information Science Computer use is Pervasive BankingBanking Air TrafficAir Traffic Space TravelSpace Travel CommerceCommerce MedicineMedicine Public SafetyPublic Safety EducationEducation

Copyright ©2004  Department of Computer & Information Science Computer Components HardwareHardware –Physical components of a computer –Examples: Mouse, keyboard, RAM, hard drives, processor, monitor SoftwareSoftware –Instructions that get the computer to do something –Operating Systems & Applications –Examples: Windows 2000, Microsoft Excel, WordPerfect, Netscape, Internet Explorer

Copyright ©2004  Department of Computer & Information Science What is Computer Science? NOT about coding or hardware or software!NOT about coding or hardware or software! Computer Science is about PROBLEM SOLVINGComputer Science is about PROBLEM SOLVING Computer Science is about DEVELOPING ALGORITHMS to solve complex problemsComputer Science is about DEVELOPING ALGORITHMS to solve complex problems Computers are merely tools for solving problems!Computers are merely tools for solving problems!

Copyright ©2004  Department of Computer & Information Science Algorithms Well-developed, organized approaches to solving complex problemsWell-developed, organized approaches to solving complex problems Test of a good algorithm:Test of a good algorithm: –Does the algorithm solve the stated problem? –Is the algorithm well-defined? –Does the algorithm produce an output? –Does the algorithm end in a reasonable length of time?

Copyright ©2004  Department of Computer & Information Science Developing an Algorithm 1.Identify the Inputs –What data do I need? –How will I get the data? –In what format will the data be? 2.Identify the Processes: –How can I manipulate data to produce meaningful results? 3.Identify Outputs: –What outputs do I need to return to the user? –What format should the outputs take?

Copyright ©2004  Department of Computer & Information Science Developing an Algorithm 4.Develop a HIPO chart PROBLEM INPUT MODULE PROCESSES MODULE OUTPUT MODULE

Copyright ©2004  Department of Computer & Information Science Developing an Algorithm 5.Identify relevant modules –How can I break larger problems into smaller, more manageable pieces? –What inputs do the modules need? –What processes need to happen in the modules? –What outputs are produced by the modules?

Copyright ©2004  Department of Computer & Information Science Programs Sets of instructions that get the computer to do somethingSets of instructions that get the computer to do something Instructions are translated, eventually, to machine language using an interpreter or a compilerInstructions are translated, eventually, to machine language using an interpreter or a compiler Programs may be a few lines or millions of lines of codePrograms may be a few lines or millions of lines of code

Copyright ©2004  Department of Computer & Information Science Programming Tasks All computer programs are written so they can take data, manipulate and then produce a result.All computer programs are written so they can take data, manipulate and then produce a result. This process uses three distinct tasks:This process uses three distinct tasks: –INPUT – getting data from an external source (the user, a database, a file, etc.) –PROCESSING – actual manipulation of the data –OUTPUT – reporting the results of data manipulation back (using the monitor, writing information to a database, etc.)

Copyright ©2004  Department of Computer & Information Science Relationships in Programming Programmer – The person who solves a problem by providing a solution through writing instructions (the program) for the computer. (AKA – The developer)Programmer – The person who solves a problem by providing a solution through writing instructions (the program) for the computer. (AKA – The developer) User – Any person who uses a program written by a programmerUser – Any person who uses a program written by a programmer

Copyright ©2004  Department of Computer & Information Science Categories of Languages Machine LanguageMachine Language –Binary digits (bits – 1s and 0s) which are translated to electrical impulses that get the computer to do something –“Native” language of computers Assembly LanguagesAssembly Languages –Group of basic commands which are more like English –Tied to specific processors –Still need to be translated to machine language

Copyright ©2004  Department of Computer & Information Science Categories of Languages High Level LanguagesHigh Level Languages –In terms of syntax, very close to human language (mostly English) –Lower error rate than writing machine language or assembly language programs –Need to be translated to machine language before execution CompilersCompilers InterpretersInterpreters

Copyright ©2004  Department of Computer & Information Science More on High-Level Languages Operations common to all HL languages:Operations common to all HL languages: –Sequential Operations – Operations in which lines of code execute in order, one right after another –Conditional Operations – Operations in which execution depends on the outcome of a previous condition (usually evaluated to be TRUE or FALSE) –Looping Operations – Operations designed to repeat until a given condition is satisfied.

Copyright ©2004  Department of Computer & Information Science More on High-Level Languages Procedural LanguagesProcedural Languages –Early high level languages –Focus on structures –Examples include QuickBasic, Fortran, Pascal, Visual Basic (early versions) Object-Oriented languages (OOP)Object-Oriented languages (OOP) –More recent development –Focus on data, not structures (Primacy of Data) –Examples include Java, C#, C++, Visual Basic.Net

Copyright ©2004  Department of Computer & Information Science Object Oriented Programming Object – Unique programming entity that has methods, has attributes and can react to events.Object – Unique programming entity that has methods, has attributes and can react to events. Method – Things which an object can do; the “verbs” of objects. In code, usually can be identified by an “action” word -- Hide, ShowMethod – Things which an object can do; the “verbs” of objects. In code, usually can be identified by an “action” word -- Hide, Show

Copyright ©2004  Department of Computer & Information Science Object Oriented Programming Attribute – Things which describe an object; the “adjectives” of objects. In code, usually can be identified by a “descriptive” word – Enabled, BackColorAttribute – Things which describe an object; the “adjectives” of objects. In code, usually can be identified by a “descriptive” word – Enabled, BackColor Events – Forces external to an object to which that object can react. In code, usually attached to an event procedureEvents – Forces external to an object to which that object can react. In code, usually attached to an event procedure

Copyright ©2004  Department of Computer & Information Science Object Oriented Programming Class – Provides a way to create new objects based on a “meta-definition” of an object (Example: The automobile class)Class – Provides a way to create new objects based on a “meta-definition” of an object (Example: The automobile class) Constructors – Special methods used to create new instances of a class (Example: A Honda Civic is an instance of the automobile class.)Constructors – Special methods used to create new instances of a class (Example: A Honda Civic is an instance of the automobile class.)

Copyright ©2004  Department of Computer & Information Science OOP - Encapsulation Incorporation into a class of data & operations in one packageIncorporation into a class of data & operations in one package Data can only be accessed through that packageData can only be accessed through that package “Information Hiding”“Information Hiding”

Copyright ©2004  Department of Computer & Information Science OOP - Inheritance Allows programmers to create new classes based on an existing classAllows programmers to create new classes based on an existing class Methods and attributes from the parent class are inherited by the newly-created classMethods and attributes from the parent class are inherited by the newly-created class New methods and attributes can be created in the new class, but don’t affect the parent class’s definitionNew methods and attributes can be created in the new class, but don’t affect the parent class’s definition

Copyright ©2004  Department of Computer & Information Science OOP - Polymorphism Creating methods which describe the way to do some general function (Example: The “drive” method in the automobile class)Creating methods which describe the way to do some general function (Example: The “drive” method in the automobile class) Polymorphic methods can adapt to specific types of objects.Polymorphic methods can adapt to specific types of objects.

Copyright ©2004  Department of Computer & Information Science The Programming Development Cycle Done after identifying inputs, processing & outputsDone after identifying inputs, processing & outputs StepsSteps 1.Analyze the problem 2.Plan a solution to the problem (algorithm) 3.Design the user interface

Copyright ©2004  Department of Computer & Information Science The VB.NET Programming Development Cycle Steps (continued)Steps (continued) 4.Code the solution 5.Test and debug the solution 6.Complete program documentation 7.Begin to plan for next release (start Cycle again)

Copyright ©2004  Department of Computer & Information Science 1. Analyze the Problem Questions to ask:Questions to ask: –Who is my intended audience? –What SPECIFIC outcomes does my audience expect? –What business rules is my audience expecting to have incorporated into the solution? –What is the SCOPE of the problem?

Copyright ©2004  Department of Computer & Information Science 2. Plan a Solution (Algorithm) What types of programming structures are needed?What types of programming structures are needed? –Sequential structures –Conditional structures –Looping structures What data structures are needed?What data structures are needed? –Variables –Lists –Arrays

Copyright ©2004  Department of Computer & Information Science 3. Design the User Interface AKA – The “UI”AKA – The “UI” Is the UI “learnable”?Is the UI “learnable”? Is it simple? (Limit user choices)Is it simple? (Limit user choices) Does the UI promote error-proof use?Does the UI promote error-proof use? Is the layout of the UI arranged in a fashion conducive to the user’s culture and expectations?Is the layout of the UI arranged in a fashion conducive to the user’s culture and expectations?

Copyright ©2004  Department of Computer & Information Science 4. Code the Solution Develop an actual program from an algorithmDevelop an actual program from an algorithm Should be the “easiest” part of the process – all the work should already be done!Should be the “easiest” part of the process – all the work should already be done!

Copyright ©2004  Department of Computer & Information Science 5. Test & Debug the Solution Alpha Testing – Internal testing done with expected client data (NOT LIVE DATA)Alpha Testing – Internal testing done with expected client data (NOT LIVE DATA) Beta Testing – Testing done at the client site with their data (USUALLY LIVE DATA)Beta Testing – Testing done at the client site with their data (USUALLY LIVE DATA) Try to predict common user errorsTry to predict common user errors Test subjects should be Power Users, Normal Users and NeophytesTest subjects should be Power Users, Normal Users and Neophytes

Copyright ©2004  Department of Computer & Information Science 6. Complete Documentation User Documentation:User Documentation: –User Manual –Technical Documentation (for System Administrators) Internal Documentation:Internal Documentation: –Documentation comments –Code comments –Procedural comments –Should be done while coding!

Copyright ©2004  Department of Computer & Information Science 7. Plan Next Release What bugs need to be fixed?What bugs need to be fixed? –Are bugs “critical”? (Need to be fixed in a minor release) –If bugs are not critical, they can be fixed in next major release What product enhancements do the users want for the next release?What product enhancements do the users want for the next release?

Copyright ©2004  Department of Computer & Information Science Internal Commenting Comments are non-executable lines (the computer ignores them) which are used to communicate valuable information about code to othersComments are non-executable lines (the computer ignores them) which are used to communicate valuable information about code to others Types of Internal Commenting:Types of Internal Commenting: –Documentation Comments –Code Comments –Procedural Comments Comment Syntax:Comment Syntax: –C-like Syntax (C, C++, Java, JavaScript): /* This is a comment */ –Visual Basic Syntax: ‘This is a comment

Copyright ©2004  Department of Computer & Information Science Documentation Comments Used to given specific information about a programUsed to given specific information about a program Usually found at the beginning of a code windowUsually found at the beginning of a code window Include information about the author, creation date, purpose, modification date & modification historyInclude information about the author, creation date, purpose, modification date & modification history

Copyright ©2004  Department of Computer & Information Science Documentation Comment 'TITLE: Hello World, v2.0 'AUTHOR: Bob Molnar 'PURPOSE: To demonstrate changing of textbox 'properties using event procedures. 'CREATED ON: 'LAST MODIFIED ON: 'LAST MODIFIED BY: RSM 'MODIFICATION HISTORY: ' Renamed form to frmMain to ' conform with accepted naming standards (MJK) ' Created a Clear Button enabling ' users to clear output (RSM) NOTE: Example uses Visual Basic Syntax

Copyright ©2004  Department of Computer & Information Science Code Comments “Tell the story” of the code, in English“Tell the story” of the code, in English For this class, you should use code comments to indicate what lines of code doFor this class, you should use code comments to indicate what lines of code do

Copyright ©2004  Department of Computer & Information Science Code Comments /* Initialize loop counter to 1 */ counter = 1; /* Set loop to repeat 10 times */ while(counter <= 10) { /* Prompt for input */ printf("Enter grade: "); /* Get user's input, store in the variable grade */ scanf("%d", &grade); /* Get user's input, store in the variable grade */ scanf("%d", &grade); } /* end while */ NOTE: Example uses C Syntax

Copyright ©2004  Department of Computer & Information Science Procedural Comments Identify purpose, arguments & return values for proceduresIdentify purpose, arguments & return values for procedures Can be used in:Can be used in: –Event Procedures –Sub-Procedures –Function Procedures

Copyright ©2004  Department of Computer & Information Science Procedural Comments ' PROCEDURE: btnClear_Click ' TYPE: Event Procedure ' ARGUMENTS: VB-Generated ' PROCEDURE: btnClear_Click ' RETURNS: Nothing ' PURPOSE: Re-sets the value of the textbox ' txtDspMsg to null when the button btnClear ' clicked Private Sub btnClear_Click(...) Handles _ btnClear.Click txtDspMsg.Text = "" End Sub btnClear.Click txtDspMsg.Text = "" End Sub NOTE: Example uses Visual Basic Syntax

Copyright ©2004  Department of Computer & Information Science Questions?

Resources Bob Molnar, N201 Lecture NotesBob Molnar, N201 Lecture Notes Visual Basic.NET Primer Plus by Jack Purdum (Sams Publishing, 2003)Visual Basic.NET Primer Plus by Jack Purdum (Sams Publishing, 2003) An Introduction to Programming Using Visual Basic.NET Fifth Edition by David I. Schneider (Prentice Hall, 2003)An Introduction to Programming Using Visual Basic.NET Fifth Edition by David I. Schneider (Prentice Hall, 2003) C: How to Program by Deitel & Deitel (Prentice Hall, 2004)C: How to Program by Deitel & Deitel (Prentice Hall, 2004)