计算机专业英语第五章.ppt
- 格式:ppt
- 大小:731.00 KB
- 文档页数:26
CoUnit 5 Programming Language·59·conversation.Jerry: Please have a seat, Tom. Tom: Thanks.Jerry: Well, Tom, what kind of education have you got?Tom: I studied computer science in Zhejiang University, and got a B. S. degree. Jerry: OK, what specialized courses did you take?Tom: The specialized courses I completed include computer science, operation systems, Java, OOA&OOD, software engineering, etc.Jerry: What kind of experience have you got for the job? Tom: I've been a computer programmer for more than two years. Jerry: What kind of software do you have a good command of? Tom: 、JS and Photoshop, etc. Jerry: Well, can you start next Monday? Tom: Sure.Jerry: That’s settled then.TASK II TEXT AIntroduction to ProgrammingLanguageFigure 5.1 Types of Programming Language计算机专业英语·60·instruction[in5strQkFEn ] n . 指令 symbolic[sim5bClik ] adj . 象征的,象征性的assembly language 汇编语言variable[5vAriEbl ] n . 变量higher-level language 高级语言 compiler[kEm5pailE ] n . 编译器abstract[5AbstrAkt ] adj . 抽象的 execution[7eksi5kju:FEn ] n . 执行source code 源代码utility[ju5tiliti ] n . 实用text editor 文本编辑器 notation[nEu5teiFEn ] n . 记号, 标记A programming language is a language used to write instructions for the computer. It lets the programmer express data processing in a symbolic manner without regard to machine-specific details.The difficulty of writing programs in the machine language of 0s and 1s led first to the development of assembly language , which allows programmers to use mnemonics for instructions and symbols for variables . Such programs are then translated by a program known as an assembler into the binary encoding used by the computer.Assembly language was found to be sufficiently inconvenient that higher-level languages (closer to natural languages) were invented in the 1950s for easier, faster programming; along with them came the need for compilers , programs that translate high-level language programs into machine code (See Figure 5.1).As programming languages became more powerful and abstract , building efficient compilers that create high-quality code in terms of execution speed and storage consumption became an interesting computer science problem in itself.A compiler is a computer program that translates source code into object code. Software engineers write source code using high-level programming languages that people can understand. Computers can’t directly execute source code, but need a compiler to translate these instructions into a low-level language called machine code.Software designers create new programs by using special applications programs, often called utility programs or development programs. A programmer uses another type of program called a text editor to write the new program in a special notation called a programming language. With the text editor, the programmer creates a text file, which is an ordered list of instructions, also called the program source file. The individual instructions that make up the program source file are called source code. At this point, a special applications program translates the source code into machine language, or object code —a format that the operating system will recognize as aUnit 5 Programming Language·61·set[set ] n . 集合separately[5sepEritli ] adv .分别地,单独地debugger[di:5bQ^E ] n . 调试器 detect[di5tekt ] v . 检测intermediate[7intE5mi:djEt ] adj .中间的interpreter[in5tE:pritE ] n . 解释器proper program and be able to execute.Programs are often written as a set of smaller pieces, with each piece representing some aspect of the overall application program. After each piece has been compiled separately , a program called a linker combines all of the translated pieces into a single executable program.Programs seldom work correctly the first time, so a program called a debugger is often used to help find problems called bugs. Debugging programs usually detect an event in the executing program and point the programmer back to the origin of the event in the program code.Recent programming systems, such as Java, use a combination of approaches to create and execute programs. A compiler takes a Java source program and translates it into an intermediate form. Such intermediate programs are then transferred over the Internet into computers where an interpreter program then executes the intermediate form as an application program.ExercisesI. March each of the following terms to its equivalent(s).II. Fill in the blanks with the information given in the text. 1.allows programmers to use mnemonics for instructions and symbols for .2.A compiler is a computer program that translates into .3. Software designers create new programs by using special applications programs, often called or .计算机专业英语·62·4. After each piece has been compiled separately, a program called a combines all of the translated pieces into a single program.5. Programs seldom work correctly the first time, so a program called a is often used to help find problems called bugs.III. Mark the following sentences with true or false according to the passage.1. The difficult of writing programs in the machine language of 0s and 1s led first to the development of high-level language.( ) 2. The machine language allows programmers to use mnemonics for instructions and symbols for variables. ( ) 3. Assembly language was invented in the 1950s for easier, faster programming, along with them came the need for compilers.( ) 4. Computers need a compiler to translate source code into a low-level language called machine code. A compiler is a computer program. ( ) 5. A programmer uses a text editor to write the new program in a special notation called aprogramming language.( )IV. Translate the following passage from English into Chinese.A computer program is a set of instructions that directs a computer to perform some processing function or combination of functions. For the instructions to be carried out, a computer must execute a program, that is, the computer reads the program, and then follows the steps encoded in the program in a precise order until completion. A program can be executed many different times, with each execution yielding a potentially different result depending upon the options and data that the user gives the computer.TASK III TEXT BBasics of Object-OrientedProgrammingFigure 5.2 Object-Oriented Programming (OOP)Unit 5 Programming Language·63·object-oriented 面向对象的inheritance[in5heritEns ] n . 继承package[5pAkidV ] n . 包state[steit ] n . 状态 behavior[bi5heivjE ] n . 行为 field [fi:ld ]n . 字段 method[5meWEd ] n . 方法instance[5instEns ] n .例子,实例definition[7defi5niFEn ] n . 定义gear[^iE ] n . 齿轮If you've never used an object-oriented programming language before, you'll need to learn a few basic concepts before you can begin writing any code. This lesson will introduce you to objects, class, inheritance, interface, and package (See Figure 5.2). Each discussion focuses on how these concepts relate to the real world.What Is an Object?An object is a software bundle of related state and behavior. Software objects are often used to model the real-world objects that you find in everyday life: your dog, your desk, your television set, your bicycle. They consist of state and related behavior. An object stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages).What Is a Class?In the real world, you'll often find many individual objects are of the same kind. There may be thousands of other bicycles in existence, all of the same make and model. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles. A class is the blueprint from which individual objects are created.Class's definition can be divided into interface and impleme- ntation. Interface describes class as an abstraction, what client needs to know. Implementation is the internals, only used by implementer.What Is Inheritance?Different kinds of objects often have a certain amount in common with each other.Object-oriented programming allows classes to inherit commonly used state and behavior from other classes.Mountain bikes, road bikes, and tandem bikes, for example, all share the characteristics of bicycles (current speed, current pedal cadence, and current gear). Yet each also defines additional features that make them different: tandem bicycles have two seats and two sets of handlebars; road bikes have drop handlebars; some mountain bikes have an additional chain ring, giving them a lower gear ratio.What Is an Interface?An interface is a contract between a class and the outside world.计算机专业英语·64·publish[5pQbliF ] vt .&vi . 出版,公布namespace[5neim speis ] n .命名空间logical[5lCdVikEl ] adj . 逻辑的encapsulate[en5kApsE7leit ] vt .封装Polymorphism [pCli5mC:fizEm ] n .多态性When a class implements an interface, it promises to provide the behavior published by that interface.In its most common form, an interface is a group of related methods with empty bodies. A bicycle's behavior, if specified as an interface, might appear as follows:interface Bicycle {void changeCadence(int newValue); // wheel revolutions per minutevoid changeGear(int newValue); void speedUp(int increment); void applyBrakes(int decrement); }What Is a Package?A package is a namespace for organizing classes and interfaces in a logical manner. Placing your code into packages makes large software projects easier to manage.The features of object-oriented programming include: (1)encapsulation (data hiding).(2)inheritance (derived classes inherit attributes and methods from base classes).(3)polymorphism (meaning of a message depends on class of recipient).ExercisesI. March each of the following terms to its equivalent(s).Unit 5 Programming Language·65·II. Fill in the blanks with the information given in the text.1. The basic concepts of object-oriented programming include , class, , interface, and .2. An object stores its state in (variables in some programming languages) and exposes its behavior through (functions in some programming languages).3. Object-oriented programming allows classes to commonly used state and behavior from other classes.4.In its most common form, an interface is a group of related methods with empty . 5. A package is a(an) for organizing classes and interfaces in a manner. III. Mark the following sentences with true or false according to the passage.1. Software objects are often used to model the real-world objects that you find in everyday life: your desk, your classmates, your bicycle.( ) 2. In object-oriented terms, we say that your bicycle is a class of the instance of objects known as bicycles. A class is the blueprint from which individual objects are created. ( ) 3. Object-oriented programming allows classes to inherit commonly used state and behavior from other classes.( ) 4. A package is a namespace for organizing classes and interfaces in a logical manner. Placing code into packages can’t make large software projects easier to manage. ( ) 5. The features of object-oriented programming include encapsulation, inheritance, andpolymorphism.( )IV. Translate the following passage from English into Chinese.The Java platform provides an enormous class library (a set of packages) suitable for use in your own applications. This library is known as the "Application Programming Interface", or "API" for short. Its packages represent the tasks most commonly associated with general-purpose programming. For example, a String object contains state and behavior for character strings; a file object allows a programmer to easily create, delete, inspect, compare, or modify a file on the file system; various GUI objects control buttons and checkboxes and anything else related to graphical user interfaces. There are literally thousands of classes to choose from. This allows you, the programmer, to focus on the design of your particular application, rather than the infrastructure required to make it work.TASK IV Writing TrainingNotice通知是上级对下级,组织对个人发出通知、下达指示、提出要求的一种应用文体;启事是个人对公众、组织对公众发布信息的一种文件,在英文表述上大体一样。