Docstoc

PPT 9 - Adaptive Structure

Document Sample
PPT 9 - Adaptive Structure Powered By Docstoc
					        Programming



Robert Love, Venkat Jayaraman

           July 22, 2008
     SSTP Seminar – Lecture 9
                                                            Overview
    • Presentation
            – Engineering Programs
            – The Puzzle Pieces (of Code)
            – The Puzzle/Big Picture
               • Object Oriented
               • Procedural
            – The Missing Pieces: Debugging and Process Control
            – Visual Interfaces
    • Discussion
    • Activity
6/10/2011                          UF Flight Controls Lab          2
                                    Engineering Programs
   • Commonly Used Engineering Programming
     Software
            – Matlab
            – C, C++, C#
            – Java
            – Fortran, Visual Basic, Excel (old school)
            – Maple. Mathematica (more for physics and math)
            – Visual Based Codes
              • Simulink, Labview, Lego Mindstorms


6/10/2011                        UF Flight Controls Lab        3
                                The Pieces: Some Types
    • Think of a puzzle, putting together pieces
            – Menus and user inputs
            – The “if” statement
            – The “for/do/while” loop
            – Variables: Matrices vs. Strings
               • Note: Be careful with Row vs. Columns (specify indices)
            – Pause, return
            – Basic Logic: On/off switching, true/false: 1 vs. 0
            – Counters
            – Timers
6/10/2011                         UF Flight Controls Lab                   4
                        The Pieces: Comprehensible Code

   • Keep overall structure as organized and
     efficient as possible!
   • Comments
            – Others may use your code, so keep things
              organized with comment blocks and subsections
   • Variable Names
            – Engineers like names with physical meanings
            – Don’t just label aaa28 if possible!



6/10/2011                      UF Flight Controls Lab         5
                                          The Pieces: Be Lazy!
    • Don’t do the same work twice if possible
            – Save data and figures (often, not always)
    • Record what you did
            – Often codes have a “command history” that keeps
              track for you
    • Balance time to build automation into the
      code vs. the times will have to repeat process



6/10/2011                       UF Flight Controls Lab          6
                                   The Puzzle: Planning
• Try to write out basic flow of solution to
  puzzle (like looking at the box top)
• Visual Codes (Labview vs. Simulink)
• UML: Anyone can code if designed well
    – This is more a software engineering tool
    – Learn to speak other engineer’s language and how
      to use their tools so you can work with them!
• Ignorance is your enemy!
    – Look at working codes as if you were learning a
      language, study the vocabulary and grammar
6/10/2011                  UF Flight Controls Lab        7
                       The Puzzle: Basic Structure
 • User Inputs? Final Outputs? Find the flow…
 • Working Directories
 • Script vs. function files
       – Visual Representation: use script to call function files
       – Try to break small steps into recyclable function files
       – Inputs and outputs




6/10/2011                    UF Flight Controls Lab                 8
              Procedural Programming vs Object Oriented
                                          Programming

• The unit in procedural programming is a function,
  and unit in object-oriented programming is a class
• Procedural programming concentrates on creating
  functions, while object-oriented programming starts
  from isolating the classes, and then look for the
  methods inside them.
• Procedural programming separates the data of the
  program from the operations that manipulate the
  data, while object-oriented programming focus on
  both of them
                    Trouble Shoot (Debugging)
• Syntax vs. Logic errors
    – Syntax: missing parenthesis or capital
      letter somewhere…
    – Logic errors: you dropped out data, you
      are turning the light on when you wanted
      to be turning it off
• Version Control: Go back in time
    – Working as a team (on a code)
    – Ex: Subversion, Allway Sync



6/10/2011                 UF Flight Controls Lab   10
                                   Make it look pretty…
• Graphical User Interfaces (GUI’s)
    – May obtain input or display output
• Some components
    – Titles, triggers, check boxes, radio
      boxes, entry boxes, sliders, graphs


• Graphing Data
    – 2D plot, 3D plot, surface plot,
      grid/mesh plot
    – Show what is required!

6/10/2011                   UF Flight Controls Lab   11
                                                Activity
    • Looking at basic code




6/10/2011              UF Flight Controls Lab         12

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:12
posted:6/10/2011
language:English
pages:12