1 / 48

Programming Fundamentals

Neal Stublen nstublen@jccc.edu. Programming Fundamentals. An Overview of Computer Programming. Computer Systems. Hardware. Keyboard. Microphone. Display. Mouse. Microprocessor. Memory Chips. Computer Systems. System Software. iOS. Windows. Mac OS. Linux. Android. Hardware.

elmo
Télécharger la présentation

Programming Fundamentals

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Neal Stublen nstublen@jccc.edu Programming Fundamentals

  2. An Overview of Computer Programming

  3. Computer Systems Hardware Keyboard Microphone Display Mouse Microprocessor Memory Chips

  4. Computer Systems System Software iOS Windows Mac OS Linux Android Hardware

  5. Computer Systems Application Software Microsoft Word Photoshop Firefox Face Time Visual Studio Angry Birds System Software Hardware

  6. System vs. Application Software • Specialized skills target different levels of software development • Application software provides specialized services • System software makes common services available to all applications • Application software performance affects (most often) a single application • System software performance impacts every application

  7. Review Question • Classify the following as system software or application software: • Word processing software • Printer driver software • Video games • Internet browser • The line may seem fuzzy at times, but often individual developers may focus on one or the other.

  8. Software Operations Input

  9. Data Input • Sources of data input? • Keyboard/mouse • Touch screen • Files on a hard drive • Sound in a microphone • Camera images • Accelerometer/gyroscope sensor data

  10. Software Operations Input Processing

  11. Processing • Processing is done by the CPU • Examples of processing • Position cursor on screen • Reformat text • Perform voice recognition • Sharpen photographic data • Detect shaking gesture

  12. Software Operations Input Processing Output

  13. Data Output • Examples of data output? • Update display on monitor • Play sounds through a speaker • Write files on a hard drive • Start or stop a motor

  14. "Coding" Software • Software instructions are written in a computer programming language • What programming languages can you identify? • C/C++ • Java • C# • Visual Basic • Python • PHP • JavaScript • Perl

  15. Language Progression • Programming instructions are converted into codes that can be understood by the computer • Languages progress to make programming tasks easier and clearer .DATA var  DB 0 moveax, [var] inceax mov [var], eax intvar = 0; var++;

  16. Language "Syntax" • Each language has its own syntax for formatting instructions • int value = 25;  // C++, C# • value = 25  // Python • var value = 25;  // JavaScript • Syntax must match expected formatting or the computer program cannot be converted into machine instructions

  17. Compilers/Interpreters • Computer language instructions are converted using a compiler or interpreter • A compiler converts a program into low-level instructions before the program can execute • Syntax errors are found before the program runs • C++, C#, Java • An interpreter converts a program into low-level instructions as the program executes • Syntax errors may not be discovered for a long time • Python, PHP, Perl, JavaScript

  18. Source Code and Object Code • We refer to our high-level computer program as source code • We refer to low-level machine instructions as object code

  19. Programming Logic • Instructions are performed in a specific sequence to accomplish the desired purpose • Logical errors prevent a program from working correctly • Logical errors may exist when syntax errors do not

  20. Syntax Errors • Two add eggs • Flour in stir • One sugar add cup • At minutes 350 45 bake degrees for

  21. Logic Errors • Stir in flower • Add two eggs • Bake at 350 degrees for 45 minutes • Add one cup sugar • May be referred to as "sematic errors" • More commonly referred to as "bugs"

  22. Sample I-P-O input someNumber someResult = someNumber * 2 output someResult Pseudocode instructions are English-like statements that represent the actions a program will need to take. 

  23. Sample I-P-O input someNumber someResult = someNumber * 2 output someResult Input some value and store it in a memory location that's referred to using the name "someNumber".

  24. Sample I-P-O input someNumber someResult = someNumber * 2 output someResult Retrieve the value stored in the memory location referred to by "someNumber".  Double the value and store it in a memory location referred to by " someResult".

  25. Sample I-P-O input someNumber someResult = someNumber * 2 output someResult Send the value stored in the memory location referred to by "someResult" to an output device.

  26. Review Question Which of the following best describes a syntax error? • Syntax errors are found during user data input processing. • Syntax errors are identified by the compiler or interpreter. • Syntax errors are found when the program is run. • Syntax errors may be identified by the hardware device driver code.

  27. Review Question Which of the following best describes a syntax error? • Syntax errors are found during user data input processing. • Syntax errors are identified by the compiler or interpreter. • Syntax errors are found when the program is run. • Syntax errors may be identified by the hardware device driver code.

  28. Review Question Which of the following best describes a logic error? • Logic errors are found during user data input processing. • Logic errors are identified by the compiler or interpreter. • Logic errors are found when the program is run. • Logic errors may be identified by the hardware device driver code.

  29. Review Question Which of the following best describes a logic error? • Logic errors are found during user data input processing. • Logic errors are identified by the compiler or interpreter. • Logic errors are found when the program is run. • Logic errors may be identified by the hardware device driver code.

  30. Procedural Programming • Breaks down a programming task into a series of smaller subtasks (or procedures) • Focus on procedures needed to accomplish the task

  31. Object-Oriented Programming • Breaks down a programming task into objects that model the task • Focus on objects that can be used to accomplish the task

  32. Objects • Attributes - features or properties of the object (things it "has" or "is") • Behaviors - actions that can be performed on or by the object (things it "does") • Object state - values of an object's collection of attributes

  33. Stages of Development • Object-oriented analysis (OOA) • Object-oriented design (OOD) • Coding/Implementation • Testing • Maintenance

  34. Object-Oriented Analysis • Determine user needs • Who is a user? • What problem needs to be solved?

  35. Object-Oriented Design • Develop an object model to represent the problem and its solution • Consider object attributes and behaviors • Determine relationships between objects • How do they communicate and respond to one another? • has a, is a, creates a • Each type of object will be represented by a class

  36. Object Examples • What objects can you identify on your phone? • What attributes and behaviors would be defined for those objects?

  37. Coding/Implementation • Develop the logic of the program • Mental planning • Simple to complex drawings • Collaboration with others • Produce algorithms - a sequence of steps to solve a problem • Write source code in an appropriate language • Translate source code into object code that can be understood by the computer

  38. Language Selection • The choice of a programming language may be dictated by the problem being solved. • Support multiple platforms? • Run within a web browser? • Performance is critical? • Google App Engine? • Extension for WordPress? • Windows desktop application?

  39. Testing • All software needs to be tested • Confirms the program works as expected • Self-testing • Testing team • Automated testing

  40. Maintenance • All software needs updates • Why would you need to update an application? • Mistakes need correction • User needs change • Features can be improved

  41. Tools for Planning

  42. Pseudocode • English-like representation of the logical steps needed to solve a problem • Guidelines: http://bit.ly/pf-pcode start input radius area = radius * radius * pi output area end start   change oil   inflate tires   check fluids end

  43. Flowcharts • Visual representation of program logic • Terminal blocks • I/O blocks • Processing blocks • Decision blocks • Gliffy - http://www.gliffy.com • Draw.io - http://www.draw.io • Lucidchart- http://www.lucidchart.com • Visual Logic – http://www.visuallogic.org

  44. Example • Approaching a stop light...

  45. Programming Environments • Text editor • Integrated development environment (IDE) • Editor • Compiler • Debugging Tools • Notepad++ • Visual Studio

  46. User Environments • Command line • Graphical user interface (GUI)

  47. Exercise • Case Projects, p. 29, #1

  48. Summary • Overview of computer systems • System vs. application software • Software operations (I-P-O) • Programming terminology • Programming methodology • Planning tools • Application environments

More Related