• Complain

Chris Hanson - Software Design for Flexibility: How to Avoid Programming Yourself into a Corner

Here you can read online Chris Hanson - Software Design for Flexibility: How to Avoid Programming Yourself into a Corner full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. City: Cambridge, MA, year: 2021, publisher: The MIT Press, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    Software Design for Flexibility: How to Avoid Programming Yourself into a Corner
  • Author:
  • Publisher:
    The MIT Press
  • Genre:
  • Year:
    2021
  • City:
    Cambridge, MA
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Software Design for Flexibility: How to Avoid Programming Yourself into a Corner: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Software Design for Flexibility: How to Avoid Programming Yourself into a Corner" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Strategies for building large systems that can be easily adapted for new situations with only minor programming modifications.Time pressures encourage programmers to write code that works well for a narrow purpose, with no room to grow. But the best systems are evolvable; they can be adapted for new situations by adding code, rather than changing the existing code. The authors describe techniques they have found effective--over their combined 100-plus years of programming experience--that will help programmers avoid programming themselves into corners.The authors explore ways to enhance flexibility by: Organizing systems using combinators to compose mix-and-match parts, ranging from small functions to whole arithmetics, with standardized interfaces Augmenting data with independent annotation layers, such as units of measurement or provenance Combining independent pieces of partial information using unification or propagation Separating control structure from problem domain with domain models, rule systems and pattern matching, propagation, and dependency-directed backtracking Extending the programming language, using dynamically extensible evaluators

Chris Hanson: author's other books


Who wrote Software Design for Flexibility: How to Avoid Programming Yourself into a Corner? Find out the surname, the name of the author of the book and a list of all author's works by series.

Software Design for Flexibility: How to Avoid Programming Yourself into a Corner — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Software Design for Flexibility: How to Avoid Programming Yourself into a Corner" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
2021 Massachusetts Institute of Technology This work is subject to a Creative - photo 1

2021 Massachusetts Institute of Technology

This work is subject to a
Creative Commons Attribution-ShareAlike 4.0 International License.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-sa/4.0/.

Subject to such license all rights are reserved This book was set in Computer - photo 2

Subject to such license, all rights are reserved.

This book was set in Computer Modern by the authors with the Picture 3 typesetting system.

Library of Congress Cataloging-in-Publication Data

Names: Hanson, Chris (Christopher P.), author. | Sussman, Gerald Jay, author.

Title: Software design for flexibility : how to avoid programming yourself into a corner / Chris Hanson and Gerald Jay Sussman ; foreword by Guy L. Steele Jr.

Description: Cambridge, Massachusetts : The MIT Press, [2021] | Includes bibliographical references and index.

Identifiers: LCCN 2020040688 | ISBN 9780262045490 (hardcover)

Subjects: LCSH: Software architecture. | Software patterns.

Classification: LCC QA76.76.D47 H35 2021 | DDC 005.1/112dc23

LC record available at https://lccn.loc.gov/2020040688

10987654321

d_r0

A computer is like a violin. You can imagine a novice trying first a phonograph and then a violin. The latter, he says, sounds terrible. That is the argument we have heard from our humanists and most of our computer scientists. Computer programs are good, they say, for particular purposes, but they aren't flexible. Neither is a violin, or a typewriter, until you learn how to use it.

Marvin Minsky, Why Programming Is a Good Medium for Expressing Poorly-Understood and Sloppily-Formulated Ideas in Design and Planning, (1967)

Contents
List of figures
  1. Chapter 1
  2. Chapter 2
  3. Chapter 3
  4. Chapter 7
Guide
Foreword

Sometimes when you're writing a program, you get stuck. Maybe it's because you realize you didn't appreciate some aspect of the problem, but all too often it's because you made some decision early in the program design process, about a choice of data structure or a way of organizing the code, that has turned out to be too limiting, and also to be difficult to undo.

