Download presentation
Presentation is loading. Please wait.
Published byAvis Horton Modified over 9 years ago
1
Programming Languages Part 2 CS 1 Rick Graziani Spring 2008
2
Rick Graziani graziani@cabrillo.edu2 Goal of third generation languages Goal of third generation languages (C, C++, Java): –Statements (language) do not refer to the attributes of any particular machine Statements not part of the CPU’s machine language Program written an a third generation language could theoretically be compiled to run on any other computer. –In reality this is not completely accurate Op-code OperandDescription 1LOAD reg. R from cell XY. 2LOAD reg. R with XY. 3STORE reg. R at XY. 4MOVE R to S. 5ADD S and T into R. (2’s comp.) 6ADD S and T into R. (floating pt.) 7OR S and T into R. 8AND S and T into R. 9XOR S and T into R. AROTATE reg. R X times. BJUMP to XY if R = reg. 0. CHALT.
3
Rick Graziani graziani@cabrillo.edu3
4
4
5
5 Programming language standards Programming language (C, C++, Java): –Standard commands –Vendor’s options Standard organizations: –ANSI (American National Standards Institute) –ISO (International Organization for Standardization) ISO is not a TLA but meaning “equal” in Greek
6
Rick Graziani graziani@cabrillo.edu6 Vendor Compiler Options Vendor compiler options: –Language extensions –Features to make it easier to program –Not compatible with other vendor’s compilers –Makes it difficult to change to another vendor’s compiler
7
Rick Graziani graziani@cabrillo.edu7 Evolution of Programming Languages Lineage does not represent that one language evolved from another, although this is the case with some languages.
8
Rick Graziani graziani@cabrillo.edu8 Evolution of Programming Languages
9
Rick Graziani graziani@cabrillo.edu9 Evolution of Programming Languages
10
Rick Graziani graziani@cabrillo.edu10 Procedural Languages –Traditional approach to programming. –Procedure is a sequence of commands which can be used multiple times by the main set of instructions. Procedural Languages include: –Fortran, COBOL, BASIC, ADA, Pascal, C Main Program Procedure 1 Procedure 2 Procedure 3
11
Rick Graziani graziani@cabrillo.edu11 Object Oriented Programming Object Oriented Programming (OOP) –Software system is viewed as a collection of units, called objects. –Object – has the capability of performing certain actions and to call other objects. Example: Screen icons –Each icon is an object –Each object encompasses a collection of procedures known as methods –Each method describes how that object will respond to events such as: Double left click (run the program) Right click (display a series of options) Example OOP Languages: C++, Visual Basic, Java Left click Right click
12
Rick Graziani graziani@cabrillo.edu12 Other types of languages Other types of languages include: –Functional languages: LISP, Scheme –Declarative languages: Prolog –Scripting languages: Perl, PHP, shell scripts, HTML
13
Rick Graziani graziani@cabrillo.edu13 Programming Concepts Program consists of: –Declarative statements Variables and data types –Imperative statements Procedures, instructions, and algorithms –Comments Enhance readability Used throughout the program
14
Rick Graziani graziani@cabrillo.edu14 Variables and Data Types Variable – A location in RAM (main memory), given a descriptive name, which stores information. Data type – Variables are a type of day which can be: –Number Integer: 0, 1, 2, 3, 4, 5, 6, etc. Real (floating point): 9.75, 300.5412 –Character: a, b, c, A, B, C, etc. –String of text: “123 Main Street” Working area or scratch pad for the program. 125 9.75 d Integer Float Character
15
Rick Graziani graziani@cabrillo.edu15 Programming Concepts Count 1 I will not throw paper airplanes in class. 2 3 … 499 I will not throw paper airplanes in class. 500 I will not throw paper airplanes in class. 501
16
Rick Graziani graziani@cabrillo.edu16 Variables Variables are declared, defined in the declaration section of the program. –Usually at the beginning of the program –Examples: int height_in_inches char first_initial float price
17
Rick Graziani graziani@cabrillo.edu17 Variables Variables: –Can be given an initial value within the program –Value may change from: Program instructions User input Count 1 I will not throw paper airplanes in class. 2 3 … 499 I will not throw paper airplanes in class. 500 I will not throw paper airplanes in class. 501
18
Rick Graziani graziani@cabrillo.edu18 Data structure Variables are often associated with a data structure. Data structure – A conceptual shape of arrangement of data Homogeneous Array –Block of values of the same type –Such as a one dimensional list or a two dimensional array (row, column) Example: String or array of characters –char Last_Name[25] 1 2 3 4 5 … … 24 25 B o o l o o char Last_Name[25]
19
Rick Graziani graziani@cabrillo.edu19 Data structure Two dimensional array –Row and column –Integer pins [bowler, frame] 1 2 3 4 3 12 0 7 6 9 1 7 Integer pins [bowler, frame]
20
Rick Graziani graziani@cabrillo.edu20 Assigning Value Assignment statement – Statement which assigns a value to a variable. –Value assigned from user input –Value assigned from another variable –Value assigned from a specific value –Value assigned from a calculation that can include both variables and assigned values. 125 9.75 d Integer Float Character Fahrenheit = (9/5)Celcius + 32
21
Rick Graziani graziani@cabrillo.edu21 Open Source Software Open source software is computer software for which the human-readable source code is made available under a copyright license (or arrangement such as the public domain) that meets the Open Source Definition. This permits users to: –Use the software –Change the software –Improve the software –Redistribute it in modified or unmodified form It is often developed in a public, collaborative manner. Wikipedia
22
Rick Graziani graziani@cabrillo.edu22 Open Source Definition 1. Free Redistribution: the software can be freely given away or sold. 2. Source Code: the source code must either be included or freely obtainable. (Without source code, making changes or modifications can be impossible.) 3. Derived Works: redistribution of modifications must be allowed. 4. Integrity of The Author's Source Code: licenses may require that modifications are redistributed only as patches. 5. No Discrimination Against Persons or Groups: no one can be locked out. 6. No Discrimination Against Fields of Endeavor: commercial users cannot be excluded. 7. Distribution of License: The rights attached to the program must apply to all to whom the program is redistributed without the need for execution of an additional license by those parties. 8. License Must Not Be Specific to a Product: the program cannot be licensed only as part of a larger distribution. 9. License Must Not Restrict Other Software: the license cannot insist that any other software it is distributed with must also be open source. 10. License Must Be Technology-Neutral: no click-wrap licenses or other medium-specific ways of accepting the license must be required.
23
Rick Graziani graziani@cabrillo.edu23 Projects Apache Software Foundation Audacity Blender -- 3d animation CodePlex Debian Drupal -- Content Management System Eclipse Foundation Fedora Project FreeBSD Freedesktop.org Free Software Foundation FUSE ESB, FUSE Message Broker, FUSE Services Framework and FUSE Mediation Router - Supported versions of Apache projects GIMP -- Image Editing similar to photoshop GNU Inkscape -- Vector tool similar to illustrator Java JBoss Joomla! -- Content Management System KnowledgeTree -- Document Management for Teams and Small to Medium-sized Organizations LibreSource Linux Macaulay2 -- algebraic geometry and commutative algebra Miranda IM -- multiprotocol IM Mozilla Foundation MySQL NetBSD OpenBSD Open-Xchange Open Market For Internet Content Accessibility OpenOffice.org -- Word processor, spreadsheet, presentation tool, database, equation editor OpenSees -- open system for earthquake engineering simulation OpenSuse Open Solutions Alliance Open Source Development Labs Open Source Initiative Open Source Geospatial Foundation PHP -- Hypertext preprocessor Povray -- Ray Tracer Python Restore -- RESTORE is an open source project for heterogeneous system backup and restore. SAGE -- Magma computer algebra system Scribus -- Desktop publishing similar to pagemaker SourceForge -- Repository of open source software Subversion (software) -- version control Synfig -- 2d vector graphic and animation TYPO3 -- Enterprise Level Content Management System ubuntu Zenoss Zimbra
24
Programming Languages Part 2 CS 1 Rick Graziani Spring 2008
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.