tailieunhanh - Concepts, Techniques, and Models of Computer Programming - Chapter 2
Declarative Computation Model Lập trình bao gồm ba điều: • Đầu tiên, một mô hình tính toán, mà là một hệ thống chính thức định nghĩa một ngôn ngữ và câu của ngôn ngữ (ví dụ, biểu thức và báo cáo) được thực hiện bởi một máy tính trừu tượng như thế nào. Đối với cuốn sách này, chúng ta quan tâm trong các mô hình tính toán hữu ích và trực quan cho các lập trình. Điều này sẽ trở nên rõ ràng hơn khi chúng ta xác định một trong những đầu tiên sau trong chương. | Part II General Computation Models Copyright @ 2001-3 by P. Van Roy and S. Haridi. All rights reserved. Chapter 2 Declarative Computation Model Non sunt multiplicanda entia praeter necessitatem. Do not multiply entities beyond necessity. - Ockham s Razor William of Ockham 1285-1349 Programming encompasses three things First a computation model which is a formal system that defines a language and how sentences of the language . expressions and statements are executed by an abstract machine. For this book we are interested in computation models that are useful and intuitive for programmers. This will become clearer when we define the first one later in this chapter. Second a set of programming techniques and design principles used to write programs in the language of the computation model. We will sometimes call this a programming model. A programming model is always built on top of a computation model. Third a set of reasoning techniques to let you reason about programs to increase confidence that they behave correctly and to calculate their efficiency. The above definition of computation model is very general. Not all computation models defined in this way will be useful for programmers. What is a reasonable computation model Intuitively we will say that a reasonable model is one that can be used to solve many problems that has straightforward and practical reasoning techniques and that can be implemented efficiently. We will have more to say about this question later on. The first and simplest computation model we will study is declarative programming. For now we define this as evaluating functions over partial data structures. This is sometimes called stateless programming as opposed to stateful programming also called imperative programming which is explained in Chapter 6. The declarative model of this chapter is one of the most fundamental computation models. It encompasses the core ideas of the two main declarative Copyright 2001-3 by P. Van Roy and S. .
đang nạp các trang xem trước