This book is a master class in specific program organization strategies that maintain flexibility. We all know by now that while it is very easy to declare an array of fixed size to hold data to be processed, such a design decision can turn out to be an unpleasant limitation that may make it impossible to handle input lines longer than a certain length, or to handle more than a fixed number of records. Many security bugs, especially in the code for the Internet, have been consequences of allocating a fixed-size memory buffer and then failing to check whether the data to be processed would fit in the buffer. Dynamically allocated storage (whether provided by a C-style malloc library or by an automatic garbage collector), while more complicated, is much more flexible and, as an extra benefit, less error-prone (especially when the programming language always checks array references to make sure the index is within bounds). That's just a very simple example.

A number of early programming language designs in effect made a design commitment to reflect the style of hardware organization called the Harvard architecture: the code is here, the data is there, and the job of the code is to massage the data. But an inflexible, arm's-length separation between code and data turns out to be a significant limitation on program organization. Well before the end of the twentieth century, we learned from functional programming languages (such as ML, Scheme, and Haskell) and from object-oriented programming languages (such as Simula, Smalltalk, C++, and Java) that there are advantages to being able to treat code as data, to treat data as code, and to bundle smallish amounts of code and related data together rather than organizing code and data separately as monolithic chunks. The most flexible kind of data is a record structure that can contain not only primitive data items such as numbers and characters but also references to executable code, such as a function. The most powerful kind of code constructs other code that has been bundled with just the right amount of curated data; such a bundle is not just a function pointer but a closure (in a functional language) or an object (in an object-oriented language).

Jerry Sussman and Chris Hanson draw on their collective century of programming experience to present a set of techniques, developed and tested during decades of teaching at MIT, that further extend this basic strategy for flexibility. Don't just use functions; use generic functions, which are open-ended in a way that plain functions are not. Keep functions small. Often the best thing for a function to return is another function (that has been customized with curated data). Be prepared to treat data as code, perhaps even to the extreme of creating a new embedded programming language within your application if necessary. (That is one view of how the Scheme language got its start: the MacLisp dialect of Lisp did not support a completely general form of function closure, so Jerry and I simply used MacLisp to code an embedded dialect of Lisp that did support the kind of function closure we needed.) Be prepared to replace a data structure with a more general data structure that subsumes the original and extends its capabilities. Use automatic constraint propagation to avoid a premature commitment to which data items are inputs and which are outputs.

This book is not a survey, or a tutorialas I said before, it is a master class. In each chapter, watch as two experts demonstrate an advanced technique by incrementally developing a chunk of working code, explaining the strategy as they go, occasionally pausing to point out a pitfall or to remove a limitation. Then be prepared, when called on, to demonstrate the technique yourself, by extending a data structure or writing additional codeand then to use your imagination and creativity to go beyond what they have demonstrated. The ideas in this book are rich and deep; close attention to both the prose and the code will be rewarded.

Guy L. Steele Jr.

Lexington, Massachusetts

August 2020

Preface

We have all spent too much time trying to deform an old piece of code so that it could be used in a way that we didn't realize would be needed when we wrote it. This is a terrible waste of time and effort. Unfortunately, there are many pressures on us to write code that works very well for a very specific purpose, with few reusable parts. But we think that this is not necessary.

It is hard to build systems that have acceptable behavior over a larger class of situations than was anticipated by their designers. The best systems are evolvable: they can be adapted to new situations with only minor modification. How can we design systems that are flexible in this way?

It would be nice if all we had to do to add a new feature to a program was to add some code, without changing the existing code base. We can often do this by using certain organizing principles in the construction of the code base and incorporating appropriate hooks at that time.

Observations of biological systems tell us a great deal about how to make flexible and evolvable systems. Techniques originally developed in support of symbolic artificial intelligence can be viewed as ways of enhancing flexibility and adaptability in programs and other engineered systems. By contrast, common practice of computer science actively discourages the construction of systems that are easily modified for use in novel settings.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Software Design for Flexibility: How to Avoid Programming Yourself into a Corner»

Look at similar books to Software Design for Flexibility: How to Avoid Programming Yourself into a Corner. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Software Design for Flexibility: How to Avoid Programming Yourself into a Corner»

Discussion, reviews of the book Software Design for Flexibility: How to Avoid Programming Yourself into a Corner and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.