Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

day2 by shuifanglj

VIEWS: 2 PAGES: 24

									     COMP 3000: Class #2 -- 14 Jan 2003
     Before class starts …

   Everyone:
      Pick up 3 hand-outs from back table
             Extra Credit Information
             Today’s Slides
             OO Example Hand-out
   People who still owe me a “Student Experience & Equipment” Survey
        Pick up this one-page survey from the floor near the podium
        Please return it to me as you leave class today




                                                                       1
    COMP 3000: Class #2 Overview

   Announcements
   Finish OO Concepts Discussion
      with class diagrams on ELMO
      with pseudocode to emphasize value of OO


       Then, if time permits ...
   QUICK review of a few key computer concepts
   Start discussing C++ syntax



                                                  2
    COMP 3000: Class #3 Overview

   Call roll
   Announcements
   Continue with C++ syntax discussion
       Look at (more) code examples
       Review Jeanne’s Focus/Warning List
   Demo Development Environment
   Assign Program #1
            Recall only 5% => not very big!
            Expect to use I/O, variables, and a few control constructs



                                                                          3
    Announcements

   We have a Teaching Assistant!
       Donghoon Kim
            Office: Shop 1, Room 102
            Will be maintaining Website
            Was TA for this class last fall !
            Office Hours: to be announced
            Office Phone: 844-6321
            Email: kimdong@eng.auburn.edu




                                                 4
    My Info -- Updates

   My home email is up and running; OK to use it!
     On syllabus: snowski@computer.org
   My Auburn email will be murtajl@eng.auburn.edu
     Account “should be up very soon”
     Use home email until directed otherwise

   My Office Hours:
     Added Mon 2-3 p.m.
     May change Tues & Thurs to 4-5 p.m.
       (so I can address some questions here for you)
     Might move location of some office hours
                                                        5
    Announcements (cont)

   Grades
       “Standard” Auburn Letter Grading Scheme

   Extra Credit -- Yes!
       Will be added to your completed course average
       You may earn <= 10 points
       You may select from 14 points of “options”
       Details -- see Extra Credit Hand-out


                                                         6
    Announcements (cont)

   Exams
       All in class (1 hr 15 minutes); no take-home
       You will be allowed to use a “Crib Sheet”
            Two sheets of paper, front only (i.e., 2 pages total)
            Must be hand-written, on paper with blue lined background
            Make YOURSELF a photocopy to keep; originals to be
             handed in with exam
            NO photocopies allowed to be used during the exam
            Perfectly legal to work together to design your crib sheet
       Recommendation: Start assembling ideas for this
        WELL BEFORE the night before the exam …         :-)
                                                                          7
    Announcements (cont)

   Important Chapter Coverage Notes
       We will not cover every single C++ feature presented in
        each chapter in class.
       We will discuss the C++ features you MUST know
            Some features covered in detail in class
            Some simple features MENTIONED in class;
               You will need to learn syntax details from text
       WARNING: Some C/C++ features are very likely to
        cause significant grief for inexperienced programmers
            Therefore: Jeanne’s Focus/Warning List

                                                                 8
    Jeanne’s Focus/Warning List: Ch 2

   Not needed (can be accomplished another way)
       Section 2.14 for Loops
       Section 2.16 switch Construct

   DANGEROUS to newer programmers
      The Conditional operator ? Text Ed 4, p. 78
      Section 2.12 Increment and Decrement Operators
      Section 2.16 switch Construct
      Section 2.18 break and continue Constructs
   You are permitted to use these -- at your own risk.
   You will NOT need them for my exams or pgmg asgmts.
                                                          9
    COMP 3000: Class #2 Overview

   Call roll
   Announcements
   Finish OO Concepts Discussion
      with class diagrams on ELMO
      with pseudocode to emphasize value of OO


       Then, if time permits ...
   QUICK review of a few key computer concepts
   Start discussing C++ syntax

                                                  10
    Reminder: Key OO Concepts

   Abstraction

   Inheritance
       of data
       of operations

   Polymorphism
       Provides an alternative to strict inheritance of the
        superclass’s operation

                                                               11
    Here’s where we stopped:
    Polymorphism

   Recall:
       One operation; different methods (implementations) for
        different subclasses within same class

   Run-time system selects correct method (fcn) while
    program is executing, based on data type
       Background: OO software development is highly dependent on use of
        “pointers” -- a special   kind of pointer!



                                                                            12
    OO -- Overview of Example
      (red = hand-out; yellow = ELMO)

   UML “Class” -- levels of abstraction
   Student, Professor => Person (leave space @ R)
   Pseudocode
       Report_Name (OPERATION of PERSON)
       Introduce_People_Here (“Main Program”)
   Add additional kind of Person (TA)
   Observe ease of change
       Add new OBJECT
       “Main Program” source code: NO CHANGE!
                                                     13
     Polymorphism (cont)

   Benefits of Polymorphism
       Add new objects without modifying main program.
       Facilitates reuse of code from superclasses
              when desired
       Allows programmer to provide different method if
        desired

   Result: Code is easier to maintain!
              (So what???)

                                                           14
    Polymorphism -- a bit more
    (not testable; for programmers’ info)

   Operation in superclass => operation available in
    subclass(es)

   METHOD will be inherited from superclass unless
    that method is overRIDDEN.

   Don’t confuse overRIDE with overLOAD
             (next chart -- but NOT testable!)

                                                        15
    OverRIDE vs OverLOAD
    (not testable)

   OverRIDE:
       The specific OPERATION will be implemented by a
        new METHOD for this particular subclass. Signature
        (parameter list) “equivalent.”

   OverLOAD:
       Used same NAME for two DIFFERENT operations!
        (parameter lists /= )



                                                             16
    COMP 3000: Class #2 Overview

   Call roll
   Announcements
   Finish OO Concepts Discussion
      with class diagrams on ELMO
      with pseudocode to emphasize value of OO


       Then, if time permits ...
   QUICK review of a few key computer concepts
   Start discussing C++ syntax

                                                  17
    QUICK Review:
    Key Computer Concepts

   Computer Organization
       Both eds, Sect 1.3, pp. 5-6
       1. Input
       2. Output
       3. Memory
       4. ALU
       5. CPU
       6. Secondary Storage


                                      18
    QUICK Review:
    Key Computer Concepts

   What is a computer?
       Section 1.2
            VERY fast computations and logical decisions --
                   ONE AT A TIME (so what?)
            Roughly, what does “700 MHz” mean?
            {Engineers: Right, “computer cycle” != “instruction”}
            Follow (“execute”) instructions in computer programs

       OK, so what is a computer program?
            VERY Simple: Figure 1.2


                                                                     19
    QUICK Review:
    Key Computer Concepts

   Program = Series of Instructions to the Computer
       Two Primary Components
            Data
                Data Types (kinds of data needed)

                Identifiers (names for variables, constants, etc)

            Instructions
                Control Structures (why so important?)

                Functions (identifiers also used to name these)

                What else?     ___________ & ___________



                                                                     20
