Greenspun Tenth Rule

back to index

2 results

pages: 706 words: 120,784

The Joy of Clojure
by Michael Fogus and Chris Houser
Published 28 Nov 2010

Though they’re currently low-level constructs, they can be used to express full-blown design by contract facilities for your own applications. Clojure changes the way that you think. 13.3. A lack of design patterns Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. Greenspun’s Tenth Rule The book Design Patterns: Elements of Reusable Object-Oriented Software (Gamma et al 1995) was a seminal work of software design and development. You’d be hard pressed to find a software programmer in this day and age who’s not familiar with this work. The book describes 24 software best practices encountered throughout the course of experience in developing software projects of varying sizes.

But the use of factory functions to abstract the call to the constructors of types and records is idiomatic and in fact actively promoted. The reasons for a Clojure-style factory are to simplify the importing requirements of a type or record, and also to add additional project-specific functionality to the constructor (keyword arguments, default values, and so on). Interpreter The Interpreter pattern is in every way Greenspun’s Tenth Rule formalized. Many projects of sufficient size can be well served by the inclusion of a specialized grammar describing parts of the system itself. Clojure macros make the matter of creating specialized grammars a first-class member of the language. Builder The creation of complex structures from representation is central to Clojure programming, although it’s viewed differently from a similar object-oriented approach—the Builder pattern.

encapsulation, 5th block-level encapsulation local encapsulation namespace encapsulation Enlive enumeration values enumerator env ephemeral equality, 2nd, 6th, 7th equality partitions, 2nd, 3rd equality semantics error handling, 2nd, 3rd escaped evaluation contextual-eval, 2nd eval, 2nd meta-circular exceptions, 5th, 9th, 10th, 20th exceptions exceptions exceptions exceptions catch, 2nd checked compile-time, 2nd ConcurrentModification-Exception finally, 2nd handling java.lang.ClassCastException java.lang.Exception java.lang.NullPointer-Exception java.lang.RuntimeException runtime runtime vs. compile-time throw, 2nd, 3rd expand-clause expansion expected case experimentation expression problem extend, 2nd, 3rd, 4th extend-protocol, 2nd extend-type, 2nd Extensible Markup Language (XML), 2nd, 3rd F Factor (programming language), 2nd factory methods fail, 2nd false, 3rd evil-false Fantom (programming language) fence post errors filter, 2nd, 3rd, 4th, 5th find-doc find-ns finite state machines first, 2nd, 3rd, 4th, 5th First In, First Out (FIFO), 2nd First In, Last Out (FILO) first-class, 2nd, 3rd fixed-size pool FIXO, 3rd, 5th fixo-peek fixo-push, 2nd, 3rd flexibility float, 2nd floating point, 2nd, 5th overflow rounding error underflow, 2nd floats fluent builder FluentMove fn, 2nd, 3rd, 4th, 5th, 6th for, 2nd force, 2nd, 3rd forever form free variables freedom to focus frequencies Frink (programming language), 2nd frustrating fully qualified, 2nd, 3rd fun functions, 6th anonymous, 2nd, 3rd, 4th arity Calling Functions dangerous function signatures local multiple function bodies named arguments G Gang of Four garbage collection, 2nd, 3rd gcd gen-class, 2nd, 3rd, 4th, 5th, 6th generalized tail-call optimization, 2nd generic genotype gensym get, 2nd, 3rd, 4th get-in getter global hierarchy map goal Gödel, Escher, Bach: An Eternal Golden Braid good-move Graham, Paul, 2nd graphic graphical user interface (GUI), 2nd, 3rd, 4th graphics context greatest common denominator, 2nd green thread Greenspun’s Tenth Rule, 2nd Groovy (programming language) H Halloway, Stuart, 2nd has hash maps hash-map, 2nd, 3rd, 4th Haskell (programming language), 2nd, 3rd, 4th, 5th, 7th, 9th, 11th, 13th out of order execution Template Haskell typeclasses, 2nd heuristic Hickey, Rich, 2nd hidden hierarchy history homoiconicity, 2nd hooks, 2nd hops host semantics Hoyte, Doug hyphens I I/O, 2nd, 3rd idempotent, 2nd identical?

pages: 309 words: 65,118

Ruby by example: concepts and code
by Kevin C. Baird
Published 1 Jun 2007

It is technically a complete, generalpurpose programming language, although it has several features that make it 4 Critics contend that this feature makes Lisp a more appropriate acronym for Lots of Irritating Superfluous Parentheses. Larry Wall, the creator of Perl, suggested that Lisp code has all the aesthetic appeal of “oatmeal with toenail clippings.” Clearly, Lisp has some public relations problems. 5 Relatedly, Philip Greenspun’s tenth Rule of Programming at http://philip.greenspun.com/ research is “Any sufficiently complicated C or Fortran program contains an ad-hoc, informallyspecified bug-ridden slow implementation of half of Common Lisp.” 6 264 A pp en dix This quote also comes from Paul Graham’s website, http://www.paulgraham.com/quotes.html.

G gem command, 224–225 225 gem list --local, 225 gem outdated, 226 gem query --remote, 225 gem update rails, 226–227 help, 227 gems, 224 installing, 225–226 listing installed and installable, 225 updating, 226–227 gem install --remote, I N D EX 271 method (Tester), 139 method (Integer), 200 get_child method (Hash), 179 get_children method (Meta_Mutator), 180 get_elements_from_filename method, 152 get_format method, 57 get_items_hash method (Simple_CGI), 209 get_lines method, 57 get_no_better_count method (Meta_Mutator), 180 GetOptLong, 39 get_output method, 58 get_proc_via_base_unit method (Temperature_Converter), 136 general_tester method (CurrencyConverter), 95 get_rates method (CurrencyConverter), 94 get_value method (CurrencyConverter), 89 get_xml_lines method (CurrencyConverter), 94 global substitution, 53 Graham, Paul, 206, 263 Greenspun, Philip, 264n grep method (Enumerable), 65, 79 gsub method (String), 54–55 gsub! method (String), 53 H I h method (Rails), 247 Hansson, David Heinemeier, Agile Web Development with Rails, 227 hard drives, Windows filesystem access to, 20 Hash class, 150 get_child method, 179 keys method, 44 merge method, 151 pretty_report method, 152 subtraction method, 93 hash (#), for comments, 14 Hash keys, Symbols as, 78 -i get_rate_for_abbr_from_raw_rate_lines 272 I ND EX Hashes, 42–43 84 default values, 152 for HTML tag replacement, 144 nesting, 135 Procs as values, 200 SUBTRACTIVE_TO_ROMAN, 84 Haskell, 262 have_to_base_proc method (Temperature_Converter), 136 Helpers in Rails, 243, 245–251 and modularizing code, 244 here doc, 43 Him class, 113 creating Procs with lambda, 115 HOME directory, 11 HTML (HyperText Markup Language), 141 cleaning up, 141–148 counting tags, 148–154 footer for page, 243 nesting tags, 209 non-compliant, 142 printing output within, 214 <html> tag, variable for, 208 HTML Tidy, 142 html_tidy.rb script, 141–148 HyperText Markup Language.