tailieunhanh - Ebook Programming languages and techniques: Part 2

(BQ) Part 2 book "Programming languages and techniques" has contents: Transition to Java, overriding and equality, generics, collections, and iteration, encapsulation and queues, swing - interaction and paint demo, exceptions,. and other contents. | Chapter 18 Wrapping up OCaml: Designing a GUI Library Taking Stock Thus far, we have studied program design “in the small”, where the programs we have written are at most a couple of functions, and their use is relatively straightforward. We have studied a general design strategy for developing software, which starts with understanding the problem and then uses types and tests to further refine that understanding before we actually develop code. Throughout our studies, we have used OCaml’s features to explore different ways of structuring data. First we used pure representations like lists and trees, where the primary way of processing the data is via recursive functions. Then we looked at imperative data structures, such as the queues of the last chapter, where the primary modes of operation are iteration and imperative update. Along the way, we saw many other kinds of structured data: tuples, options, records, functions, etc, which give us tools for thinking about how to decompose the data of a problem into an appropriate form for computing with it. We have also encountered several styles of abstraction—hiding of detail—that can help when structuring larger programs, including generic types and functions, the idea of an abstract type implemented in a module, and the use of hidden (or encapsulated) state of an object. In subsequent chapters, we will explore these concepts again, this time from the point of view of Java programming, where we will see that all of the same ideas apply. Here, however, we investigate how to put together all of the tools we developed in OCaml to produce a useful tool, namely a (rudimentary) paint program. Implementing such a paint program isn’t that difficult, given the appropriate library for graphical user interface (GUI) design. We make this design process more interesting by developing the GUI library too—that is, we start from OCaml’s naCIS 120 Lecture Notes Draft of November 10, 2017 Wrapping up OCaml: Designing a GUI

TỪ KHÓA LIÊN QUAN