版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Chapter 6,Programming Languages, 2007 Pearson Addison-Wesley. All rights reserved, 2007 Pearson Addison-Wesley. All rights reserved,0-2,Chapter 6: Programming Languages,6.1 Historical Perspective 6.2 Traditional Programming Concepts 6.3 Procedural Units 6.4 Language Implementation 6.5 Object Oriente
2、d Programming 6.6 Programming Concurrent Activities 6.7 Declarative Programming, 2007 Pearson Addison-Wesley. All rights reserved,0-3,Figure 6.1 Generations of programming languages, 2007 Pearson Addison-Wesley. All rights reserved,0-4,Second-generation:Assembly language,A mnemonic system for repres
3、enting machine instructions Mnemonic names for op-codes Identifiers: Descriptive names for memory locations, chosen by the programmer, 2007 Pearson Addison-Wesley. All rights reserved,0-5,Assembly Language Characteristics,One-to-one correspondence between machine instructions and assembly instructio
4、ns Programmer must think like the machine Inherently machine-dependent Converted to machine language by a program called an assembler, 2007 Pearson Addison-Wesley. All rights reserved,0-6,Program Example,Machine language156C166D505630CEC000,Assembly languageLD R5, PriceLD R6, ShippingChargeADDI R0,
5、R5 R6ST R0, TotalCostHLT, 2007 Pearson Addison-Wesley. All rights reserved,0-7,Third Generation Language,Uses high-level primitives Similar to our pseudocode in Chapter 5 Machine independent (mostly) Examples: FORTRAN, COBOL Each primitive corresponds to a sequence of machine language instructions C
6、onverted to machine language by a program called a compiler, 2007 Pearson Addison-Wesley. All rights reserved,0-8,Figure 6.2 The evolution of programming paradigms, 2007 Pearson Addison-Wesley. All rights reserved,0-9,Figure 6.3 A function for checkbook balancing constructed from simpler functions,
7、2007 Pearson Addison-Wesley. All rights reserved,0-10,Figure 6.4 The composition of a typical imperative program or program unit, 2007 Pearson Addison-Wesley. All rights reserved,0-11,Data Types,Integer: Whole numbers Real (float): Numbers with fractions Character: Symbols Boolean: True/false, 2007
8、Pearson Addison-Wesley. All rights reserved,0-12,Variable Declarations,float Length, Width; int Price, Total, Tax; char Symbol;, 2007 Pearson Addison-Wesley. All rights reserved,0-13,Figure 6.5 A two-dimensional array with two rows and nine columns, 2007 Pearson Addison-Wesley. All rights reserved,0
9、-14,Figure 6.6 The conceptual structure of the heterogeneous array Employee,Figure 6.7 Control structures and their representations in C, C+, C#, and Java, 2007 Pearson Addison-Wesley. All rights reserved,0-16,Figure 6.8 The for loop structure and its representation in C+, C#, and Java, 2007 Pearson
10、 Addison-Wesley. All rights reserved,0-17,Procedural Units,Local versus Global Variables Formal versus Actual Parameters Passing parameters by value versus reference Procedures versus Functions, 2007 Pearson Addison-Wesley. All rights reserved,0-18,Figure 6.9 The flow of control involving a procedur
11、e, 2007 Pearson Addison-Wesley. All rights reserved,0-19,Figure 6.10 The procedure ProjectPopulation written in the programming language C,Figure 6.11 Executing the procedure Demo and passing parameters by value,Figure 6.12 Executing the procedure Demo and passing parameters by reference, 2007 Pears
12、on Addison-Wesley. All rights reserved,0-22,Figure 6.13 The function CylinderVolume written in the programming language C, 2007 Pearson Addison-Wesley. All rights reserved,0-23,Figure 6.14 The translation process, 2007 Pearson Addison-Wesley. All rights reserved,0-24,Figure 6.15 A syntax diagram of
13、our if-then-else pseudocode statement, 2007 Pearson Addison-Wesley. All rights reserved,0-25,Figure 6.16 Syntax diagrams describing the structure of a simple algebraic expression, 2007 Pearson Addison-Wesley. All rights reserved,0-26,Figure 6.17 The parse tree for the string x + y x z based on the s
14、yntax diagrams in Figure 6.17,Figure 6.18 Two distinct parse trees for the statement if B1 then if B2 then S1 else S2, 2007 Pearson Addison-Wesley. All rights reserved,0-28,Figure 6.19 An object-oriented approach to the translation process, 2007 Pearson Addison-Wesley. All rights reserved,0-29,Objec
15、ts and Classes,Object: Active program unit containing both data and procedures Class: A template from which objects are constructed An object is called an instance of the class., 2007 Pearson Addison-Wesley. All rights reserved,0-30,Figure 6.20 The structure of a class describing a laser weapon in a
16、 computer game, 2007 Pearson Addison-Wesley. All rights reserved,0-31,Components of an Object,Instance Variable: Variable within an object Holds information within the object Method: Procedure within an object Describes the actions that the object can perform Constructor: Special method used to init
17、ialize a new object when it is first constructed, 2007 Pearson Addison-Wesley. All rights reserved,0-32,Figure 6.21 A class with a constructor, 2007 Pearson Addison-Wesley. All rights reserved,0-33,Object Integrity,Encapsulation: A way of restricting access to the internal components of an object Pr
18、ivate versus public, 2007 Pearson Addison-Wesley. All rights reserved,0-34,Figure 6.22 Our LaserClass definition using encapsulation, 2007 Pearson Addison-Wesley. All rights reserved,0-35,Additional Object-oriented Concepts,Inheritance: Allows new classes to be defined in terms of previously defined
19、 classes Polymorphism: Allows method calls to be interpreted by the object that receives the call, 2007 Pearson Addison-Wesley. All rights reserved,0-36,Programming Concurrent Activities,Parallel (or concurrent) processing: simultaneous execution of multiple processes True concurrent processing requ
20、ires multiple CPUs Can be simulated using time-sharing with a single CPU, 2007 Pearson Addison-Wesley. All rights reserved,0-37,Figure 6.23 Spawning threads, 2007 Pearson Addison-Wesley. All rights reserved,0-38,Controlling Access to Data,Mutual Exclusion: A method for ensuring that data can be acce
21、ssed by only one process at a time Monitor: A data item augmented with the ability to control access to itself, 2007 Pearson Addison-Wesley. All rights reserved,0-39,Declarative Programming,Resolution: Combining two or more statements to produce a new statement (that is a logical consequence of the originals). Example: (P OR Q) AND (R OR Q) resolves to (P OR R) Resolvent: A new statement deduced by resolution Clause form: A statement whose elementary components are connected by the Boolean operatio
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 外研八下英语Unit 6 Starting out-Understanding ideas《合作探究三》课件
- 人教 八年级 语文 下册 第1单元《1. 教材习题课件》课件
- 2025 高中信息技术数据结构在视频会议画面清晰度增强的新算法课件
- 2026年自由行旅游合同(1篇)
- 2026年药品品种咨询合同(1篇)
- 心理评估的方法和工具应用
- 2026年及未来5年市场数据中国榆黄菇行业市场深度分析及投资潜力预测报告
- 2026届浙江宁波十校高三下学期二模地理试题+答案
- 春季工厂消防设施巡检与维护全流程指南
- 农业风险防控管理全流程体系构建与实践
- 4.2依法履行义务 课 件 2024-2025学年统编版道德与法治八年级下册
- 2025年中山中考物理试题及答案
- 2024年贵州省普通高中学业水平选择性考试地理试题(原卷版+解析版)
- 办公室安全知识培训
- 《GNSS定位测量》考试复习题库(含答案)
- 塑料搅拌机安全操作规程
- 2024年皖西卫生职业学院单招职业适应性测试题库及答案解析
- 《爱鸟惜花守家园·考察身边的生物资源》课件 2023-2024学年辽海版《综合实践活动》七年级下册
- GB/T 6553-2024严酷环境条件下使用的电气绝缘材料评定耐电痕化和蚀损的试验方法
- 《家用电冰箱与空调器维修》课件
- GB/T 14048.11-2024低压开关设备和控制设备第6-1部分:多功能电器转换开关电器
评论
0/150
提交评论