How do computer programs get built?
From Source Code to Executable

   Programmer
        Text File via
   Editor
        “Source code” (what we usually mean by “pgm”) out of editor
   Compiler (perhaps preceded by pre-processor)
        Source code in; Object code out of compiler
   Linker/Loader
        Object code in; Executable code out to computer
   Computer follows program
       (normally including giving results to customer)
   ELMO vs Fig 1.1 (4 ed: p. 16)
                                                                  21
    QUICK Review:
    Key Computer Concepts


   More complicated computer program examples
       Figure 2.7 (4 ed: p. 84)
            There is a very subtle error here ….
            Ideas from more experienced programmers?

       Figure 2.9 (4 ed: p. 89)
            Data type solution!




                                                        22
    Crib Sheet Recommendations

   Rules for Identifiers
   How to declare different types of data
   Operators and their precedence: Suggestions
       See List of Figures at front of each text
             “Precedence and associativity of operators discussed so far”
               Example: Figure 1.15 in FOURTH Edition, p. 39
            Figure 1.13
            Figure 2.31
   Syntax for (my required) control structures

                                                                             23
    COMP 3000: Class #2 Summary

   Announcements
   Finish OO Concepts Discussion
      with class diagrams on ELMO
      with pseudocode to emphasize value of OO


       Then, if time permits ...
   QUICK review of a few key computer concepts
   Start discussing C++ syntax



                                                  24

								
To top