Kĩ thuật lập trình - Chapter 12: Imperative programming

Procedural abstraction allows the programmer to be concerned mainly with a function interface, ignoring the details of how it is computed. The process of stepwise refinement utilizes procedural abstraction to develop an algorithm starting with a general form and ending with an implementation. Ex: sort(list, len)

ppt9 trang | Chia sẻ: huyhoang44 | Lượt xem: 577 | Lượt tải: 0download
Bạn đang xem nội dung tài liệu Kĩ thuật lập trình - Chapter 12: Imperative programming, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
Programming Languages 2nd edition Tucker and NoonanChapter 12Imperative ProgrammingI really hate this darn machine; I wish they would sell it;It won’t do what I want it to, but only what I tell it. Programmer’s lament (anonymous)Contents12.1 What Makes a Language Imperative?12.2 Procedural Abstraction12.3 Expressions and Assignment12.4 Library Support for Data Structures12.5 C12.6 Ada12.7 PerlImperative ProgrammingOldest and most well-developed paradigmMirrors computer architectureLanguagesFortran, PascalC, CliteAda 8312.1 What Makes a Language Imperative?In a von Neumann machine memory holds:InstructionsDataIntellectual heart: assignment statementOthers:Conditional branchingUnconditional branch (goto)Flowchart 12.2 Procedural AbstractionProcedural abstraction allows the programmer to be concerned mainly with a function interface, ignoring the details of how it is computed.The process of stepwise refinement utilizes procedural abstraction to develop an algorithm starting with a general form and ending with an implementation.Ex: sort(list, len)12.3 Expressions and AssignmentAssignment statement is fundamental: target = expressionCopy semantics: Expression is evaluated to a value, which is copied to the target; used by imperative languagesReference semantics: Expression is evaluated to an object, whose pointer is copied to the target; used by object-oriented languages. There exist vast libraries of functions for most imperative languages.Partially accounts for the longevity of languages like Fortran, Cobol, and C.Turing CompleteInteger variables, values, operationsAssignmentIfGotoRe: Structured programming revolution of 1970s replace the goto with while loops.

Các file đính kèm theo tài liệu này:

  • pptch12a_0109.ppt
Tài liệu liên quan