<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-6918427997759942244</atom:id><lastBuildDate>Wed, 16 May 2012 23:55:18 +0000</lastBuildDate><category>Order Theory</category><category>Domain Driven Design</category><category>Computer Science</category><category>Linguistics</category><category>Software Engineering</category><category>Linear Algebra</category><category>Group Theory</category><category>Category Theory</category><category>Generic Programming</category><category>API Design</category><category>Software Development</category><category>Logic</category><category>Math</category><category>Software Process</category><category>Number Theory</category><category>Software Frameworks</category><category>Java</category><category>Abstract Algebra</category><category>Probability Theory</category><category>Editing</category><category>Big O</category><category>Programming</category><category>Bayes</category><category>Software Development Teams</category><category>Set Theory</category><category>Information Entropy</category><category>Scala</category><category>Graph Theory</category><category>Naming</category><category>Morphology</category><category>Topology</category><category>Agile</category><category>Software Complexity</category><category>Rant</category><category>Fractal Geometry</category><category>Neuroscience</category><category>Relational Algebra</category><category>Complex numbers</category><category>Pair Programming</category><category>Combinatorics</category><category>Education</category><category>Design Patterns</category><category>Code Reuse</category><category>Fibonacci</category><category>Formal Language Theory</category><title>Elegant Coding</title><description /><link>http://www.elegantcoding.com/</link><managingEditor>noreply@blogger.com (Geoff Moes)</managingEditor><generator>Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ElegantCoding" /><feedburner:info uri="elegantcoding" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-3572137304010579924</guid><pubDate>Sun, 13 May 2012 19:24:00 +0000</pubDate><atom:updated>2012-05-13T15:46:23.720-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Morphology</category><category domain="http://www.blogger.com/atom/ns#">Naming</category><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><category domain="http://www.blogger.com/atom/ns#">Software Frameworks</category><category domain="http://www.blogger.com/atom/ns#">Linguistics</category><title>Software System Morphology</title><description>&lt;!--Software System Morphology--&gt;&lt;h2&gt;On the Importance of Naming in Software Systems, part III&lt;/h2&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-OU0wTOfHWQE/T7AEkPlqPXI/AAAAAAAAAhA/dY-ANZrluxo/s1600/europa_galileo.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="267" width="400" src="http://1.bp.blogspot.com/-OU0wTOfHWQE/T7AEkPlqPXI/AAAAAAAAAhA/dY-ANZrluxo/s400/europa_galileo.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;In my previous posts on naming "&lt;a href="http://www.elegantcoding.com/2012/03/survey-of-conventional-wisdom-on.html"&gt;A Survey of the Conventional Wisdom on Software Naming&lt;/a&gt;" and "&lt;a href="http://www.elegantcoding.com/2012/03/more-thoughts-on-formal-approaches-to.html"&gt;More Thoughts on Formal Approaches to Naming in Software&lt;/a&gt;" I discussed several ideas about defining a way to talk about software system naming, I feel the name "Software System Morphology" captures this "big picture" concept. My objective is to develop a comprehensive way to define and analyze the &lt;a href="http://en.wikipedia.org/wiki/Semantics"&gt;semantic&lt;/a&gt; nature (&lt;a href="http://en.wikipedia.org/wiki/Morphology_(linguistics)"&gt;morphology&lt;/a&gt;) of the construction of a software system. It’s an ambitious undertaking and whether or not I succeed in this endeavor I am hoping that these ideas will contribute to a better solution to this problem.&lt;/p&gt;&lt;p&gt;To review, I am defining three attributes that a name of signifier can have, the &lt;b&gt;&lt;i&gt;name scope context&lt;/i&gt;&lt;/b&gt;, i.e. where the name is used or occurs, the type or class of the &lt;b&gt;&lt;i&gt;system referent&lt;/i&gt;&lt;/b&gt; signified by the name, and the lexical structure of the name i.e. the &lt;a href="http://en.wikipedia.org/wiki/N-gram"&gt;n-gram&lt;/a&gt; of &lt;b&gt;&lt;i&gt;name units&lt;/i&gt;&lt;/b&gt;.  I feel that these three qualities can be used to determine and possibly measure aspects of the morphological structure of software and by determining the morphological structure of a software system that structure might be &amp;quot;comprehended&amp;quot; and refined which could yield higher quality software.  &lt;/p&gt;&lt;p&gt;In Linguistics a &lt;a href="http://en.wikipedia.org/wiki/Morpheme"&gt;morpheme&lt;/a&gt; is the smallest unit of meaning and it is considered, by some, to be a complete sub-discipline of the study of Linguistics. I admit that I am in the process of learning more about it, I am a few chapters into &lt;u&gt;What is Morphology&lt;/u&gt; by Mark Aronoff and Kirsten Fudeman it is an excellent book for linguistic neophytes like me.  &lt;b&gt;&lt;i&gt;Software System Morphology&lt;/i&gt;&lt;/b&gt; will both be divergent and dependent on &lt;a href="http://en.wikipedia.org/wiki/Natural_language"&gt;natural language&lt;/a&gt; morphological concepts, which are quite complex.  However a general understanding of linguistic morphology will make these ideas more accessible, I suggest looking into it on your own, it’s fascinating and worth it solely on its own merits.  A quick example of English Morphology can be given with the morphologically complex word autobiography which consists of the morphemes: auto/bio/graph/y, where [auto] means "self", [bio] means "life", [graph] means "drawn" and [y] means "characterized by". &lt;/p&gt;&lt;p&gt;In my first post of this series I explored various ideas proposed by a few prominent software engineers, one idea that I discussed was the use of what were denoted as qualifiers which included the scope qualifier, the type qualifier and the computed-value qualifier. These qualifiers which are prefixed or suffixed to names can be thought of more generally as morphemes. So we can now incorporate those ideas into a more general way of looking at meaning in software naming. Now the natural conclusion, if you have been paying attention, may be to assume that the name unit concept will map to the morpheme concept, it does not, at least in terms of only software morphology and this is in interesting distinction, software morphemes may consist of n-grams of name units which can be natural language morphemes two examples are CommandPattern and MedicalRecord where separating these into individual name units potentially become meaningless in certain software contexts.&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;i&gt;Software System Morphology&lt;/i&gt;&lt;/b&gt; is primarily influenced by three things, the semantic nature of the &lt;b&gt;&lt;i&gt;problem domain&lt;/i&gt;&lt;/b&gt;(s), the semantic nature of the &lt;b&gt;&lt;i&gt;solution domain&lt;/i&gt;&lt;/b&gt;(s), which include languages ORMs, paradigms, design patterns, data structures, and finally the natural language(s) in which both the &lt;b&gt;&lt;i&gt;problem domain&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;solution domains&lt;/i&gt;&lt;/b&gt; are expressed. The previous example items CommandPattern and MedicalRecord illustrate these ideas as well.  &lt;/p&gt;&lt;p&gt;Ok now let’s take our concepts further with a more detailed example.  Assume we have a Hospital Medical system which has the following &lt;b&gt;&lt;i&gt;problem domain&lt;/i&gt;&lt;/b&gt; concepts: [Medical Record, Patient, Visit, Doctor, Hospital, Address, Invoice]. Obviously there are more. For the &lt;b&gt;&lt;i&gt;solution domain&lt;/i&gt;&lt;/b&gt; we will assume a JEE/Spring style implementation which might include the following concepts: [Entity, Dao, ServiceLayer, Controller, Map, View].  Now some expected names (signifiers) might be: MedicalRecordEntity, PatientEntity, PatientServiceLayer, PatientDao, PatientController, PatientView, VisitEntity, VisitDao, VisitServiceLayer, VisitController, VisitView, PatientVisitMap, PatientHospitalVisitor,... Now as you can see the names are composed of morphemes from both the &lt;b&gt;&lt;i&gt;problem domain&lt;/i&gt;&lt;/b&gt; and the &lt;b&gt;&lt;i&gt;solution domain&lt;/i&gt;&lt;/b&gt;.  This is to be expected as each name tells what it is/does in the &lt;b&gt;&lt;i&gt;problem domain&lt;/i&gt;&lt;/b&gt; and what it is/does in the &lt;b&gt;&lt;i&gt;solution domain&lt;/i&gt;&lt;/b&gt;. In fact any developer with knowledge of JEE Spring Web application developer can look at these names and know what to expect and where they fit in the system.  Additionally it is easy to look at the above set of domain concepts and anticipate &lt;b&gt;&lt;i&gt;named system referents&lt;/i&gt;&lt;/b&gt; that I omitted.&lt;/p&gt;&lt;p&gt;Previously I pointed out that the idea referred to as a qualifier is really a morpheme and while this is true the term qualifier seems to denote a more contextual setting in terms of the domain concepts.  In the above examples the &lt;b&gt;&lt;i&gt;solution domain&lt;/i&gt;&lt;/b&gt; morphemes act as qualifiers telling where and how each &lt;b&gt;&lt;i&gt;named system referent&lt;/i&gt;&lt;/b&gt; fits into the solution Entity tells that it is a domain object, Dao tells that it relates to persistence, ServiceLayer tells that one would expect to see a &lt;a href="http://en.wikipedia.org/wiki/Separation_of_concerns"&gt;separation of concerns&lt;/a&gt; that would put the &lt;a href="http://en.wikipedia.org/wiki/Business_Logic"&gt;business logic&lt;/a&gt; here. Structurally one would expect the domain objects (with the Entity suffix) to be passed back from the Dao’s and ServiceLayer’s and there might be transformative manipulation or aggregation of the domain objects in the ServiceLayer.  The idea of qualification is meaning based but in this case it also indicates structural aspects of the &lt;b&gt;&lt;i&gt;solution domain&lt;/i&gt;&lt;/b&gt;. In this example I intentionally use the Entity suffix, in many systems the domain concepts would be used alone i.e. [Patient, Visit], I have mixed feelings about this in one sense it can be viewed as potentially unnecessary, in another sense it represents a qualifier that can possibly improve comprehension. Qualifiers do make names longer and while I tend to favor longer names it can become problematic if they get too long.  These ideas towards naming are powerful for building comprehensible maintainable code as you can see from the above name examples that they follow a consistent pattern, admittedly these are fairly easy naming tasks, but you would be surprised how many developers fail to even do these types of things consistently. &lt;/p&gt;&lt;p&gt;Unlike &lt;a href="http://www.elegantcoding.com/2012/03/survey-of-conventional-wisdom-on.html"&gt;others&lt;/a&gt; who advocate specific practices in regards to naming I feel that naming should be dealt with in a flexible framework that can be adapted to a specific project’s needs.  While I personally agree and disagree with ideas previously discussed, my philosophy is that naming should be done consistently and comprehensively reflecting deliberate choices using conceptual understanding and analysis of the Domains. Also it should be tracked in a Lexicon, an idea that I am working on and hope to explore in a later post.  Also as I have said before I feel that tooling could be used to allow better conceptual understanding and navigation and the use of analytics and possibly visualization could be used to ease naming decisions in practice by providing improvements to both &lt;a href="http://en.wikipedia.org/wiki/Static_program_analysis"&gt;static analysis&lt;/a&gt; and interactive &lt;a href="http://en.wikipedia.org/wiki/Autocompletion"&gt;autosuggest&lt;/a&gt;/&lt;a href="http://en.wikipedia.org/wiki/IntelliSense"&gt;intellisense&lt;/a&gt; aids.&lt;/p&gt;&lt;p&gt;I feel that these ideas are an attempt to create a more "formalized" approach to what Eric Evan’s does in &lt;u&gt;Domain Driven Design&lt;/u&gt; which also covers a number of other structural ideas, I hope to extend my ideas here to better integrate some of those as well.  The next steps for me are to undertake an analytic approach I also hope to explore the application of ideas like &lt;a href="http://en.wikipedia.org/wiki/Formal_concept_analysis"&gt;formal concept analysis&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Spectral_graph_theory"&gt;spectral graph theory&lt;/a&gt; techniques which may add some mathematical rigor to these ideas and perhaps allow some empirical validation and probably refinement. Now it gets really hard so it might be a while for those follow-ups.&lt;/p&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-3572137304010579924?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/Pnbh96zAS-0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/Pnbh96zAS-0/software-system-morphology.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-OU0wTOfHWQE/T7AEkPlqPXI/AAAAAAAAAhA/dY-ANZrluxo/s72-c/europa_galileo.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/05/software-system-morphology.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-4856506076120221020</guid><pubDate>Sun, 29 Apr 2012 21:12:00 +0000</pubDate><atom:updated>2012-05-06T12:38:03.023-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Scala</category><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Design Patterns</category><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><category domain="http://www.blogger.com/atom/ns#">Code Reuse</category><category domain="http://www.blogger.com/atom/ns#">Software Frameworks</category><category domain="http://www.blogger.com/atom/ns#">Generic Programming</category><category domain="http://www.blogger.com/atom/ns#">Computer Science</category><title>What is Generic Programming?</title><description>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-o3_JQhsIZYg/T52KCmSVf1I/AAAAAAAAAgw/mz-7UulHJMI/s1600/paris.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="300" src="http://3.bp.blogspot.com/-o3_JQhsIZYg/T52KCmSVf1I/AAAAAAAAAgw/mz-7UulHJMI/s400/paris.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}
&lt;/style&gt;&lt;!--What is Generic Programming?--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Over the course of my career I have strived to write reusable code, always looking for more general patterns and trying to refactor code to more flexible more generic versions sometimes with mixed success.  Lately it has become something of an obsession of mine in that I both try to employ it and have been endeavoring to learn more about it, what it really is, and how to do it right, as I have previously pondered I believe there is a &lt;a href="http://www.elegantcoding.com/2012/02/software-reuse-complexity-curve.html"&gt;complexity cost to increased reuse&lt;/a&gt;.  Over the last few years, which I have been programming in Java, generics has become a central tool in achieving reuse.  So such a concept comes to mind but it is just one idea in a larger framework of ideas on &lt;a href="http://en.wikipedia.org/wiki/Generic_programming"&gt;generic programming&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;There is a fair amount of research and discussion of the ideas pertaining to generic programming, the title of this post is taken directly from a &lt;a href="http://lcsd05.cs.tamu.edu/papers/dos_reis_et_al.pdf"&gt;paper on the topic&lt;/a&gt;, which perhaps not so coincidently was presented at the same OOPSLA (2005) as the paper on &lt;a href="http://lcsd05.cs.tamu.edu/papers/veldhuizen.pdf"&gt;Software Reuse and Entropy&lt;/a&gt; that &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html"&gt;I previously discussed&lt;/a&gt;.  It just seems like every idea I explore is super-interrelated to everything else and this post will be no exception I can conceptually connect these two papers using a Kevin Bacon like approach using just two other research papers, ideas I have for other posts.  I will try to keep this one as focused as possible.  Also the referenced &lt;a href="http://lcsd05.cs.tamu.edu/papers/dos_reis_et_al.pdf"&gt;paper&lt;/a&gt; is, like the Software Framework paper, very math heavy but different math, &lt;a href="http://en.wikipedia.org/wiki/Category_theory"&gt;Category Theory,&lt;a href="http://en.wikipedia.org/wiki/Order_theory"&gt;Order Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Universal_algebra"&gt;Universal Algebra&lt;/a&gt;, etc. This post will focus on a more high level concepts and not the details of math that I wish I could claim that I fully understand.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;So back to our question, what is generic programming?   For me it is about reuse, and while the information entropy approach to understanding reuse was about reuse from perspective of measure and the reuse (measurable) variation on different domains, I feel that the generic programming concept is about the structure of reuse and how it is implemented in various programming paradigms but the concept itself transcends language specific interpretations and implementations.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;As you can tell I am not sure how to exactly answer this question so I will defer to the experts.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;"&lt;a href="http://lcsd05.cs.tamu.edu/papers/dos_reis_et_al.pdf"&gt;What is generic programming?&lt;/a&gt;" in part outlines the paradigmatic distinctions between mainstream OO languages (Java Generics, C++ with STL) and Functional languages (Haskel, Scheme):&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;As for most programming paradigms, there are several definitions of generic programming in use. In the simplest view generic programming is equated to a set of language mechanisms for implementing type-safe polymorphic containers, such as List&amp;lt;T&amp;gt; in Java. The notion of generic programming that motivated the design of the Standard Template Library (STL) advocates a broader definition: a programming paradigm for designing and developing reusable and efficient collections of algorithms. The functional programming community uses the term as a synonym for polytypic and type-indexed programming, which involves designing functions that operate on data-types having certain algebraic structures.&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;In "&lt;a href="http://www.stepanovpapers.com/genprog.pdf"&gt;Generic Programming&lt;/a&gt;" written in 1988 by David A. Musser and &lt;a href="http://www.stepanovpapers.com/"&gt;Alexander A. Stepanov&lt;/a&gt; use Ada and Scheme and describe generic programming as:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;By generic programming, the definition of algorithms and data structures at an abstract or generic level, thereby accomplishing many related programming tasks simultaneously.  The central notion is that of generic algorithms, which are parameterized procedural schemata that are completely independent of the underlying data representation and are derived from concrete efficient algorithms.&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;p&gt;A discipline that consists of the gradual lifting of concrete algorithms abstracting over details, while retaining the algorithm semantics and efficiency.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;That last sentence has a very Agile/Refactoring feel to it.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Ralf Hinze in "&lt;a href="www.cs.ox.ac.uk/ralf.hinze/publications/habilitation.pdf"&gt;Generic Programs and Proofs&lt;/a&gt;" describes it as: &lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;A generic program is one that the programmer writes once, but which works over many different data types.&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;p&gt;Broadly speaking, generic programming aims at relieving the programmer from repeatedly writing functions of similar functionality for different user-defined data types. A generic function such as a pretty printer or a parser is written once and for all times; its specialization to different instances of data types happens without further effort from the user. This way generic programming greatly simplifies the construction and maintenance of software systems as it automatically adapts functions to changes in the representation of data.&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;p&gt;So, at first sight, generic programming appears to add an extra level of complication and abstraction to programming. However, I claim that generic programming is in many cases actually simpler than conventional programming.  The fundamental reason is that genericity gives you "a lot of things for free" ...&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;This last statement resonates with me as it parallels my thoughts on the desirability of using &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html"&gt;software frameworks&lt;/a&gt; and I feel that I continuously have this conversation (argument) with junior level programmers and also senior level &lt;a href="http://www.elegantcoding.com/2011/10/confederacy-of-cargo-cult-coders.html"&gt;cargo cult coders&lt;/a&gt; who don’t get it.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Design Patterns are a common generic concept in mainstream programming.  It turns out that a number of design patterns can be described in the framework laid out by these papers and a number of papers do exactly that including "&lt;a href="http://www.cs.ox.ac.uk/jeremy.gibbons/publications/hodgp.pdf"&gt;Design Patterns as Higher-Order Datatype-Generic Programs &lt;/a&gt;" part of extensive research on the topic by Jeremy Gibbons:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Design patterns, as the subtitle of the seminal book has it, are ‘elements of reusable object-oriented software’. However, within the confines of existing mainstream programming languages, these supposedly reusable elements can only be expressed extra-linguistically: as prose, pictures, and prototypes. We believe that this is not inherent in the patterns themselves, but  evidence of a lack of expressivity in the languages of today. We expect that, in the languages of the future, the code parts of design patterns will be expressible as directly-reusable library components. The benefits will be considerable: patterns may then be reasoned about, typechecked, applied and reused, just as any other abstractions can. Indeed, we claim that the languages of tomorrow will suffice; the future is not far away. All that is needed, in addition to what is provided by essentially every programming language, are higher-order (parametrization by code) and datatype-generic (parametrization by type constructor) features. Higher-order constructs have been available for decades in functional programming languages such as &lt;a href="http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&amp;amp;tid=3874"&gt;ML&lt;/a&gt; and &lt;a href="www.haskell.org/definition/haskell98-report.pdf"&gt;Haskell&lt;/a&gt;. Datatype genericity can be simulated in &lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.19.7113"&gt;existing programming languages&lt;/a&gt; &lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.71.463"&gt;[2]&lt;/a&gt;, but we already have significant experience with robust prototypes of languages that support &lt;a href="http://igitur-archive.library.uu.nl/math/2007-0404-200301/jeuring_03_generichaskellpractice_technical.pdf"&gt;it natively&lt;/a&gt; &lt;a href="http://www.andres-loeh.de/ExploringGH.pdf"&gt;[2]&lt;/a&gt;. We argue our case by capturing as higher-order datatypegeneric programs a small subset &lt;a href="http://www.cs.ox.ac.uk/jeremy.gibbons/publications/origami.pdf"&gt;ORIGAMI&lt;/a&gt; of the &lt;a href="citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.71.463"&gt;Gang of Four (GOF) patterns&lt;/a&gt;. (For the sake of rhetorical style, we equate ‘GOF patterns’ with ‘design patterns’.) These programs are parametrized along three dimensions: by the shape of the computation, which is determined by the shape of the underlying data, and represented by a type constructor (an operation on types); by the element type (a type); and by the body of the computation, which is a higher-order argument (a value, typically a function).  Although our presentation is in a functional programming style, we do not intend to argue that functional programming is the paradigm of the future (whatever we might feel personally!).  Rather, we believe that functional programming languages are a suitable test-bed for experimental language features - as evidenced by parametric polymorphism and list comprehensions, for example, which are both now finding their way into mainstream programming languages such as Java and C#.  We expect that the evolution of programming languages will continue to follow the same trend: experimental language features will be developed and explored in small, nimble laboratory languages, and the successful experiments will eventually make their way into the outside world. Specifically, we expect that the mainstream languages of tomorrow will be broadly similar to the languages of today — strongly and statically typed, object-oriented, with an underlying imperative mindset — but incorporating additional features from the functional world — specifically, higher-order operators and datatype genericity&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;Lately I have been making more of an effort to learn Scala. Bruno Oliveira and Jeremy Gibbons make the case in "&lt;a href="www.cs.ox.ac.uk/jeremy.gibbons/publications/scalagp.pdf"&gt;Scala for Generic Programmers&lt;/a&gt;" that it might be one of or even the best language for expressing Generic Programming concepts in part due to its hybridization of object oriented and functional paradigms. Here is the abstract in its entirety:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Datatype-generic programming involves parametrization by the shape of data, in the form of type constructors such as ‘list of’.  Most approaches to datatype-generic programming are developed in the lazy functional programming language Haskell. We argue that the functional object-oriented language Scala is in many ways a better setting. Not only does Scala provide equivalents of all the necessary functional programming features (such parametric polymorphism, higher-order functions, higher-kinded type operations, and type- and constructor-classes), but it also provides the most useful features of object-oriented languages (such as subtyping, overriding, traditional single inheritance, and multiple inheritance in the form of traits). We show how this combination of features benefits datatype-generic programming, using three different approaches as illustrations.&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;So far for me Scala has been a joy.  Its features and flexibility are beautifully elegant of course I am tainted coming from the clumsy, clinking, clanking, clattering caliginous world of Java, BTW Java we need to talk, it’s not you, it’s me. I’ve met someone else.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Jeremy Gibbons Makes the following point in "&lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.159.1228"&gt;Datatype-Generic Programming&lt;/a&gt;":&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Generic programming is about making programming languages more flexible without compromising safety. Both sides of this equation are important, and becoming more so as we seek to do more and more with computer systems, while becoming ever more dependent on their reliability.&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;This idea is similar to ideas that &lt;a href="http://www.infoq.com/author/Gerald-Jay-Sussman"&gt;Gerald Sussman&lt;/a&gt; explores in his talk at &lt;a href="https://thestrangeloop.com/"&gt;Strangeloop&lt;/a&gt; 2011 "&lt;a href="http://www.infoq.com/presentations/We-Really-Dont-Know-How-To-Compute"&gt;We Really Don’t Know How To Compute&lt;/a&gt;".  However, his general and perhaps philosophical approach to the idea of generic programming is very different from the previous ideas:    &lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;[8:40]We spend all of our time modifying existing code, the problem is our code is not adequately evolvable it is not adequately modifiable to fit the future in fact what we want is to make systems that have the property that they are good for things that the designer didn’t even think of or intend.  ... That’s the real problem. ...  The problem is that when we build systems whatever they are we program ourselves into holes. ...  It means that we make decisions early in some process that spread all over our system the consequences of those decisions such that the things that we want to change later are very difficult to change because we have to change a very large amount of stuff.  ... I want to figure ways that we can organize systems so that the consequence of the decisions we make are not expensive to change, we can’t avoid making decisions but we can try to figure out ways to minimize the cost of changing decisions we have made.&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;p&gt;[11:40]Dynamically extensible generic operations  ...  I want to dynamically extend things while my program is running  ... I want a program to compute up what it is going to do.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;He shows an example[19:00] which is "the definition of the method of computing Lagrange Equations from a Lagrangian given a configuration space path". This is apparently easy stuff, to him at least.  Fortunately you don’t really need to understand the details of this math to understand his points here:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;[20:45]This is a little tiny feeling of what is it needed to make things more flexible consider the value here, the value is that I am dynamically allowed to change the meaning of all my operators to add new things that they can do. Dynamically. Not at compile time, at runtime.&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;p&gt;[21:15]It gives me tremendous flexibility. Flexibility because the program I wrote to run on  a bunch of numbers with only a little bit of tweaking suddenly runs on matrices so long as I didn’t make mistake of commuting something wrong. ... So this makes proving the theorems very hard In fact maybe impossible the cost and the benefits are very extreme. I can pay  correctness or proofs of correctness or belief in correctness, I can pay that for tremendous flexibility. ... Is correctness the essential thing I want, I am not opposed to proofs, I love proofs I am an old mathematician. The problem is that putting us into the situation that &lt;a href="http://en.wikipedia.org/wiki/Edsger_W._Dijkstra"&gt;Mr. Dijkstra&lt;/a&gt; got us into ... where you are supposed to prove everything to be right before you write the program getting into that situation puts us in a world where we have to make the specifications for the parts as tight as possible because it’s hard to prove general things, except occasionally it’s easier but it’s usually harder to prove a general theorem about something so you make a very specialized thing that works for a particular case you build this very big tower of stuff and boy is that brittle change the problem a little and it all falls over.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;His ideas tend towards adaptable and self modifying code at one point he talks about self modifying code in both assembly language and the use of eval in Lisp.  He also touches on a number of parallels in the biological world including genetics and the adaptability of the human immune system to fight off mutating parasites.  Interestingly some of his ideas seem similar to work done by &lt;a href="http://www.cs.unm.edu/~forrest/"&gt;Stephanie Forrest&lt;/a&gt; on using evolutionary/genetic algorithms for program repair which she speaks about at the &lt;a href="http://www.infoq.com/presentations/The-Case-for-Evolvable-Software"&gt;keynote&lt;/a&gt; of SPLASH 2010, formerly known as OOPSLA.  The genetic repair approach at the conceptual level is striving for the same results as what &lt;a href="http://www.infoq.com/author/Gerald-Jay-Sussman"&gt;Gerald Sussman&lt;/a&gt; describes.  Also did you notice that the &lt;a href="http://en.wikipedia.org/wiki/Levenshtein_distance"&gt;Levenshtein Distance&lt;/a&gt; between "generic programming" and "genetic programming" is (one substitution), pretty weird!&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Seriously though, the objectives of all of these approaches are the same: building better more flexible software that handles more situations. These ideas are reflected in how &lt;a href="http://www.elegantcoding.com/2012/01/real-software-engineering-good-bad-and.html"&gt;Glenn Vanderburg describes software engineering&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Software engineering is the science and art of designing and making, with economy and elegance, systems so that they can readily adapt to situations which they may be subjected.&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I feel this Software Engineering insight reinforces &lt;a href="http://www.elegantcoding.com/2012/01/real-software-engineering-good-bad-and.html"&gt;my opinion&lt;/a&gt; that we will eventually see a real math backed discipline of software engineering and I think that the research work discussed  here both supports my conjecture on this point and most likely lays part of that foundation.  I also think some of these ideas reflect ideas I discussed in "&lt;a href="http://www.elegantcoding.com/2012/02/software-reuse-complexity-curve.html"&gt;The Software Reuse Complexity Curve&lt;/a&gt;" which implies that programmers will need to become more aware and more adept at more advanced theoretically based concepts like for example &lt;a href="http://www.haskell.org/haskellwiki/GADT"&gt;GADT’s (Generalized algebraic datatypes)&lt;/a&gt;, etc. and of course math in general such as &lt;a href="http://www.elegantcoding.com/2012/03/interesting-group.html"&gt;Abstract Algebra&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Clearly the idea of Generic programming has some very specific ideas and some very general objectives. There seem to be two approaches here which might described Predictive vs. Adaptive, much like the idea of &lt;a href="http://martinfowler.com/articles/newMethodology.html#PredictiveVersusAdaptive"&gt;Separation of Design and Construction&lt;/a&gt; described by Martin Fowler.  The Gibbons et al more calculational approach is &lt;b&gt;predictive&lt;/b&gt; whereas the Sussman/Forrest ideas describe an &lt;b&gt;adaptive&lt;/b&gt; approach. I suspect that this will just be another dimension of program design that will have to be considered and assessed as a tradeoff in its application, which Sussman also mentions.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-4856506076120221020?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/qHMkihlk76g" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/qHMkihlk76g/what-is-generic-programming.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-o3_JQhsIZYg/T52KCmSVf1I/AAAAAAAAAgw/mz-7UulHJMI/s72-c/paris.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/04/what-is-generic-programming.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-658407234782678688</guid><pubDate>Sun, 01 Apr 2012 20:47:00 +0000</pubDate><atom:updated>2012-05-06T11:59:56.721-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Programming</category><category domain="http://www.blogger.com/atom/ns#">Neuroscience</category><category domain="http://www.blogger.com/atom/ns#">Pair Programming</category><title>The Coding Buzz</title><description>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-fe0RVK0ynmQ/T3i-BBa2JlI/AAAAAAAAAgk/9B61aneV_AQ/s1600/533207main_iss027e006501_full.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="274" width="400" src="http://1.bp.blogspot.com/-fe0RVK0ynmQ/T3i-BBa2JlI/AAAAAAAAAgk/9B61aneV_AQ/s400/533207main_iss027e006501_full.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}
&lt;/style&gt;&lt;!--The Coding Buzz--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;In the episode of Seinfeld titled "The Frogger" Jerry and George discover a long lost Frogger machine that still has the G.L.C. George Louis Costanza high score of 860,000 of which George reminisces: "I remember that night. The perfect combination of Mountain Dew and mozzarella...just the right amount of grease on the joy stick..."&lt;/p&gt;&lt;p&gt;This essentially sums up what I call the coding buzz, for me it's the perfect combination of a good problem, private time to work on it, and just the right combination of caffeine and music.  The coding buzz is what I live for, those narcotic moments of creative bliss when all other distractions and even personal problems melt away into the background and your mind and fingers become one with your editor begetting a symphony of code creation.  It's a wonderful thing.&lt;/p&gt;&lt;p&gt;To really achieve the coding buzz one needs to have a level proficiency generally denoted with the quantity 10,000 hours, meaning that you need at least 10,000 hours of practice.  It turns out that the coding buzz is what is called "flow".  This is from &lt;a href="http://www.newscientist.com/article/mg21328501.600-zap-your-brain-into-the-zone-fast-track-to-pure-focus.html"&gt;an article on New Scientist&lt;/a&gt;:&lt;/p&gt;&lt;blockquote class="quote"&gt;&lt;p&gt;The first is an intense and focused absorption that makes you lose all sense of time. The second is what is known as autotelicity, the sense that the activity you are engaged in is rewarding for its own sake. The third is finding the "sweet spot", a feeling that your skills are perfectly matched to the task at hand, leaving you neither frustrated nor bored. And finally, flow is characterised by automaticity, the sense that "the piano is playing itself", for example.&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;p&gt;Flow typically accompanies these actions. It involves a Zen-like feeling of intense concentration, with time seeming to stop as you focus completely on the activity in hand. The experience crops up repeatedly when experts describe what it feels like to be at the top of their game, and with years of practice it becomes second nature to enter that state.&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;p&gt;Exactly what happens in the brain during flow has been of particular interest, but it has been tricky to measure. Csikszentmihalyi took an early stab at it, using electroencephalography (EEG) to measure the brain waves of expert chess players during a game. He found that the most skilled players showed less activity in the prefrontal cortex, which is typically associated with higher cognitive processes such as working memory and verbalisation. That may seem counter-intuitive, but silencing self-critical thoughts might allow more automatic processes to take hold, which would in turn produce that effortless feeling of flow.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;This is why after over two decades I still mostly like to work as a developer, admittedly not all of my career has consisted of  those moments, but the times I found myself immersed in those types of projects both personal and professional has well been worth it.  I frequently feel that I should have grown up at some point and tried to pursue the management track or a more formal architect position and I have contemporary colleagues that are VPs and CTOs, etc.  However, every time I think  about such a career path I realize how much I would dislike it and I would then have to let go of being hands on, I know there are probably cases of those types of positions where that is not the case, but you would have to find the right environment.&lt;/p&gt;&lt;p&gt;I have recently found myself in a &lt;a href="http://en.wikipedia.org/wiki/Pair_programming"&gt;pair programming&lt;/a&gt; environment and while there are some aspects of it that are ok, but I often find myself sneaking away to do the creative experimental work on my own.  As an introvert I sometimes find it hard to pair.  One problem is that there is a substantial skill differential between my teammates and me in that I am considerably more senior so that's a problem, thus I am not sure if my issues with pairing are truly accurate. Still when I need to build some complex functionality or refactor code that requires you to hold dozens of classes in your head, tasks that require intense concentration and that both require you to and reward you for being in the zone aka achieve flow, I just have trouble seeing doing this effectively with the added pressure of someone looking over your shoulder.  I have spoken with developers who like pairing and perhaps it's an introvert/extrovert preference.&lt;/p&gt;&lt;p&gt;When I originally came up with the idea for this post I just wanted to talk about the euphoric bliss of the coding buzz but now I find myself in a situation that seems to be harshing that coding buzz, to put it in the parlance of our times.  Coincidently I am writing this at time when the "group" approach seems to be coming under fire, most notably in an article in the New York Times entitled "&lt;a href="http://www.nytimes.com/2012/01/15/opinion/sunday/the-rise-of-the-new-groupthink.html"&gt;The Rise of the New Groupthink"&lt;/a&gt; by Susan Cain which includes the following:&lt;/p&gt;&lt;blockquote class="quote"&gt;&lt;p&gt;The reasons brainstorming fails are instructive for other forms of group work, too. People in groups tend to sit back and let others do the work; they instinctively mimic others' opinions and lose sight of their own; and, often succumb to peer pressure. The Emory University neuroscientist Gregory Berns found that when we take a stance different from the group's, we activate the amygdala, a small organ in the brain associated with the fear of rejection. Professor Berns calls this "the pain of independence."&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;She also includes the following excellent quote from Steve Wozniak:&lt;/p&gt;&lt;blockquote class="quote"&gt;&lt;p&gt;Most inventors and engineers I've met are like me ... they live in their heads. They're almost like artists. In fact, the very best of them are artists. And artists work best alone .... I'm going to give you some advice that might be hard to take. That advice is: Work alone... Not on a committee. Not on a team.&lt;br /&gt;
&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;She also has an interesting &lt;a href="http://www.ted.com/talks/lang/en/susan_cain_the_power_of_introverts.html"&gt;TED talk&lt;/a&gt;.  As an introvert I feel that both Woz's and her sentiments resonate with me, and I really know what it's like to live in my head, I can't imagine doing good creative work any other way.&lt;/p&gt;&lt;p&gt;As I said the groupthink backlash and pair programming skepticism seems to be something of a hot topic at the moment, see this &lt;a href="http://www.infoq.com/news/2012/03/agile_stifiling_introverts"&gt;compendium post on InfoQ&lt;/a&gt; which includes some these and other links.  Obviously communication is essential in a multi-person software project but is pair programming over doing it?  It just feels like a coding buzz kill to me.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&amp;nbsp;&lt;p&gt;&lt;p&gt;&amp;nbsp;&lt;p&gt;&lt;p&gt;&amp;nbsp;&lt;p&gt;&lt;p&gt;&amp;nbsp;&lt;p&gt;&lt;p&gt;The following two talks are some additional interesting and relevant neuroscience related resources:&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.youtube.com/watch?v=uPBapVkZJww&amp;feature=plcp&amp;context=C46fc796VDvjVQa1PpcFOKi--7u6RbCU1wl02kytFbc7KYeMQhDEE%3D"&gt;Authors@Google: Sandra Aamodt &amp; Sam Wang&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.youtube.com/watch?v=XeJSXfXep4M"&gt;Your Brain at Work by David Rock.&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-658407234782678688?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/wi0Q4BILEe4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/wi0Q4BILEe4/coding-buzz.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-fe0RVK0ynmQ/T3i-BBa2JlI/AAAAAAAAAgk/9B61aneV_AQ/s72-c/533207main_iss027e006501_full.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/04/coding-buzz.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-8525151354191190000</guid><pubDate>Thu, 29 Mar 2012 01:49:00 +0000</pubDate><atom:updated>2012-05-06T11:50:14.189-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Complex numbers</category><category domain="http://www.blogger.com/atom/ns#">Abstract Algebra</category><category domain="http://www.blogger.com/atom/ns#">Group Theory</category><title>Amazing Abstract Algebra: Groups and Rotations</title><description>&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-_Q3GAMaMIUE/T3O2gxLA4EI/AAAAAAAAAfQ/0cag7eZ6e4w/s1600/IMG_7160.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://1.bp.blogspot.com/-_Q3GAMaMIUE/T3O2gxLA4EI/AAAAAAAAAfQ/0cag7eZ6e4w/s400/IMG_7160.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;style&gt;
    td.z0 {
        padding:15px;
        font-size: 16px;
        text-align : center;
        background-color: #ffffff;
        color:black;
        border : 1px solid black;
    }

    td.z1 {
        padding:15px;
        font-size: 16px;
        text-align : center;
        vertical-align : center;
        background-color: #ffff00;
        color:black;
        border : 1px solid black;
    }

    td.z2 {
        padding:15px;
        font-size: 16px;
        text-align : center;
        vertical-align : center;
        background-color: #66ff33;
        color:black;
        border : 1px solid black;
    }

    td.z3 {
        padding:15px;
        font-size: 16px;
        text-align : center;
        vertical-align : center;
        background-color: #669933;
        color:black;
        border : 1px solid black;
    }

    td.v {
        padding:15px;
        font-size: 16px;
        text-align : center;
        vertical-align : center;
        background-color: #00ffff;
        color:black;
        border : 1px solid black;
    }

    td.h {
        padding:15px;
        font-size: 16px;
        text-align : center;
        vertical-align : center;
        background-color: #ff66cc;
        color:black;
        border : 1px solid black;
    }

    td.d1 {
        padding:15px;
        font-size: 16px;
        text-align : center;
        vertical-align : center;
        background-color: #9966ff;
        color:black;
        border : 1px solid black;
    }

    td.d2 {
        padding:15px;
        font-size: 16px;
        text-align : center;
        vertical-align : center;
        background-color: #0000ff;
        color:black;
        border : 1px solid black;
    }

    div.source-code {
        color             : #000;
        background-color  : #eee;
        border            : 1px dashed #999999;
        line-height       : 14px;
        padding           : 5px;
        overflow          : auto;
        width             : 100%;
        text-indent       : 0px;
        margin-top        : 8px;
        margin-bottom     : 8px;
    }
&lt;/style&gt;&lt;br /&gt;
&lt;p&gt;A little while ago I noticed a very interesting group, I am sure it is well known in math circles but I find it intriguing for a number of reasons and I have recently learned more about &lt;a href="http://en.wikipedia.org/wiki/Abstract_algebra"&gt;Abstract Algebra&lt;/a&gt; which ties in some more interesting ideas.  The group relates to &lt;a href="http://en.wikipedia.org/wiki/Imaginary_number"&gt;imaginary numbers&lt;/a&gt;, it is the set {1,-1,i,-i} which is closed under multiplication.  It has an identity which is 1.  Each element has an inverse, -1 is its own inverse: -1 &amp;middot; -1 = 1 and -i &amp;middot; i  = 1.  The following &lt;a href="http://en.wikipedia.org/wiki/Cayley_table"&gt;cayley table&lt;/a&gt; shows all this:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;table border="1" cellpadding="2" cellspacing="0"  style="text-align:center;"&gt;&lt;tr&gt;     &lt;td class="z0"&gt;&amp;bull;&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z0"&gt; i&lt;/td&gt;     &lt;td class="z0"&gt;-1&lt;/td&gt;     &lt;td class="z0"&gt;-i&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z1"&gt; i&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt;     &lt;td class="z3"&gt;-i&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt; i&lt;/td&gt;     &lt;td class="z1"&gt; i&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt;     &lt;td class="z3"&gt;-i&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;-1&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt;     &lt;td class="z3"&gt;-i&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z1"&gt; i&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;-i&lt;/td&gt;     &lt;td class="z3"&gt;-i&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z1"&gt; i&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt; &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;p&gt;If you are new to these ideas I recommend looking at my &lt;a href="http://www.elegantcoding.com/2012/01/abstract-algebra-logic-of-odd-and-even.html"&gt;previous post&lt;/a&gt; on abstract algebra, especially since we will be looking at some &lt;a href="http://en.wikipedia.org/wiki/Isomorphism"&gt;isomorphisms&lt;/a&gt; again.  In order to talk about the ideas in the post we need to get some group theory concepts out of the way first, don't worry they aren't hard in fact they're fairly intuitive.  Also in this post I am restricting the discussion to finite groups, groups with a finite number of elements.  In fact the first idea is the concept of group order.&lt;br /&gt;
&lt;/p&gt;&lt;div class="source-code"&gt;&lt;p&gt;The order of a finite group is simply the number of elements of the set the group is defined on and is denoted as |G|.&lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;The group above has an order of 4.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;The next idea is that of exponentiation, which can be thought of as a subset of "classical" exponentiation on the field of real numbers, see identities &lt;a href="http://www.elegantcoding.com/2011/10/ologn.html"&gt;here&lt;/a&gt;.  Exponentiation on group elements extends to integer exponents only and refers to repeated application of the binary operation to the element itself. So:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;a&lt;sup&gt;n&lt;/sup&gt; = a&amp;middot;a&amp;middot;a&amp;middot;a...a ( a "times" itself n times)&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;a&lt;sup&gt;-n&lt;/sup&gt; = a&lt;sup&gt;-1&lt;/sup&gt;&amp;middot;a&lt;sup&gt;-1&lt;/sup&gt;&amp;middot;a&lt;sup&gt;-1&lt;/sup&gt;&amp;middot;a&lt;sup&gt;-1&lt;/sup&gt;...a&lt;sup&gt;-1&lt;/sup&gt;  (a&lt;sup&gt;-1&lt;/sup&gt; "times" itself n times or the inverse of a&lt;sup&gt;n&lt;/sup&gt;)&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;a&lt;sup&gt;0&lt;/sup&gt; = e (where e is the identity element)&lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;The laws of exponents are:&lt;br /&gt;
&lt;/p&gt;&lt;div class="source-code"&gt;&lt;p&gt;a&lt;sup&gt;m&lt;/sup&gt; a&lt;sup&gt;n&lt;/sup&gt; = a&lt;sup&gt;m+n&lt;/sup&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;(a&lt;sup&gt;m&lt;/sup&gt;)&lt;sup&gt;n&lt;/sup&gt; = a&lt;sup&gt;mn&lt;/sup&gt;&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;a&lt;sup&gt;-n&lt;/sup&gt; = (a&lt;sup&gt;-1&lt;/sup&gt;)&lt;sup&gt;n&lt;/sup&gt; = (a&lt;sup&gt;n&lt;/sup&gt;)&lt;sup&gt;-1&lt;/sup&gt;&lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Just as a group has an order an element of a group also has an order and it is related to exponentiation and it is defined as:&lt;br /&gt;
&lt;/p&gt;&lt;div class="source-code"&gt;&lt;p&gt;If there exists a nonzero integer m such that a&lt;sup&gt;m&lt;/sup&gt;=e, then the order of the element is defined to be the least positive integer n such that a&lt;sup&gt;n&lt;/sup&gt;=e.  Also if there does not exist any nonzero integer m such that a&lt;sup&gt;m&lt;/sup&gt;=e, we say that a has order infinity.&lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;p&gt;So the elements in our group (&amp;sdot;, {1,-1,i,-i}) above have the following orders:&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;1&lt;sup&gt;1&lt;/sup&gt; = 1 (this is the identity and has order 1) [1&lt;sup&gt;1&lt;/sup&gt; = 1, ...]&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;-1&lt;sup&gt;2&lt;/sup&gt; = 1 (has order 2)  [-1&lt;sup&gt;1&lt;/sup&gt; = -1, -1&lt;sup&gt;2&lt;/sup&gt; = 1, ...]&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;i&lt;sup&gt;4&lt;/sup&gt; = 1 (has order 4) [i&lt;sup&gt;1&lt;/sup&gt; = i, i&lt;sup&gt;2&lt;/sup&gt; = -1, i&lt;sup&gt;3&lt;/sup&gt; = -i, i&lt;sup&gt;4&lt;/sup&gt; = 1, ...]&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;-i&lt;sup&gt;4&lt;/sup&gt; = 1 (has order 4) [-i&lt;sup&gt;1&lt;/sup&gt; = -i, -i&lt;sup&gt;2&lt;/sup&gt; = -1, -i&lt;sup&gt;3&lt;/sup&gt; = i, -i&lt;sup&gt;4&lt;/sup&gt; = 1, ...]&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Order is also sometimes referred to as period and you should note that each of the above will cycle through each power listed in the square brackets so for both the order 4 elements {i, -i}:  a&lt;sup&gt;1n&lt;/sup&gt;=a&lt;sup&gt;1&lt;/sup&gt;, a&lt;sup&gt;2n&lt;/sup&gt;=a&lt;sup&gt;2&lt;/sup&gt;, a&lt;sup&gt;3n&lt;/sup&gt;=a&lt;sup&gt;3&lt;/sup&gt;, a&lt;sup&gt;4n&lt;/sup&gt;=a&lt;sup&gt;4&lt;/sup&gt; for all integers n&amp;gt;0 and the values will cycle through the list which would be the case for any element of finite order.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;As it turns out elements like i and -i which cycle through all of the elements of a group exactly once in the period have an order that is equal to the order of the group. These define what is known as a cyclic group. So our group is cyclic and any element which cycles through all elements once is the generator so i and -i are generators for the group.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Another interesting result from group theory is that &lt;b&gt;any cyclic group of order n is isomorphic to the group (+,Z&lt;sub&gt;n&lt;/sub&gt;)&lt;/b&gt; which is the integers (mod n) under addition so our group above is just a renaming of Z&lt;sub&gt;4&lt;/sub&gt; see the similarity to the cayley table below:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;table border="1" cellpadding="2" cellspacing="0"  style="text-align:center;"&gt;&lt;tr&gt;     &lt;td class="z0"&gt;+&lt;/td&gt;     &lt;td class="z0"&gt;0&lt;/td&gt;     &lt;td class="z0"&gt;1&lt;/td&gt;     &lt;td class="z0"&gt;2&lt;/td&gt;     &lt;td class="z0"&gt;3&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;0&lt;/td&gt;     &lt;td class="z0"&gt;0&lt;/td&gt;     &lt;td class="z1"&gt;1&lt;/td&gt;     &lt;td class="z2"&gt;2&lt;/td&gt;     &lt;td class="z3"&gt;3&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;1&lt;/td&gt;     &lt;td class="z1"&gt;1&lt;/td&gt;     &lt;td class="z2"&gt;2&lt;/td&gt;     &lt;td class="z3"&gt;3&lt;/td&gt;     &lt;td class="z0"&gt;0&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;2&lt;/td&gt;     &lt;td class="z2"&gt;2&lt;/td&gt;     &lt;td class="z3"&gt;3&lt;/td&gt;     &lt;td class="z0"&gt;0&lt;/td&gt;     &lt;td class="z1"&gt;1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;3&lt;/td&gt;     &lt;td class="z3"&gt;3&lt;/td&gt;     &lt;td class="z0"&gt;0&lt;/td&gt;     &lt;td class="z1"&gt;1&lt;/td&gt;     &lt;td class="z2"&gt;2&lt;/td&gt; &lt;/tr&gt;
&lt;/table&gt;&lt;p&gt;Now I want to take a look at another important group, it's called the &lt;a href="http://en.wikipedia.org/wiki/Dihedral_group"&gt;dihedral group&lt;/a&gt;, this one is known as D&lt;sub&gt;4&lt;/sub&gt; and has the cayley table:&lt;br /&gt;
&lt;/p&gt;&lt;table border="1" cellpadding="2" cellspacing="0"  style="text-align:center;"&gt;&lt;tr&gt;     &lt;td class="z0"&gt;&amp;nbsp;&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;3&lt;/sub&gt;&lt;/td&gt;      &lt;td class="z0"&gt;V&lt;/td&gt;     &lt;td class="z0"&gt;H&lt;/td&gt;     &lt;td class="z0"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z1"&gt;R&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z2"&gt;R&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z3"&gt;R&lt;sub&gt;3&lt;/sub&gt;&lt;/td&gt;      &lt;td class="v"&gt;V&lt;/td&gt;     &lt;td class="h"&gt;H&lt;/td&gt;     &lt;td class="d1"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="d2"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;1&lt;sub&gt;&lt;/td&gt;     &lt;td class="z1"&gt;R&lt;sub&gt;1&lt;sub&gt;&lt;/td&gt;     &lt;td class="z2"&gt;R&lt;sub&gt;2&lt;sub&gt;&lt;/td&gt;     &lt;td class="z3"&gt;R&lt;sub&gt;3&lt;sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;sub&gt;&lt;/td&gt;      &lt;td class="h"&gt;H&lt;/td&gt;     &lt;td class="d1"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="d2"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="v"&gt;V&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;2&lt;sub&gt;&lt;/td&gt;     &lt;td class="z2"&gt;R&lt;sub&gt;2&lt;sub&gt;&lt;/td&gt;     &lt;td class="z3"&gt;R&lt;sub&gt;3&lt;sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;sub&gt;&lt;/td&gt;     &lt;td class="z1"&gt;R&lt;sub&gt;1&lt;sub&gt;&lt;/td&gt;      &lt;td class="d1"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="d2"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="v"&gt;V&lt;/td&gt;     &lt;td class="h"&gt;H&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;3&lt;sub&gt;&lt;/td&gt;     &lt;td class="z3"&gt;R&lt;sub&gt;3&lt;sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;sub&gt;&lt;/td&gt;     &lt;td class="z1"&gt;R&lt;sub&gt;1&lt;sub&gt;&lt;/td&gt;     &lt;td class="z2"&gt;R&lt;sub&gt;2&lt;sub&gt;&lt;/td&gt;      &lt;td class="d2"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="v"&gt;V&lt;/td&gt;     &lt;td class="h"&gt;H&lt;/td&gt;     &lt;td class="d1"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;V&lt;/td&gt;     &lt;td class="v"&gt;V&lt;/td&gt;     &lt;td class="d2"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="d1"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="h"&gt;H&lt;/td&gt;      &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z1"&gt;R&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z2"&gt;R&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z3"&gt;R&lt;sub&gt;3&lt;/sub&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;H&lt;/td&gt;     &lt;td class="h"&gt;H&lt;/td&gt;     &lt;td class="v"&gt;V&lt;/td&gt;     &lt;td class="d2"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="d1"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;      &lt;td class="z1"&gt;R&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z2"&gt;R&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z3"&gt;R&lt;sub&gt;3&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;/sub&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="d1"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="h"&gt;H&lt;/td&gt;     &lt;td class="v"&gt;V&lt;/td&gt;     &lt;td class="d2"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;      &lt;td class="z2"&gt;R&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z3"&gt;R&lt;sub&gt;3&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z1"&gt;R&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="d2"&gt;D&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt;     &lt;td class="d1"&gt;D&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="h"&gt;H&lt;/td&gt;     &lt;td class="v"&gt;V&lt;/td&gt;      &lt;td class="z3"&gt;R&lt;sub&gt;3&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z0"&gt;R&lt;sub&gt;0&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z1"&gt;R&lt;sub&gt;1&lt;/sub&gt;&lt;/td&gt;     &lt;td class="z2"&gt;R&lt;sub&gt;2&lt;/sub&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;p&gt;The dihedral group is the group of symmetries of a regular polygon, including both rotations and reflections.  In this case we will consider the rotations and reflections of a square denoted as D&lt;sub&gt;4&lt;/sub&gt; represented visually as four couterclockwise rotations of a square:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-DGXCZ5F0Y_I/T3O2uMywCRI/AAAAAAAAAfc/vUqqE1e-7uE/s1600/dihedral.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="376" src="http://2.bp.blogspot.com/-DGXCZ5F0Y_I/T3O2uMywCRI/AAAAAAAAAfc/vUqqE1e-7uE/s400/dihedral.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;And the following four reflections, vertical, horizontal, and two diagonal reflections:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-LnL-QTjx6Ck/T3O2zbyrllI/AAAAAAAAAfo/M55WehpOjVQ/s1600/dihedral2.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="376" src="http://2.bp.blogspot.com/-LnL-QTjx6Ck/T3O2zbyrllI/AAAAAAAAAfo/M55WehpOjVQ/s400/dihedral2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;With each image is included the permutation, actually dihedral groups are permutation groups and D&lt;sub&gt;4&lt;/sub&gt; is a set of 8 permutations, hence the order of the group is 8. It is a subgroup of the group of all &lt;a href="http://www.elegantcoding.com/2011/05/combinatorial-and-other-math-of-java.html"&gt;permutations&lt;/a&gt; of four items which is known as the &lt;a href="http://en.wikipedia.org/wiki/Symmetric_group"&gt;Symmetric Group&lt;/a&gt; which has order 4!=24, it's denoted as S&lt;sub&gt;4&lt;/sub&gt;.  The interesting thing here is the rotations form a subgroup that is isomorphic to our group from above and Z&lt;sub&gt;4&lt;/sub&gt;.  In a sense this isn't really surprising since it is a cyclic group of order four meaning it cycles through 4 items just as a square cycles through four rotations.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;As you can see from the color coding, the elements {R&lt;sub&gt;0&lt;/sub&gt;, R&lt;sub&gt;1&lt;/sub&gt;, R&lt;sub&gt;2&lt;/sub&gt;, R&lt;sub&gt;3&lt;/sub&gt;} form a subgroup, a subgroup is just a subset of the elements that is still a group.  These subgroup elements forming the upper left hand corer of the table are color coded to show the isomorphism between this subgroup and Z&lt;sub&gt;4&lt;/sub&gt; and also our group (&amp;sdot;, {1,-1,i,-i}). Also R&lt;sub&gt;0&lt;/sub&gt;  is the identity which makes sense since it is a zero rotation, which means that you didn't rotate it, or you did by 360&amp;deg; aka one &lt;a href="http://tauday.com/"&gt;tau&lt;/a&gt;.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Our Z&lt;sub&gt;4&lt;/sub&gt; isomorphic group (&amp;sdot;, {1,-1,i,-i}) also has a subgroup. Our original arrangement of the cayley table was ordered to show the Z&lt;sub&gt;4&lt;/sub&gt; isomorphism. To show our subgroup we need to rearrange the cayley table:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;table border="1" cellpadding="2" cellspacing="0"  style="text-align:center;"&gt;&lt;tr&gt;     &lt;td class="z0"&gt;&amp;bull;&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z0"&gt;-1&lt;/td&gt;     &lt;td class="z0"&gt; i&lt;/td&gt;     &lt;td class="z0"&gt;-i&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt;     &lt;td class="z1"&gt; i&lt;/td&gt;     &lt;td class="z3"&gt;-i&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;-1&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z3"&gt;-i&lt;/td&gt;     &lt;td class="z1"&gt; i&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt; i&lt;/td&gt;     &lt;td class="z1"&gt; i&lt;/td&gt;     &lt;td class="z3"&gt;-i&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;-i&lt;/td&gt;     &lt;td class="z3"&gt;-i&lt;/td&gt;     &lt;td class="z1"&gt; i&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt; &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;p&gt;Now it should be fairly easy to the subgroup (&amp;sdot;, {1,-1}) again forming the upper left corner in the table above, or shown by itself:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;table border="1" cellpadding="2" cellspacing="0"  style="text-align:center;"&gt;&lt;tr&gt;     &lt;td class="z0"&gt;&amp;bull;&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z0"&gt;-1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="z0"&gt;-1&lt;/td&gt;     &lt;td class="z2"&gt;-1&lt;/td&gt;     &lt;td class="z0"&gt; 1&lt;/td&gt; &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;p&gt;Now if you think about it our subgroup which is just another group is a group, 1 is the identity and -1 is its own inverse, actually it turns out that &lt;b&gt;all subgroups of cyclic groups are also cyclic groups&lt;/b&gt; and since all cyclic groups are isomorphic to Z&lt;sub&gt;n&lt;/sub&gt; groups, this group is actually one that we have &lt;a href="http://www.elegantcoding.com/2012/01/abstract-algebra-logic-of-odd-and-even.html"&gt;seen before&lt;/a&gt; it's just Z&lt;sub&gt;2&lt;/sub&gt; addition aka exclusive-or, etc.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Also there are some remarkable connections to number theory in regards to the order of subgroups and the order of elements, for example the order of our subgroup is 2 which evenly divides 4 the order of the group, &lt;b&gt;the order of a subgroup will always evenly divide the order of the group&lt;/b&gt;. Also &lt;b&gt;the order of each element evenly divides the order of the group&lt;/b&gt;.  I suspect that these ideas have profound implications.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Going back to our original group there are a couple of interesting things about imaginary numbers, first are the following equations:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-5whHLifSmoU/T3O3CW4auVI/AAAAAAAAAf0/3wbGZb-g0YA/s1600/i-inverse.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="16" width="64" src="http://1.bp.blogspot.com/-5whHLifSmoU/T3O3CW4auVI/AAAAAAAAAf0/3wbGZb-g0YA/s400/i-inverse.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-HQDF9iEzIkQ/T3O3HyVWmnI/AAAAAAAAAgA/wPHd8kope0w/s1600/i-div-i.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="35" width="37" src="http://3.bp.blogspot.com/-HQDF9iEzIkQ/T3O3HyVWmnI/AAAAAAAAAgA/wPHd8kope0w/s400/i-div-i.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;If we consider the sequence of raising i to successive powers, multiplying by I each time, if we start with 1, we get the sequence (1, i, -1, -i), these are actually coordinates in the complex plane and can be written as (0i+1, 1i+0, 0i-1, -1i+0). This cycle (increasing powers of i) is the following (counter clockwise) rotation in the complex plane:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-ct0yL-Syonw/T3O3NuosVlI/AAAAAAAAAgM/M-8D5syCITQ/s1600/complex-plane%252B1.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="400" src="http://4.bp.blogspot.com/-ct0yL-Syonw/T3O3NuosVlI/AAAAAAAAAgM/M-8D5syCITQ/s400/complex-plane%252B1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Conversely if we divide, or repeatedly multiply by  -i, we get the following sequence (1,-i,-1,i) which correspond to the complex numbers (0i+1, -1i+0, 0i-1, 1i+0) and is the opposite (clockwise) rotation:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-gmpn6o_UY40/T3O3THlWxNI/AAAAAAAAAgY/RNO1DI8WtIY/s1600/complex-plane-1.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="400" src="http://4.bp.blogspot.com/-gmpn6o_UY40/T3O3THlWxNI/AAAAAAAAAgY/RNO1DI8WtIY/s400/complex-plane-1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Another interesting seemingly related concept is the idea of turning number or &lt;a href=" http://en.wikipedia.org/wiki/Winding_number"&gt;winding number&lt;/a&gt; of a curve, the red circle with clockwise rotation corresponds to curve with a winding number of -1 and the blue curve with positive increasing powers of i has a winding number of 1.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;As we saw our group is cyclic and isomorphic to Z&lt;sub&gt;4&lt;/sub&gt; and isomorphic to the rotation subgroup of the dihedral group D&lt;sub&gt;4&lt;/sub&gt; and both of the generators of our group correspond to rotation in the complex plane. Counterclockwise rotation corresponds to the period of i and clockwise rotation corresponds to the period of -i.&lt;br /&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-8525151354191190000?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/RuTm0_HirUk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/RuTm0_HirUk/interesting-group.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-_Q3GAMaMIUE/T3O2gxLA4EI/AAAAAAAAAfQ/0cag7eZ6e4w/s72-c/IMG_7160.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/03/interesting-group.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-7096643175336703846</guid><pubDate>Sun, 25 Mar 2012 17:08:00 +0000</pubDate><atom:updated>2012-05-13T15:08:20.931-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Morphology</category><category domain="http://www.blogger.com/atom/ns#">Naming</category><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><category domain="http://www.blogger.com/atom/ns#">Software Frameworks</category><category domain="http://www.blogger.com/atom/ns#">Linguistics</category><title>More Thoughts on Formal Approaches to Naming in Software</title><description>&lt;h2&gt;On the Importance of Naming in Software Systems, Part II&lt;/h2&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-4uF4DFKqu3U/T29K3M7GjCI/AAAAAAAAAfE/ONxHweH_BdM/s1600/Io_Full.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="400" src="http://4.bp.blogspot.com/-4uF4DFKqu3U/T29K3M7GjCI/AAAAAAAAAfE/ONxHweH_BdM/s400/Io_Full.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}

blockquote.paraphrase {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}


div.source-code1 {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px dashed #999999;
    line-height       : 10px;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
}

div.source-code {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px dashed #999999;
    line-height       : 14px;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
    margin-top        : 8px;
    margin-bottom     : 8px;
}

p.codeline {

    padding: 0px;
    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    color:black;
}

p.codeline1 {

    padding: 0px;
    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    text-indent:.5in;
    color:black;
}

p.codeline2 {

    padding: 0px;
    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    text-indent:1in;
    color:black;
}

p.codeline3 {

    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    text-indent:1.5in;
    color:black;
}

&lt;/style&gt;&lt;!--More Thoughts on Formal Approaches to Naming in Software--&gt;&lt;br /&gt;
&lt;p&gt;In my &lt;a href="http://www.elegantcoding.com/2012/03/survey-of-conventional-wisdom-on.html"&gt;last post on naming&lt;/a&gt; I surveyed and attempted to categorize the conventional wisdom in regards to naming. Here I will expand on some of my ideas and extend my naming domain vocabulary.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;A software system is composed of many things and most of them if not all have names.  In order to talk about this I realized that I need a term to describe the things that have names, Steve McConnell makes the comment "a variable and a variable’s name are essentially the same thing".  While this is effectively true, &lt;i&gt;named things&lt;/i&gt; in a system have different types, uses, etc.  In trying to come up with a name for these &lt;i&gt;named things&lt;/i&gt;, I felt that I could do better than the phrase "named things". For the word "things" I contemplated item, object, entity, artifact, and more. These all had various connotations and possible contexts which confused the meaning. I turned to linguistics for the answer, and found the following on Wikipedia under &lt;a href="http://en.wikipedia.org/wiki/Intension"&gt;intension&lt;/a&gt;, the bolding is mine:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;&lt;i&gt;The meaning of a word can be thought of as the bond between the idea or thing the word refers to and the word itself. Swiss linguist &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Ferdinand_de_Saussure" title="Ferdinand de Saussure"&gt;&lt;i&gt;Ferdinand de Saussure&lt;/i&gt;&lt;/a&gt;&lt;i&gt; contrasts three concepts:&lt;/i&gt;&lt;/p&gt;&lt;br /&gt;
&lt;ul type=disc&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;the signifier&lt;/i&gt;&lt;/b&gt;&lt;i&gt; — the &amp;quot;sound image&amp;quot; or string of &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Letter_%28alphabet%29"      title="Letter (alphabet)"&gt;&lt;i&gt;letters&lt;/i&gt;&lt;/a&gt;&lt;i&gt; on a page that one recognizes as a &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Sign_%28linguistics%29" title="Sign (linguistics)"&gt;&lt;i&gt;sign&lt;/i&gt;&lt;/a&gt;&lt;i&gt;.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;the signified&lt;/i&gt;&lt;/b&gt;&lt;i&gt; — the &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Concept"      title=Concept&gt;&lt;i&gt;concept&lt;/i&gt;&lt;/a&gt;&lt;i&gt; or &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Idea" title=Idea&gt;&lt;i&gt;idea&lt;/i&gt;&lt;/a&gt;&lt;i&gt; that a sign evokes.&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;the referent&lt;/i&gt;&lt;/b&gt;&lt;i&gt; — the actual &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Object_%28philosophy%29" title="Object (philosophy)"&gt;&lt;i&gt;thing&lt;/i&gt;&lt;/a&gt;&lt;i&gt; or set of things a sign refers to. See &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Sign_%28semiotics%29#Dyadic_signs" title="Sign (semiotics)"&gt;Dyadic signs&lt;/a&gt;&lt;i&gt; and &lt;/i&gt;&lt;a href="http://en.wikipedia.org/wiki/Reference#Semantics" title=Reference&gt;Reference (semantics)&lt;/a&gt;&lt;i&gt;.&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;So the word &lt;b&gt;&lt;i&gt;referent&lt;/i&gt;&lt;/b&gt; seems to be a good choice as it probably has no context with relation to software engineering.  To take this further, I will use the expression &lt;b&gt;&lt;i&gt;Named System Referent&lt;/i&gt;&lt;/b&gt;&lt;i&gt; &lt;/i&gt;or possibly just &lt;b&gt;&lt;i&gt;System Referent&lt;/i&gt;&lt;/b&gt; to refer to those things in a software system that have a name.  To be clear here a name is what is referred to above as a &lt;b&gt;&lt;i&gt;signifier&lt;/i&gt;&lt;/b&gt; but I will just use name.  A &lt;b&gt;&lt;i&gt;System Referent&lt;/i&gt;&lt;/b&gt; is the thing (&lt;b&gt;&lt;i&gt;referent&lt;/i&gt;&lt;/b&gt;) in the Software System that the name refers to.  If this is confusing hopefully some examples will help.  Some &lt;b&gt;&lt;i&gt;System Referents&lt;/i&gt;&lt;/b&gt; include but are not limited to the following&lt;sup&gt;1&lt;/sup&gt;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Classes&lt;/li&gt;
&lt;li&gt;Variables (local, instance, static)&lt;/li&gt;
&lt;li&gt;Methods&lt;/li&gt;
&lt;li&gt;Method Parameters&lt;/li&gt;
&lt;li&gt;Packages&lt;/li&gt;
&lt;li&gt;Database Tables, Columns, Triggers, Stored Procedures, etc.&lt;/li&gt;
&lt;li&gt;HTML Files, CSS Files, Javascript Files, Config Files, all files&lt;/li&gt;
&lt;li&gt;Directories&lt;/li&gt;
&lt;li&gt;Urls&lt;/li&gt;
&lt;li&gt;Documents&lt;/li&gt;
&lt;li&gt;XML Elements and Attributes&lt;/li&gt;
&lt;li&gt;CSS Classes&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;p&gt;And the list goes on.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Another observation we can make is that &lt;b&gt;&lt;i&gt;System Referents&lt;/i&gt;&lt;/b&gt; can have a context or a grouping, for example &lt;b&gt;&lt;i&gt;System Referents&lt;/i&gt;&lt;/b&gt; which include classes, packages, variables, methods, etc. may have different conventions from other &lt;b&gt;&lt;i&gt;System Referent&lt;/i&gt;&lt;/b&gt; groupings such as database &lt;b&gt;&lt;i&gt;System Referents&lt;/i&gt;&lt;/b&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now that we have a way to talk about named items, we can explore the very important idea of naming conventions.  The name of a &lt;b&gt;&lt;i&gt;System Referent&lt;/i&gt;&lt;/b&gt; often consists of several components, from a linguistic stand point these components are similar to, but not the same as a &lt;a href="http://en.wikipedia.org/wiki/Lexical_unit"&gt;lexical unit&lt;/a&gt; or a &lt;a href="http://en.wikipedia.org/wiki/Morphemes"&gt;morpheme&lt;/a&gt;, for this I am choosing the term &lt;b&gt;&lt;i&gt;Name Unit&lt;/i&gt;&lt;/b&gt;, for example an identifier "personId" consists of two &lt;b&gt;&lt;i&gt;Name Units&lt;/i&gt;&lt;/b&gt;, "person" and "id". Name units imply a separator mechanism. In this example the use of &lt;a href="http://en.wikipedia.org/wiki/CamelCase"&gt;CamelCase&lt;/a&gt;, another example is "person_id" where the name units are separated by the separator "_".  So a &lt;b&gt;&lt;i&gt;name unit&lt;/i&gt;&lt;/b&gt; is that atomic piece of a name that is separated by a separator and a separator is either explicit e.g. "_" or implied e.g. CamelCase. In my previous post we looked at different prefix and suffix qualifiers, this is a generalization of the qualifier concept which deals with the whole name and not just one part of it.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I wish to compare, from the structural perspective, two common conventions one for the Java &lt;b&gt;&lt;i&gt;System Referent&lt;/i&gt;&lt;/b&gt; grouping and that of an SQL Database grouping.  For the Java Naming convention we will assume the standard Java naming convention.  For the database we will limit ourselves to Tables and Columns and assume uppercase Names, &lt;b&gt;&lt;i&gt;name units&lt;/i&gt;&lt;/b&gt; that consist only of upper case characters, the separator will be an underscore "_".&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;We can define formal a more formal approach to the lexical structure of a naming convention using a &lt;a href="http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form"&gt;BNF&lt;/a&gt;, or in this case my own variant &lt;a href="http://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form"&gt;extended BNF&lt;/a&gt;, for example our BNF for variable names in Java might look like the following:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;name-unit-terminal ::= [A-Z]+[a-zA-Z0-9]*&lt;/p&gt;&lt;p&gt;name-unit-prefix-terminal ::= [a-z]+[a-zA-Z0-9]*&lt;/p&gt;&lt;p&gt;&amp;lt;name&amp;gt; ::=  name-unit-prefix-terminal | name-unit-prefix-terminal &amp;lt;name-unit&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;name-unit&amp;gt; ::= name-unit-terminal | name-unit-terminal &amp;lt;name-unit&amp;gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The Naming convention for our database column names and table names:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;name-unit-terminal ::= [A-Z]+[A-Z0-9]*&lt;/p&gt;&lt;p&gt;&amp;lt;name&amp;gt; ::=  name-unit-terminal | name-unit-terminal "_" &amp;lt;name&amp;gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Two Concrete examples illuminating these are as follows:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;public class Person {&lt;/p&gt;&lt;p class="codeline1"&gt;private Long id;&lt;/p&gt;&lt;p class="codeline1"&gt;private String lastName;&lt;/p&gt;&lt;p class="codeline1"&gt;private String firstName;&lt;/p&gt;&lt;p class="codeline1"&gt;private String middle;&lt;/p&gt;&lt;p class="codeline1"&gt;private String phone;&lt;/p&gt;&lt;p class="codeline1"&gt;private String email;&lt;/p&gt;&lt;p class="codeline1"&gt;public Long getId() {&lt;/p&gt;&lt;p class="codeline2"&gt;return id;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public void setId(Long value) {&lt;/p&gt;&lt;p class="codeline2"&gt;id = value;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public String getLastName() {&lt;/p&gt;&lt;p class="codeline2"&gt;return lastName;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public void setLastName(String value) {&lt;/p&gt;&lt;p class="codeline2"&gt;lastName = value;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public String getFirstName() {&lt;/p&gt;&lt;p class="codeline2"&gt;return firstName;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public void setFirstName(String value) {&lt;/p&gt;&lt;p class="codeline2"&gt;firstName = value;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public String getMiddle() {&lt;/p&gt;&lt;p class="codeline2"&gt;return middle;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public void setMiddle(String value) {&lt;/p&gt;&lt;p class="codeline2"&gt;middle = value;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public String getPhone() {&lt;/p&gt;&lt;p class="codeline2"&gt;return phone;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public void setPhone(String value) {&lt;/p&gt;&lt;p class="codeline2"&gt;phone = value;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public String getEmail() {&lt;/p&gt;&lt;p class="codeline2"&gt;return email;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p class="codeline1"&gt;public void setEmail(String email) {&lt;/p&gt;&lt;p class="codeline2"&gt;this.email = email;&lt;/p&gt;&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;CREATE TABLE PERSON (&lt;/p&gt;&lt;p class="codeline1"&gt;ID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,&lt;/p&gt;&lt;p class="codeline1"&gt;LAST_NAME VARCHAR(40) NULL,&lt;/p&gt;&lt;p class="codeline1"&gt;FIRST_NAME VARCHAR(20) NULL,&lt;/p&gt;&lt;p class="codeline1"&gt;MIDDLE VARCHAR(20) NULL,&lt;/p&gt;&lt;p class="codeline1"&gt;PHONE VARCHAR(20) NULL,&lt;/p&gt;&lt;p class="codeline1"&gt;EMAIL VARCHAR(256) NOT NULL&lt;/p&gt;&lt;p&gt;);&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Naming Conventions consist of both a Lexical Component and a Semantic Component. In this post we have focused on the lexical aspects of naming, from the intension definition above we focused on the &lt;b&gt;&lt;i&gt;signifier&lt;/i&gt;&lt;/b&gt; and the &lt;b&gt;&lt;i&gt;referent&lt;/i&gt;&lt;/b&gt;. To really create a comprehensive approach the Semantic aspect cannot be ignored. In the intension definition above this can be viewed as focusing on the &lt;b&gt;&lt;i&gt;signified&lt;/i&gt;&lt;/b&gt; and the &lt;b&gt;&lt;i&gt;referent&lt;/i&gt;&lt;/b&gt;. This is an area that is explored in the idea of the &lt;b&gt;&lt;i&gt;&lt;a href="http://domaindrivendesign.org/node/132"&gt;Ubiquitous Language&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; within the realm of  Domain Driven Design.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The Semantic Elements of a system and of a naming convention are more complex and ambiguous. I do think that software systems should have a &lt;b&gt;&lt;i&gt;System Lexicon&lt;/i&gt;&lt;/b&gt; which would be a more concrete formalization and extension of the &lt;b&gt;&lt;i&gt;System’s&lt;/i&gt;&lt;/b&gt; &lt;b&gt;&lt;i&gt;Vocabulary&lt;/i&gt;&lt;/b&gt; or &lt;b&gt;&lt;i&gt;Ubiquitous Language&lt;/i&gt;&lt;/b&gt; this would also incorporate ideas encapsulated in a &lt;a href="http://en.wikipedia.org/wiki/Data_dictionary"&gt;Data Dictionary&lt;/a&gt;.  A &lt;b&gt;&lt;i&gt;System Lexicon&lt;/i&gt;&lt;/b&gt; would be an entity of some complexity and would require some commitment to build also applying it could be problematic and might require tooling such as an &lt;a href="http://en.wikipedia.org/wiki/Integrated_development_environment"&gt;IDE&lt;/a&gt; interactive name suggestion feature or a &lt;a href="http://en.wikipedia.org/wiki/Static_program_analysis"&gt;static analysis&lt;/a&gt; component or both. It might even require an ontology or taxonomy oriented graphical tool for constructing and maintaining the &lt;b&gt;&lt;i&gt;System Lexicon&lt;/i&gt;&lt;/b&gt; depending on the size and complexity of the system.  I will get into some ideas that extend the lexical aspects and move into the Semantic aspects in future posts.  I know that this might seem pretty grandiose but I think this powerful stuff that could lead to better approaches to create higher quality software.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt;This list is biased to Java Web development, but these ideas should be general enough to span any software system.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-7096643175336703846?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/h1Ya-BNNxu0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/h1Ya-BNNxu0/more-thoughts-on-formal-approaches-to.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-4uF4DFKqu3U/T29K3M7GjCI/AAAAAAAAAfE/ONxHweH_BdM/s72-c/Io_Full.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/03/more-thoughts-on-formal-approaches-to.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-1047415023341078841</guid><pubDate>Tue, 20 Mar 2012 00:23:00 +0000</pubDate><atom:updated>2012-05-13T15:08:34.904-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Naming</category><category domain="http://www.blogger.com/atom/ns#">Domain Driven Design</category><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><category domain="http://www.blogger.com/atom/ns#">Software Frameworks</category><category domain="http://www.blogger.com/atom/ns#">Linguistics</category><title>A Survey of the Conventional Wisdom on Software Naming</title><description>&lt;h2&gt;On the Importance of Naming in Software Systems, Part I&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-k5vc99jNIPE/T2fLgRwkKbI/AAAAAAAAAe4/ldVVQ8KfR0c/s1600/P50142.1.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="338" width="400" src="http://3.bp.blogspot.com/-k5vc99jNIPE/T2fLgRwkKbI/AAAAAAAAAe4/ldVVQ8KfR0c/s400/P50142.1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}

blockquote.paraphrase {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}


div.source-code1 {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px dashed #999999;
    line-height       : 10px;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
}

div.source-code {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px dashed #999999;
    line-height       : 14px;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
    margin-top        : 8px;
    margin-bottom     : 8px;
}

p.codeline {

    padding: 0px;
    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    color:black;
}

p.codeline1 {

    padding: 0px;
    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    text-indent:.5in;
    color:black;
}

p.codeline2 {

    padding: 0px;
    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    text-indent:1in;
    color:black;
}

p.codeline3 {

    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    text-indent:1.5in;
    color:black;
}

&lt;/style&gt;&lt;!--A Survey of the Conventional Wisdom on Software Naming--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Naming is a very important aspect of software, however, its importance and relevance to building quality software is often overlooked or ignored all together.  I feel that naming needs to be part of a larger more formal framework for building software.  In &lt;a href="http://www.elegantcoding.com/2011/03/what-does-your-framework-look-like.html"&gt;previous posts&lt;/a&gt; I have advocated a framework approach to capturing reuse and standardizing software design and implementation and I feel that naming is a crucial part of such an approach. Previously I included the following quote about naming in an &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html#Names"&gt;API design talk by Joshua Bloch&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Names matter a lot, there are some people that think that names don’t matter and when you sit down and say well this isn’t named right, they say don’t waste your time let’s just move on, it’s good enough. No! Names, in an API, that are going to be used by anyone else that includes yourself in a few months mater an awful lot. The idea is that every API is kind of a little language and people who are going to use your API needs to learn that language and then speak in that language and that means that names should be self explanatory, you should avoid cryptic abbreviations so the original Unix names, I think, fail this one miserably.&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;He is not the only prominent software engineer to advocate an attention to naming, in this post I will summarize and discuss several sources.  I will start with his material which is part of his talk on API design which I summarized in my &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html"&gt;previous post&lt;/a&gt;.  Actually I feel that most if not all of what he says on API design is applicable to software in general including what he has to say on naming. The summary points are as follows:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="paraphrase"&gt;&lt;p&gt;Names should be self explanatory.&lt;/p&gt;&lt;p&gt;Avoid cryptic abbreviations.&lt;/p&gt;&lt;p&gt;Don’t have multiple words meaning that same thing.&lt;/p&gt;&lt;p&gt;Names should be consistent – same word means same thing.&lt;/p&gt;&lt;p&gt;Be regular–strive for symmetry. This implies a larger context of naming and a relationship between concepts.&lt;/p&gt;&lt;p&gt;Code should read like prose. (As a result of good API design)&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;Chapter two titled "Meaningful Names" of Robert Martin’s &lt;u&gt;Clean Code&lt;/u&gt;, written by Tim Ottinger, is dedicated to naming. A summary of the advice is as follows:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="paraphrase"&gt;&lt;p&gt;Use Intention Revealing names&lt;/p&gt;&lt;p&gt;Avoid Disinformation – This is a corollary to Use Intention Revealing names. This means that the components of the name actually conceptually match the intent.&lt;/p&gt;&lt;p&gt;Make Meaningful Distinctions – This means Pick One Word per Concept.&lt;/p&gt;&lt;p&gt;Use Pronounceable Names. This means Avoid cryptic abbreviations.&lt;/p&gt;&lt;p&gt;Use Searchable Names. This is mainly about not using single character names and magic constants.&lt;/p&gt;&lt;p&gt;Avoid Encodings. This means do not use suffixes or prefixes to encode type or status as a member "m_".  He also discourages using "I" as a prefix to an interface. This includes avoiding Hungarian Notation.&lt;/p&gt;&lt;p&gt;Avoid Mental Mapping. This is an anti pattern. It is a corollary to Use Intention Revealing Names.&lt;/p&gt;&lt;p&gt;Class Names should consist of nouns of verb Phrases.&lt;/p&gt;&lt;p&gt;Method Names should consist of verbs or verb Phrases.&lt;/p&gt;&lt;p&gt;Pick One Word per Concept. &lt;/p&gt;&lt;p&gt;Use Solution Domain Names. Solution domain names refer to things like design patterns or more distinct concepts such as Queue or Binary Tree&lt;/p&gt;&lt;p&gt;Use Problem Domain Names – This is pretty straight forward, if your system processes medical records, you might expect a class called MedicalRecord.&lt;/p&gt;&lt;p&gt;Add Meaningful Context – This deals with the idea of adding suffixes or prefixes to denote additional context information in the name.  The example given is use addrState vs. state.&lt;/p&gt;&lt;p&gt;Don’t Add Gratuitous Context – This talks about the idea of adding unnecessary or too specific suffixes or prefixes to denote context.&lt;/p&gt;&lt;p&gt;Choosing good names requires good descriptive Skills and Shared cultural background&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;Steve McConnell’s &lt;u&gt;Code Complete&lt;/u&gt; contains the following advice&lt;sup&gt;1&lt;/sup&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="paraphrase"&gt;&lt;p&gt;A name should fully and accurately describe what the variable represents.&lt;/p&gt;&lt;p&gt;A good mnemonic name generally speaks to the problem rather than the solution. A good name tends to express the what more than the how. In general, if a name refers to some aspect of computing rather than to the problem, it's a how rather than a what. Avoid such a name in favor of a name that refers to the problem itself.&lt;/p&gt;&lt;p&gt;Use pronounceable names.&lt;/p&gt;&lt;p&gt;Avoid misleading names or abbreviations and use consistent abbreviations.&lt;/p&gt;&lt;p&gt;Avoid names that are misleading.&lt;/p&gt;&lt;p&gt;Avoid names with similar meanings.&lt;/p&gt;&lt;p&gt;Avoid variables with different meanings but similar names&lt;/p&gt;&lt;p&gt;Name Specific Types of Data using Standardized Prefixes – Use prefixes to denote (encode) type such as Hungarian Notation.&lt;/p&gt;&lt;p&gt;Use computed-value qualifiers if needed at the end of the name. Examples are: Total, Sum, Average, Max, Min, Record, String, or Pointer.&lt;/p&gt;&lt;p&gt;Use a Naming Convention and that naming convention should be compatible standard conventions for the language.   Naming convention should distinguish among local, class, and global data.  Naming convention should distinguish among type names, named constants, enumerated types, and ­variables.&lt;/p&gt;&lt;p&gt;Good variable names are a key element of program readability. Specific kinds of variables such as loop indexes and status variables require specific considerations.&lt;/p&gt;&lt;p&gt;Names should be as specific as possible. Names that are vague enough or general enough to be used for more than one purpose are usually bad names.&lt;/p&gt;&lt;p&gt;Naming conventions distinguish among local, class, and global data. They distinguish among type names, named constants, enumerated types, and variables.&lt;/p&gt;&lt;p&gt;Abbreviations are rarely needed with modern programming languages. If you do use abbreviations, keep track of abbreviations in a project dictionary or use the standardized prefixes approach.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;I did reword some of these to make them more stand alone. You may want to pursue the sources to gain a fuller picture of each author’s perspective.  The interesting thing here is while there are several key common themes to these approaches there are some very explicit contradictions. For example &lt;u&gt;Clean Code&lt;/u&gt; recommends against Type encoding like Hungarian Notation while &lt;u&gt;Code Complete&lt;/u&gt; recommends it.  Conversely &lt;u&gt;Code Complete&lt;/u&gt; seems to implicitly recommend against using Solution Domain Names "speaks to the problem rather than the solution" whereas &lt;u&gt;Clean Code&lt;/u&gt; advocates their use.&lt;/p&gt;&lt;p&gt;I feel that when talking about naming it is easy to conflate ideas pertaining to structural (lexical) concerns and ideas pertaining to domain (semantic) concerns.  Unfortunately while these ideas are separate they are also intertwined and an intelligent approach to naming needs to recognize this.  &lt;/p&gt;&lt;p&gt;One structural theme is the idea of qualifiers, which &lt;u&gt;Code Complete&lt;/u&gt; explicitly names, but the idea appears implicitly in &lt;u&gt;Clean Code&lt;/u&gt; as well.  Qualifiers in this context are generally prefixes and suffixes that qualify the name. Qualifiers mentioned above include &lt;i&gt;scope qualifiers&lt;/i&gt; which denote the scope of a variable such as the prefixes "m_" for member or "global_" for global. &lt;a href="http://en.wikipedia.org/wiki/Hungarian_notation"&gt;Hungarian Notation&lt;/a&gt; in this context&lt;sup&gt;2&lt;/sup&gt; is an example of a type qualifier. Additionally &lt;u&gt;Code Complete&lt;/u&gt; defines &lt;i&gt;computed-value qualifier&lt;/i&gt; suffixes to denote values which are computed values these include: Total, Sum, Average, Max, Min, Record, String, or Pointer.  Interestingly qualifiers are a structural element of a name which denotes additional specific types of semantic meaning to the name. The structural and semantic construction of names is a topic I intend to continue exploring in subsequent posts.&lt;/p&gt;&lt;p&gt;The previous ideas address both structural (lexical) and domain (semantic) concerns now I wish to look at a targeted summary of more semantic oriented conceptual advice in Eric Evan’s &lt;u&gt;Domain Driven Design&lt;/u&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="paraphrase"&gt;&lt;p&gt;Domain model terms are part the UBIQUITOUS LANGUAGE.&lt;/p&gt;&lt;p&gt;In regards to an INTENTION-REVEALING INTERFACE, name classes and operations to describe their effect and purpose without reference to the means by which they do what they promise. This relieves the client developer of the need to understand the internals. These names should conform to the UBIQUITOUS LANGUAGE so that team members can quickly infer their meaning.&lt;/p&gt;&lt;p&gt;In regards to MODULES aka Packages, If your model is telling a story your MODULES are chapters. The name of the MODULE conveys its meaning.  These names enter the UBIQUITOUS LANGUAGE.&lt;/p&gt;&lt;p&gt;Name each BOUNDED CONTEXT and make the names part of the UBIQUITOUS LANGUAGE.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;In &lt;u&gt;Domain Driven Design&lt;/u&gt; the idea of conceptually developing and implementing the Domain iteratively is explored.  This book reveals many approaches and concepts pertaining to that topic, the ideas that I am interested in which are targeted in the quotes above pertain to naming.  A common theme in naming which would be hard to dispute is to Use Problem Domain Names. The idea of a &lt;i&gt;UBIQUITOUS LANGUAGE is &lt;/i&gt;promoted in the book as a way to help define the domain so that all stakeholders have a common way to talk about the domain and its representation in the resulting software.  &lt;u&gt;Domain Driven Design&lt;/u&gt; promotes using the &lt;i&gt;UBIQUITOUS LANGUAGE&lt;/i&gt; as a theme to defining the system and unifying the system documentation.  To me a &lt;i&gt;UBIQUITOUS LANGUAGE&lt;/i&gt; implies the need to track, define and attempt to codify it over time which I think implies a more formal way to document it like a lexicon is needed, an idea I will follow up on more in a future post.&lt;/p&gt;&lt;p&gt;Another issue with talking about software naming is the idea of context.  Names pretty much always exist in a context, in Java a variable can be in the context of a method or a class. Both methods and classes themselves can exist in the context of classes and classes exist in the context of classes and packages and packages are themselves hierarchical. In fact software systems have developed the concept of Namespace to in part deal with this problem.  &lt;/p&gt;&lt;p&gt;Each name exists in a context, and in order to talk about naming we need a language just as you need to define a language for a domain. Actually naming is a domain, a meta-domain perhaps, a domain that describes other domains.  This means we need a "&lt;i&gt;UBIQUITOUS LANGUAGE&lt;/i&gt;" for the domain of naming. So in that language I am going to define &lt;a name="OLE_LINK2"&gt;&lt;/a&gt;&lt;a name="OLE_LINK1"&gt;&lt;b&gt;&lt;i&gt;name scope context&lt;/i&gt;&lt;/b&gt;&lt;/a&gt; to define to context or "hierarchical place" in which a name occurs. I am purposefully not using namespace since that has other explicit meanings.  I know using the words scope and context seem redundant but I felt using "scope" alone didn’t work because it has a &lt;a href="http://en.wikipedia.org/wiki/Scope_(computer_science)"&gt;specific meaning&lt;/a&gt; and context by itself was too vague, using &lt;b&gt;&lt;i&gt;name scope context&lt;/i&gt;&lt;/b&gt; can refer to a broader set of circumstances such as an attribute’s position in an xml document relative to its parent element or a SQL Column name relative to its parent table, a file’s directory and so on.&lt;/p&gt;&lt;p&gt;An interesting thing I have noticed about &lt;b&gt;&lt;i&gt;name scope context&lt;/i&gt;&lt;/b&gt; is that it can be redundant.  For example let’s assume that we have an object named a database table named PERSON and a corresponding object named Person.  I have seen the following approach to naming these:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;CREATE TABLE PERSON (&lt;/p&gt;&lt;p&gt;    PERSON_ID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,&lt;/p&gt;&lt;p&gt;    LAST_NAME VARCHAR(40) NULL,&lt;/p&gt;&lt;p&gt;    FIRST_NAME VARCHAR(20) NULL,&lt;/p&gt;&lt;p&gt;    MIDDLE VARCHAR(20) NULL,&lt;/p&gt;&lt;p&gt;    PHONE VARCHAR(20) NULL,&lt;/p&gt;&lt;p&gt;    EMAIL VARCHAR(256) NOT NULL,&lt;/p&gt;&lt;p&gt;    DELETED CHAR(1) NOT NULL DEFAULT 'N',&lt;/p&gt;&lt;p&gt;    CREATE_DATE TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,&lt;/p&gt;&lt;p&gt;    MODIFY_DATE TIMESTAMP NULL&lt;/p&gt;&lt;p&gt;)&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;class Person {&lt;/p&gt;&lt;p&gt;    private int personId;&lt;/p&gt;&lt;p&gt;    private String lastName;&lt;/p&gt;&lt;p&gt;    private String firstName;&lt;/p&gt;&lt;p&gt;    private String middle;&lt;/p&gt;&lt;p&gt;    private String phone;&lt;/p&gt;&lt;p&gt;    private String email;&lt;/p&gt;&lt;p&gt;    private boolean deleted;&lt;/p&gt;&lt;p&gt;    private Date createDate;&lt;/p&gt;&lt;p&gt;    private Date modifyDate;&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Now in these examples the database table PERSON contains the column named PERSON_ID and the class Person contains the corresponding field named personId.  In both of these cases ID or id respectively would be probably be better as the use of person is repeating the name used within the &lt;b&gt;&lt;i&gt;name scope context&lt;/i&gt;&lt;/b&gt; of the member variable.  The down side of this type of non-duplication is the loss of the ability to search for the names, which I think implies that software name search probably needs more sophisticated mechanisms over that of simple text searching, another idea I will expand on in the future.&lt;/p&gt;&lt;p&gt;This is my first post on naming, I have three more planned and I will get into more ideas some of which come from linguistics. I feel that &lt;u&gt;Domain Driven Design&lt;/u&gt; gets into a number of linguistic and linguistic oriented concepts, maybe what we are going for here is &lt;i&gt;Semantic Driven Design&lt;/i&gt;, but that would be just another &lt;a href="http://www.elegantcoding.com/2011/05/driven-development.html"&gt;YADD&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; &lt;u&gt;Code Complete&lt;/u&gt; provides a lot of ideas here are few more:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="paraphrase"&gt;&lt;p&gt;The name should long enough that you don't have to puzzle it out.&lt;/p&gt;&lt;p&gt;Avoid misspelled words in names.&lt;/p&gt;&lt;p&gt;Avoid words that are commonly misspelled.&lt;/p&gt;&lt;p&gt;Don't differentiate variable names solely by capitalization.&lt;/p&gt;&lt;p&gt;Creating Short Names That Are Readable. These are guidelines for shortening names when you need to, so this is a special case not a general one.  I know I have run into this with Oracle 11g’s 30 Char limit.&lt;/p&gt;&lt;p&gt;Avoid unnecessary abbreviations.&lt;/p&gt;&lt;p&gt;Avoid multiple natural languages.&lt;/p&gt;&lt;p&gt;Avoid names that could be misread or mispronounced.&lt;/p&gt;&lt;p&gt;Avoid names that are different by only one or two characters.&lt;/p&gt;&lt;p&gt;Avoid names that sound similar.&lt;/p&gt;&lt;p&gt;Avoid names that conflict with standard library routine names or with predefined variable names.&lt;/p&gt;&lt;p&gt;Format names for readability.&lt;/p&gt;&lt;p&gt;Avoid excessively long names.&lt;/p&gt;&lt;p&gt;Code is read far more times than it is written. Be sure that the names you choose favor read-time convenience over write-time convenience.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;2&lt;/sup&gt; This use of Hungarian notation is apparently not how it was intended to be used see "&lt;a href="http://www.joelonsoftware.com/articles/Wrong.html"&gt;Making Wrong Code Look Wrong&lt;/a&gt;".&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-1047415023341078841?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/vYSHkd-jPis" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/vYSHkd-jPis/survey-of-conventional-wisdom-on.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-k5vc99jNIPE/T2fLgRwkKbI/AAAAAAAAAe4/ldVVQ8KfR0c/s72-c/P50142.1.jpg" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/03/survey-of-conventional-wisdom-on.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-606133454334061962</guid><pubDate>Sun, 11 Mar 2012 20:11:00 +0000</pubDate><atom:updated>2012-05-06T11:55:09.019-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Topology</category><category domain="http://www.blogger.com/atom/ns#">Fractal Geometry</category><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Editing</category><title>Are you sure that you are editing in two dimensions?</title><description>&lt;br /&gt;
&lt;h3&gt;Editing the Positive Orthant and The Topology of Text Editing&lt;/h3&gt;&lt;br /&gt;
&lt;style&gt;

div.source-code {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px dashed #999999;
    line-height       : 14px;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
    margin-top        : 8px;
    margin-bottom     : 8px;
}
&lt;/style&gt;&lt;!--Are you sure that you are editing in two dimensions?--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-M_ynDcrUTjU/T1vjX6UQBRI/AAAAAAAAAco/WbEd2K14tn4/s1600/elegantcoding.com.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="250" width="250" src="http://1.bp.blogspot.com/-M_ynDcrUTjU/T1vjX6UQBRI/AAAAAAAAAco/WbEd2K14tn4/s400/elegantcoding.com.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;In my &lt;a href="http://www.elegantcoding.com/2011/04/typing-vs-editor-kung-fu.html"&gt;previous post on editing&lt;/a&gt; I mentioned column cutting and pasting, a powerful feature that many programmers I have worked with don’t use or even know about.  I started thinking about it in terms of math and seemed to me that this creates a dimensional difference between the standard &lt;a href="http://en.wikipedia.org/wiki/Eclipse_IDE"&gt;Eclipse Editor&lt;/a&gt; and the editor that I use.  My observation is that the standard Eclipse Editor only lets you edit in one dimension, of course such a statement might seem absurd but I think it’s true and to explain it I am going to take a little tour of the concept of dimension.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;From what I understand the idea of &lt;a href="http://en.wikipedia.org/wiki/Dimension"&gt;Dimension&lt;/a&gt; is not completely cut and dry and comes in a variety of forms, most people only know of or think of Spatial Dimension of the &lt;a href="http://en.wikipedia.org/wiki/Cartesian_coordinate_system"&gt;Cartesian Coordinate System&lt;/a&gt; in &lt;a href="http://en.wikipedia.org/wiki/Euclidean_space"&gt;Euclidean Space&lt;/a&gt; for example the screen on which your editor is displayed.  But dimension both comes in many other flavors and allows the representation of so many things.  For example Dimensions can be in the form of Fractal Dimension, Hausdorff Dimension, Topological aka Lebesgue Covering Dimension, and the list goes on.&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-aBChs-fnaL8/T1viOp_OoOI/AAAAAAAAAcc/i0bEwHzmagY/s1600/Toroidal_coord.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://2.bp.blogspot.com/-aBChs-fnaL8/T1viOp_OoOI/AAAAAAAAAcc/i0bEwHzmagY/s400/Toroidal_coord.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Another deceptive property of Dimension comes from the topological concept of &lt;a href="http://en.wikipedia.org/wiki/Surface"&gt;surfaces&lt;/a&gt; or more generally &lt;a href="http://en.wikipedia.org/wiki/Topological_manifold"&gt;Manifolds&lt;/a&gt;.  An interesting example of this is the older video game &lt;a href="http://en.wikipedia.org/wiki/Asteroids_(video_game)"&gt;Asteroids&lt;/a&gt; or any game where you move from the bottom edge to reappear on the top edge of the screen or from top to bottom of the screen, the same applies to the left to right &lt;a href="http://en.wikipedia.org/wiki/Wraparound_(video_games)"&gt;wrapping&lt;/a&gt; motion.  You are actually moving as shown above around on the surface of a &lt;a href="http://en.wikipedia.org/wiki/Torus"&gt;torus&lt;/a&gt; along the two different axes shown in red and blue.  This idea can extend to higher dimensions, imagine, instead of a square video game screen, a cube where each face was connected to the opposite face (3 connections), if you moved in any direction, in three dimensions, far enough you would always end up at the same place, actually the universe could have this shape, I am not saying that it does though, interestingly there is a &lt;a href="http://www.brianschrank.com/videogames.htm"&gt;three dimensional version of asteroids&lt;/a&gt;.  This cube torus is known as a 3-torus&lt;sup&gt;&amp;dagger;&lt;/sup&gt; which is one many 3 manifolds (three dimensional manifolds). Manifolds are a higher dimensional topological generalization of surfaces like spheres and tori.  In the case of the torus and 3-torus&lt;sup&gt;&amp;dagger;&lt;/sup&gt;, you need to step up to a higher dimension to really see the structure that you are in.&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-mlem0SgeRMU/T1vjeB0rZ2I/AAAAAAAAAc0/Wxi9TsscrbU/s1600/500px-Cartesian_coordinates_2D_svg.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="371" width="400" src="http://1.bp.blogspot.com/-mlem0SgeRMU/T1vjeB0rZ2I/AAAAAAAAAc0/Wxi9TsscrbU/s400/500px-Cartesian_coordinates_2D_svg.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Ok so some of these ideas may seem a little broad and not necessarily directly relevant but they really are and they are interesting and give a larger picture of the complexity of the idea of dimension so bear with me.  The next important and hopefully more obviously relevant idea is the concept of an &lt;a href="http://en.wikipedia.org/wiki/Orthant"&gt;Orthant&lt;/a&gt; or n-hyperoctant, these are just fancy and more general terms for a concept you probably already know.  An Orthant is the division of space around the origin, so in two dimensions there are four orthants also known as Quadrants or 2-hyperoctants.   The simplest case is two rays forming two 1-dimensional orthants, one positive and one negative.  The number of orthants grows by powers of 2, i.e. 2&lt;sup&gt;n&lt;/sup&gt;, so one dimension (line) has 2&lt;sup&gt;1&lt;/sup&gt;= 2, two dimensions (plane) has 2&lt;sup&gt;2&lt;/sup&gt;= 4, three (space): 2&lt;sup&gt;3&lt;/sup&gt;= 8 and so on.  Each orthant has all combinations of positive and negative coordinates a set that will be of size 2&lt;sup&gt;n&lt;/sup&gt;, so one dimension has {(+),(-)}, two dimensions has {(+,+),(-,+),(+,-),(-,-)},  and so on,  each dimension will have exactly one orthant that has only positive coordinates and exactly one orthant that has only negative coordinates.&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-6sRKv4Pk6e8/T1vkCYncA2I/AAAAAAAAAdA/t32a-1k746k/s1600/orth-edit.1.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="369" src="http://3.bp.blogspot.com/-6sRKv4Pk6e8/T1vkCYncA2I/AAAAAAAAAdA/t32a-1k746k/s400/orth-edit.1.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The orthant concept is very relevant to text editing, when you edit you are working in a two dimensional Euclidean space, and you are working in the Positive Quadrant (Orthant).  When you edit, you start with line one, column one and count up to the right and down, this is actually a reflection around the x-axis of the traditional plane with the positive y to the left or counter clockwise from the x axis which is the way one usually represents a Cartesian plane.  Also we are working strictly with positive non-zero integer positions so our space is (n,n) &amp;isin; (N x N)  n &amp;isin; N &amp;gt; 0 the positive quadrant of the two dimensional integer plane.&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-T7R5vOGQOzs/T1vk5LC1qzI/AAAAAAAAAdM/c2NKHbyQy7M/s1600/362px-KochFlake_svg.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="362" width="362" src="http://3.bp.blogspot.com/-T7R5vOGQOzs/T1vk5LC1qzI/AAAAAAAAAdM/c2NKHbyQy7M/s400/362px-KochFlake_svg.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;At this point, if you are still with me, you might be saying: “Aha, you just demonstrated that editing is two dimensional”, but I’m not done yet and I want to take a small digression into &lt;a href="http://en.wikipedia.org/wiki/Fractal_geometry"&gt;Fractal Geometry&lt;/a&gt; first. The &lt;a href="http://en.wikipedia.org/wiki/Koch_curve"&gt;Koch or Snowflake curve&lt;/a&gt; shown above has a &lt;a href="http://en.wikipedia.org/wiki/Fractal_dimension"&gt;Fractal Dimension&lt;/a&gt; of log(4)/log(3) =log&lt;sub&gt;3&lt;/sub&gt;4= 1.2619.  But its &lt;a href="http://en.wikipedia.org/wiki/Lebesgue_covering_dimension"&gt;Topological Dimension&lt;/a&gt; is 1 since it is a one dimensional &lt;a href="http://en.wikipedia.org/wiki/Continuous_function" title="Continuous function"&gt;continuous&lt;/a&gt; everywhere but &lt;a href="http://en.wikipedia.org/wiki/Differentiable_function" title="Differentiable function"&gt;differentiable&lt;/a&gt; nowhere curve.   In Topology you can stretch and bend things so imagine the curve is made of string and you pick it up and it loses its shape.  You can then lay it down as a circle which is a one dimensional curve, a 1-torus&lt;sup&gt;&amp;dagger;&lt;/sup&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The Koch Curve can be created using a &lt;a href="http://en.wikipedia.org/wiki/L-system"&gt;Fractal L-System&lt;/a&gt;. The important thing to realize here is that Fractal L-Systems have a strong similarity to the &lt;a href="http://en.wikipedia.org/wiki/Chomsky_hierarchy"&gt;Chomsky Hierarchy&lt;/a&gt;, now there are some substantial differences between the two &lt;a href="http://en.wikipedia.org/wiki/Rewriting_system"&gt;rewriting systems&lt;/a&gt;, but I will focus only on one of the similarities here. The Koch Curve can be defined by the following &lt;a href="http://en.wikipedia.org/wiki/Koch_snowflake#Representation_as_Lindenmayer_system"&gt;L-System&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;Alphabet&amp;nbsp;: F&lt;/p&gt;&lt;p&gt;Constants&amp;nbsp;: +, &amp;#8722;&lt;/p&gt;&lt;p&gt;Axiom&amp;nbsp;: F++F++F&lt;/p&gt;&lt;p&gt;Production rules:&lt;/p&gt;&lt;p&gt;F &amp;#8594; F&amp;#8722;F++F&amp;#8722;F&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Here, F means &amp;quot;draw forward&amp;quot;, + means &amp;quot;turn right 60°&amp;quot;, and &amp;#8722; means &amp;quot;turn left 60°&amp;quot; (see &lt;a href="http://en.wikipedia.org/wiki/Turtle_graphics" title="Turtle graphics"&gt;turtle graphics&lt;/a&gt;).&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The first four iterations, which correspond to the images above are:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;F++F++F&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;F-F++F-F++F-F++F-F++F-F++F-F&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F-F-F++F-F-F-F++F-F++F-F++F-F-F-F++F-F&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Each iteration results in a new longer more complex one [topological] dimensional strand of characters.  The striking similarity here is that much as an L-System will give you a one dimensional strand of characters a &lt;a href="http://en.wikipedia.org/wiki/Context_Free_Grammar"&gt;Context Free Grammar&lt;/a&gt; which will describe most programming languages will give you a similar one dimensional “strand” of terminal symbols which would be &lt;a href="http://en.wikipedia.org/wiki/Lexical_analysis"&gt;lexemes&lt;/a&gt; corresponding to a linear sequence of programming language statements.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;In the asteroids example we are looking at two dimensional screen that is really a two dimensional surface on a three dimensional torus, here we are looking at one dimensional strand represented on a two dimensional screen and this is the key observation that ties all of this together and shows the nuances of these ideas.  One dimensional editing is when you are editing on the &lt;i&gt;positive ray&lt;/i&gt;, &lt;i&gt;1-hyperoctant&lt;/i&gt;, cursor movement follows the strand in one dimension, in both directions along the strand, and cutting will cut one dimensional strands and only allow them to and pasted into any single position within the strand.  The default behavior of the Eclipse editor offers one dimensional editing. Now let’s compare these specific operations to another editor which allows two dimensional movement and cutting and pasting.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;Cursor Movement&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;The first example shows the how the cursor behaves at the end of the line in Eclipse. In the following image the cursor is at the end of line 21, which is a coordinate of (21,37) as shown at the bottom of the image:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-MpeAEdOUu3E/T1vlDRryMPI/AAAAAAAAAdY/DDL-9Iu0VvQ/s1600/Cursor1.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="312" width="400" src="http://1.bp.blogspot.com/-MpeAEdOUu3E/T1vlDRryMPI/AAAAAAAAAdY/DDL-9Iu0VvQ/s400/Cursor1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Hitting the right arrow to move cursor right by one, moves you to the beginning of the next line, coordinate (22,1) as shown below:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-hyhx4bevYm4/T1vlIwbYLlI/AAAAAAAAAdk/npIc3xBOTw4/s1600/cursor2.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="311" width="400" src="http://1.bp.blogspot.com/-hyhx4bevYm4/T1vlIwbYLlI/AAAAAAAAAdk/npIc3xBOTw4/s400/cursor2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;This movement is along the one dimensional stand of the code itself, not the plane.  The confusing thing here is that we are looking at the text in two dimensions and using two dimensional coordinates to describe it, the next example will make it clearer.  Here is the same image from a different editor that supports two dimensional operations:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-iZleP88hbuE/T1vlODZsD2I/AAAAAAAAAdw/6TZ4bO_2hfM/s1600/Cursor3.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="265" width="400" src="http://2.bp.blogspot.com/-iZleP88hbuE/T1vlODZsD2I/AAAAAAAAAdw/6TZ4bO_2hfM/s400/Cursor3.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-kfZ2L0CLHvY/T1vlS9ZGKTI/AAAAAAAAAd8/1aN_VVIV1oc/s1600/Cursor4.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="268" width="400" src="http://3.bp.blogspot.com/-kfZ2L0CLHvY/T1vlS9ZGKTI/AAAAAAAAAd8/1aN_VVIV1oc/s400/Cursor4.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;This example shows two dimensional cursor behavior at the end of line 21, which is a coordinate of (21,37) as shown at the bottom of the image, hitting the right arrow to move cursor right by one, moves you right by one position to coordinate (21,38) as shown above.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;Cutting and Pasting&lt;/h3&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-k7JT476WRGg/T1vlnOPy2ZI/AAAAAAAAAeI/dUroS_io1f0/s1600/CutPaste1.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="336" width="400" src="http://4.bp.blogspot.com/-k7JT476WRGg/T1vlnOPy2ZI/AAAAAAAAAeI/dUroS_io1f0/s400/CutPaste1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The one dimensional line cut:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-_dD61eHi-bw/T1vnQv0w4aI/AAAAAAAAAeU/mV_nAgRBAB8/s1600/CutPaste2.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="333" width="400" src="http://4.bp.blogspot.com/-_dD61eHi-bw/T1vnQv0w4aI/AAAAAAAAAeU/mV_nAgRBAB8/s400/CutPaste2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Two dimensional cutting and pasting:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-W4xKnC66DlM/T1vnV6QWAwI/AAAAAAAAAeg/QNWXpCdRwdU/s1600/CutPaste3.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="265" width="400" src="http://3.bp.blogspot.com/-W4xKnC66DlM/T1vnV6QWAwI/AAAAAAAAAeg/QNWXpCdRwdU/s400/CutPaste3.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;In both cases above we are selecting blocks of text with starting coordinate (21,12) to ending coordinate (26,18) however the Eclipse version (top) only allows the selection of a one dimensional strand of text, as you move in either direction you will only be able to grab complete lines between the start and end coordinates and if you paste this text you will be inserting a one dimensional strand into a single position in another one dimensional strand.  The two dimensional operation offers more flexibility beyond the only the one dimensional operation, actually the editor offers both one and two dimensional cutting, which is what you really want in an editor.  The resulting cuts are as follows, now admittedly the two dimensional cut in this case is not really practical.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The two dimensional column cut:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-2ELvHhJlOjI/T1vnhuY-FmI/AAAAAAAAAes/yz_nOIi_LCU/s1600/CutPaste4.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="268" width="400" src="http://2.bp.blogspot.com/-2ELvHhJlOjI/T1vnhuY-FmI/AAAAAAAAAes/yz_nOIi_LCU/s400/CutPaste4.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Hopefully this give a sense of the difference from editing on a one dimensional ray vs. a two dimensional plane.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;If we revisit the one dimensional strand of characters idea, we notice a problem.  While the strand is one dimensional in that the position of each character can be given by a single integer index into the string, which is a single axis or ray.  Each position can have a different value. In our fractal each position could contain one of three characters {F,+,-} which we could map to {0,1,2} respectively.  Now each iteration of the L-System production generates a number in base three and each position can have one of three “pixels” in the strand. Now we need another dimension, or at least part of one, to represent this additional information.  A more practical example would be a 24 bit RGB image where each pixel has a position, remember this can be stored as a single one dimensional strand of pixels but displayed in two dimensions by cutting up the strand into rows.  Similarly a program can be “pixilated” where each pixel could be an ascii character (byte), a lexical token or lexeme, or a binary zero or one bit along the one dimensional strand.  The length of the strand would vary in accordance to height of the pixels a binary pixel representation/strand would have more positions than an ascii pixel representation/strand than would the lexeme pixel representation/strand.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Ok this is probably my zaniest post about my crazy ideas which I am pretty sure are correct. Hopefully I did a decent job explaining these ideas, I find them to be quite mind blowing, at least that's the way I felt when I first understood the basic ideas about topology and manifolds, and there is still so much I don't know.  Also if you feel that you both have a better understanding of some of these ideas and at the same time feel more confused about them, I think that might be normal and I think a big part of learning math is just getting used to feeling that way all of the time, because the more you learn the stronger both of these feelings become, at least that's my experience.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;&amp;dagger;&lt;/sup&gt;An n-torus can mean either an n-dimensional torus or a two dimensional toriodal surface with n holes. In this post it always means n-dimensional torus.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-606133454334061962?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/uk-Fn7oT6u0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/uk-Fn7oT6u0/are-you-sure-that-you-are-editing-in.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-M_ynDcrUTjU/T1vjX6UQBRI/AAAAAAAAAco/WbEd2K14tn4/s72-c/elegantcoding.com.png" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/03/are-you-sure-that-you-are-editing-in.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-5972540536999418974</guid><pubDate>Tue, 06 Mar 2012 03:12:00 +0000</pubDate><atom:updated>2012-05-06T11:57:13.045-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Design Patterns</category><category domain="http://www.blogger.com/atom/ns#">API Design</category><category domain="http://www.blogger.com/atom/ns#">Combinatorics</category><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><title>The Software Design Debate and the Futility of Opinion</title><description>&lt;br /&gt;
&lt;h2&gt;A Tale of Two Classes&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-psyxaFKWwjk/T1VxijBhRWI/AAAAAAAAAcE/isRT6luvL8g/s1600/IMG_2026.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://3.bp.blogspot.com/-psyxaFKWwjk/T1VxijBhRWI/AAAAAAAAAcE/isRT6luvL8g/s400/IMG_2026.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}

div.source-code1 {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px dashed #999999;
    line-height       : 10px;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
}

div.source-code {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px dashed #999999;
    line-height       : 14px;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
    margin-top        : 8px;
    margin-bottom     : 8px;
}

p.codeline {

    padding: 0px;
    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    color:black;
}

p.codeline1 {

    padding: 0px;
    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    text-indent:.5in;
    color:black;
}

p.codeline2 {

    padding: 0px;
    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    text-indent:1in;
    color:black;
}

p.codeline3 {

    margin-top:0in;
    margin-bottom:0in;
    margin-bottom:.0001pt;
    line-height: 12px;
    font-size:10.0pt;
    font-family:"Courier New";
    text-indent:1.5in;
    color:black;
}

td.comb-left {
    padding : 10px;
    text-align : center;
    background-color : #ffffff;
    color : black;
    border : 1px solid black;
    vertical-align : center;
}


td.comb {
    padding : 10px;
    text-align : left;
    background-color: #ffffff;
    color:black;
    border : 1px solid black;
    vertical-align : center;
}


&lt;/style&gt;&lt;!--The Software Design Debate and the Futility of Opinion: A Tale of Two Classes --&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;A while back when I was at a previous contract this &lt;a href="http://blogs.atlassian.com/2011/05/exceptions_are_bad/"&gt;article&lt;/a&gt; showed up on various link sites and one of the architects at that company sent it out. As a result, another developer and I, with the help of a googled code snippet, came up with the following code and added it to the common library:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p class="codeline"&gt;&lt;b&gt;public&lt;/b&gt; &lt;b&gt;class&lt;/b&gt; ServiceResponse &amp;lt;ERROR &lt;b&gt;extends&lt;/b&gt; ErrorReturn,&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;VALUE &lt;b&gt;extends&lt;/b&gt; ValueReturn&amp;gt; {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;private&lt;/b&gt; ServiceResponse() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;public&lt;/b&gt; ERROR error() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;return&lt;/b&gt; &lt;b&gt;null&lt;/b&gt;;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;public&lt;/b&gt; VALUE value() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;return&lt;/b&gt; &lt;b&gt;null&lt;/b&gt;;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;public final static class&lt;/b&gt; Error&amp;lt;ERROR &lt;b&gt;extends&lt;/b&gt; ErrorReturn&amp;gt;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;&lt;b&gt;extends&lt;/b&gt; ServiceResponse&amp;lt;ERROR, ValueReturn&amp;gt; {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;private&lt;/b&gt; &lt;b&gt;final&lt;/b&gt; ERROR error;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;public&lt;/b&gt; Error(ERROR error) {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;&lt;b&gt;this&lt;/b&gt;.error = error;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;public&lt;/b&gt; ERROR error() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;&lt;b&gt;return&lt;/b&gt; error;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;public&lt;/b&gt; &lt;b&gt;boolean&lt;/b&gt; isError() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;&lt;b&gt;return&lt;/b&gt; &lt;b&gt;true&lt;/b&gt;;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;public final static class&lt;/b&gt; Value&amp;lt;VALUE &lt;b&gt;extends&lt;/b&gt; ValueReturn&amp;gt;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;&lt;b&gt;extends&lt;/b&gt; ServiceResponse&amp;lt;ErrorReturn, VALUE&amp;gt; {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;private&lt;/b&gt; &lt;b&gt;final&lt;/b&gt; VALUE value;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;public&lt;/b&gt; Value(VALUE value) {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;&lt;b&gt;this&lt;/b&gt;.value = value;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;public&lt;/b&gt; VALUE value() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;&lt;b&gt;return&lt;/b&gt; value;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;public&lt;/b&gt; &lt;b&gt;boolean&lt;/b&gt; isError() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;&lt;b&gt;return&lt;/b&gt; &lt;b&gt;false&lt;/b&gt;;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;To be fair the original code was not documented, like this snippet, and there were a few other things that were a little less elegant but not hugely so, also all code here has been changed as not to infringe on intellectual property and to ensure anonymity.  As a result of the architecture and project schedule the other developer who needed the class ended not using it and also due to the aggressive project schedule there was no other follow up such as finishing the documentation or writing tests, this was partially my fault.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;A few months later the architect needed this class and discovered our implementation he rewrote it as follows:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p class="codeline"&gt;&lt;b&gt;public&lt;/b&gt; &lt;b&gt;class&lt;/b&gt; ServiceResponse&amp;lt;ERROR &lt;b&gt;extends&lt;/b&gt; ErrorReturn,&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;VALUE &lt;b&gt;extends&lt;/b&gt; ValueReturn&amp;gt; {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;private&lt;/b&gt; ERROR error;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;private&lt;/b&gt; VALUE value;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;private&lt;/b&gt; &lt;b&gt;boolean&lt;/b&gt; isError;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;public&lt;/b&gt; ServiceResponse(ERROR error, VALUE value,&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline3"&gt;&lt;b&gt;boolean&lt;/b&gt; isError) {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;this&lt;/b&gt;.value = value;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;this&lt;/b&gt;.error = error;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;this&lt;/b&gt;.isError = isError;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;public&lt;/b&gt; ERROR error() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;return&lt;/b&gt; &lt;b&gt;this&lt;/b&gt;.error;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;public&lt;/b&gt; VALUE value() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;return&lt;/b&gt; &lt;b&gt;this&lt;/b&gt;.value;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;&lt;b&gt;public&lt;/b&gt; &lt;b&gt;boolean&lt;/b&gt; isError() {&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline2"&gt;&lt;b&gt;return&lt;/b&gt; isError;&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline1"&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline"&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Upon committing it he sent out an email to announce that he felt the original code was too complicated and he had simplified it to the above code.  I responded explaining that I felt that there were some issues with the instantiation of his new implementation and the real issue here was the lack of documentation.  I was shocked by his response in which he stuck to his argument that the new class was simpler to implement and didn’t require a lot of thought and we just need a wrapper class.  I confess I was initially perturbed by this as I felt that he was both wrong and taking a cargo cult attitude which was atypical for him, I later found out that he had been suffering through a bad cold.  Since I knew I would soon be leaving the project, I left it there even though I was pretty sure that his new design was significantly worse than the original.   I am intentionally omitting the details of the debate because I want to explore these in more detail momentarily.  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Throughout my career I have all too often found myself in these types of debates, and the thing I find so frustrating about it is the lack of real ways to accurately analyze these types of situations and the lack of any formal structure to the arguments themselves, they frequently become as constructive as a political or religious debate.  So it got me thinking, these are two pretty simple classes, how can we constructively analyze this situation and perhaps establish dispassionately and objectively which solution is better and what opportunities can this exploration present in a larger context?&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;First let’s look at the problem in the context of the current prominent thinking, let’s start with &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html#ApiDesign"&gt;Joshua Bloch’s API ideas&lt;/a&gt;, which I have and will continue to reference.  Now remember the class in question is part of an API so these points are very relevant.  One point he makes is that an &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html#Characteristics"&gt;API&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;ul type=disc&gt;&lt;li&gt;&lt;i&gt;Easy to use, even without documentation &lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;i&gt;Hard to misuse &lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;So let’s assume that we have the following two classes and references:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;ErrorReturn error;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;ValueReturn value;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The original design has the two correct ways of creating it, omitting for the moment creating each with null:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p class="codeline"&gt;&lt;b&gt;new&lt;/b&gt; ServiceResponse.Error&amp;lt;ErrorReturn&amp;gt;(error);&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline"&gt;&lt;b&gt;new&lt;/b&gt; ServiceResponse.Value&amp;lt;ValueReturn&amp;gt;(value);&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The new design has the following correct instantiations:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p class="codeline"&gt;&lt;b&gt;new&lt;/b&gt; ServiceResponse&amp;lt;ErrorReturn, ValueReturn&amp;gt;(error, &lt;b&gt;null&lt;/b&gt;, &lt;b&gt;false&lt;/b&gt;);&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline"&gt;&lt;b&gt;new&lt;/b&gt; ServiceResponse&amp;lt;ErrorReturn, ValueReturn&amp;gt;(&lt;b&gt;null&lt;/b&gt;, value, &lt;b&gt;true&lt;/b&gt;);&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Also it is pretty obvious that the new design opens up several other ways that this object can be created.  It seems that new design more easily allows value and error to be mixed up.  The new design puts the responsibility of setting the Boolean isError on the user which opens it up to possibly being set incorrectly.  This breaks the &lt;i&gt;hard to misuse&lt;/i&gt; rule.  In the old design it is an artificial value that created by a &lt;a href="http://en.wikipedia.org/wiki/Pure_function"&gt;pure function&lt;/a&gt;.   So from the API design perspective it seems that the original design is better.  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now another piece of conventional wisdom is the minimizing the number of parameters, in Clean Code Bob Martin talks about how you really shouldn’t have more than three parameters, well both instantiations fall under that, but by this logic is not the old design with one parameter then preferable to the new design with three?  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Another possible pro argument for the original design is the use of the "&lt;a href="http://en.wikipedia.org/wiki/Disjoint_union"&gt;Disjoint Union&lt;/a&gt;" &lt;a href="http://www.scala-lang.org/api/current/scala/Either.html"&gt;Either pattern&lt;/a&gt;, now this is not a &lt;a href="http://en.wikipedia.org/wiki/Design_Patterns"&gt;GOF pattern&lt;/a&gt; but it is a pattern, perhaps an even more mathematical pattern, but regardless it is a specific pattern with precedence.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;So that’s three pro arguments for the original design based on the current conventional software design wisdom promulgated by the leading software engineers of the field. So the original design is probably better.  Unfortunately I have found that even these arguments can be thwarted by the most recalcitrant &lt;a href="http://www.elegantcoding.com/2011/10/confederacy-of-cargo-cult-coders.html"&gt;cargo cult coder&lt;/a&gt; who doesn’t read and will always invoke arguments like "it’s too complex, it’s too abstract". &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;So I started to think, how could one look at this situation more analytically?  Going back to Joshua Blocks API talk, at some point and I don’t have this documented anywhere, he makes reference to an &lt;i&gt;object’s state space&lt;/i&gt;, but he doesn’t go into detail about the concept.  This got me thinking, in this case we could pretty easily enumerate, at least at high level, the state space for each object and then compare them.  I am not sure if this is a known technique, I wouldn’t be surprised if someone has thought of or done this before.  In this case I am going to refer to this as "Enumerative Object State Space Analysis" or just "Object State Space Analysis" for lack of a better name.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;So for this exercise we will interest ourselves in the possible values of a value or null for each parameter, where the error value is an instance of ErrorReturn and the value parameter is an instance of ValueReturn or true or false for the Boolean parameters, this is the following sets: {&amp;lt;Error&amp;gt;, null}, {&amp;lt;Value&amp;gt;, null}, and {true, false}.  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;For the old design the possible instantiations are:&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p class="codeline"&gt;&lt;b&gt;new&lt;/b&gt; ServiceResponse.Error&amp;lt;ErrorReturn&amp;gt;(error);&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline"&gt;&lt;b&gt;new&lt;/b&gt; ServiceResponse.Value&amp;lt;ValueReturn&amp;gt;(value);&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline"&gt;&lt;b&gt;new&lt;/b&gt; ServiceResponse.Error&amp;lt;ErrorReturn&amp;gt;(&lt;b&gt;null&lt;/b&gt;);&lt;/p&gt;&lt;br /&gt;
&lt;p class="codeline"&gt;&lt;b&gt;new&lt;/b&gt; ServiceResponse.Value&amp;lt;ValueReturn&amp;gt;(&lt;b&gt;null&lt;/b&gt;);&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;There are 2 possible Error instantiations and 2 possible Value instantiations leading to an object state space of 2 + 2 = 4 possible states, this is an application of the &lt;a href="http://en.wikipedia.org/wiki/Rule_of_sum"&gt;Sum Rule&lt;/a&gt;.  The new class has 2 possible values per constructor parameter, similarly from the &lt;a href="http://en.wikipedia.org/wiki/Rule_of_product"&gt;Product Rule&lt;/a&gt; of &lt;a href="http://en.wikipedia.org/wiki/Combinatorics"&gt;combinatorics&lt;/a&gt; we can calculate that this leads to 2*2*2 = 8 possible states in the object state space. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;We can enumerate (list them out) the states for the original class as follows:&lt;/p&gt;&lt;br /&gt;
&lt;table class=MsoTableGrid border="1" cellspacing="0" cellpadding="0" &gt;&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;Object State&lt;/td&gt;     &lt;td class="comb-left" width="120"&gt;Comment&lt;/td&gt;     &lt;td class="comb-left"&gt;Correctness Status&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{Value, false}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return state for successful operation &lt;/td&gt;     &lt;td class="comb"&gt;Correct intended state&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{Error, true}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return state for operation with an error.&lt;/td&gt;     &lt;td class="comb"&gt;Correct intended state&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{null, false}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return for a successful operation with no return value&lt;/td&gt;     &lt;td class="comb"&gt;State is a side effect of design, allows null, could be correct or   could be considered a degenerate state.&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{null, true}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return for an operation with an error with no information &lt;/td&gt;     &lt;td class="comb"&gt;State is a side effect of design, allows null, could be correct or   could be considered a degenerate state.&lt;/td&gt; &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;p&gt;We can enumerate the states for the new class as follows:&lt;/p&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;Object State&lt;/td&gt;     &lt;td class="comb-left" width="120"&gt;Comment&lt;/td&gt;     &lt;td class="comb-left"&gt;Correctness Status&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{null, Value, false}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return state for successful operation&lt;/td&gt;     &lt;td class="comb"&gt;Correct intended state&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{Error, null, true}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return state for operation with an error.&lt;/td&gt;     &lt;td class="comb"&gt;Correct intended state&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{null, null, false}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return for a successful operation with no return value&lt;/td&gt;     &lt;td class="comb"&gt;State is a side effect of design, allows null, could be correct or could be considered a degenerate state.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{null, null, true}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return for an operation with an error with no information&lt;/td&gt;     &lt;td class="comb"&gt;State is a side effect of design, allows null, could be correct or could be considered a degenerate state.&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{Error, Value, false}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return state for successful operation&lt;/td&gt;     &lt;td class="comb"&gt;State is correct from a usage standpoint but ambiguous from a programmer maintenance standpoint is this what was intended or is it reversed?&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{Error, Value, true}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Return state for operation with an error.&lt;/td&gt;     &lt;td class="comb"&gt;State is correct from a usage standpoint but ambiguous from a programmer maintenance standpoint is this what was intended or is it reversed?&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{null, Value, true}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Incorrect Usage&lt;/td&gt;     &lt;td class="comb"&gt;This is incorrect but the design allows this state to exist.&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td class="comb-left" width="120"&gt;{Error, null, false}&lt;/td&gt;     &lt;td class="comb" width="120"&gt;Incorrect Usage&lt;/td&gt;     &lt;td class="comb"&gt;This is incorrect but the design allows this state to exist.&lt;/td&gt; &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Assuming a &lt;a href="http://en.wikipedia.org/wiki/Uniform_distribution_(discrete)"&gt;uniform distribution&lt;/a&gt; the probability for each state in the original class is 25% and 12.5% in the new class, this means that the first design has 50% correct states and 50% null states.  The new design has 25% correct states, 25% null states, 25% ambiguous states, and 25% incorrect states. Of course a uniform distribution would probably not be the case as the correct usage would always be more likely and the incorrect usage would be the most unlikely.  Still, based on this analysis I am inclined to further conclude that the original design is better, perhaps even definitively so as the old design has no incorrect states and the expanded state space, which is twice as large, exponentially larger, also increases the complexity.  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Another possibility would be to eliminate the setting of the Boolean flag on the new design and allow it to be determined by a pure function as in the original design, but that opens up problems with respect to the ambiguous states that would exist.  In reflecting I also realized that the one of ambiguous states of the new design allow a state {Error, Value, false} which might be construed as success with information, which leads me to think that both designs are lacking and it might be better to always return an object that contains the value and some type of status object that allows error or success with info.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now I know this is a lot and I am probably over thinking this, but I am treating this as an experiment:  Is it possible to come up with more analytical approaches using &lt;a href="http://en.wikipedia.org/wiki/Enumeration"&gt;Enumerative&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Combinatorics"&gt;Combinatorial&lt;/a&gt; techniques to guide object design or other aspects of software design in a practical way?&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-5972540536999418974?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/_iz_xV6YEe8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/_iz_xV6YEe8/software-design-debate-and-futility-of.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-psyxaFKWwjk/T1VxijBhRWI/AAAAAAAAAcE/isRT6luvL8g/s72-c/IMG_2026.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/03/software-design-debate-and-futility-of.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-2049190464708718480</guid><pubDate>Sat, 25 Feb 2012 17:57:00 +0000</pubDate><atom:updated>2012-05-06T12:01:13.666-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Agile</category><category domain="http://www.blogger.com/atom/ns#">Fibonacci</category><title>Fibonacci: The Math of Agile</title><description>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-W-cZFF01YC0/T0kZnP7vd3I/AAAAAAAAAYs/p8AmOAizakY/s1600/fib-spiral.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="225" width="400" src="http://3.bp.blogspot.com/-W-cZFF01YC0/T0kZnP7vd3I/AAAAAAAAAYs/p8AmOAizakY/s400/fib-spiral.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--Fibonacci: The Math of Agile--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Planning_poker"&gt;Agile planning poker&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt; uses the &lt;a href="http://en.wikipedia.org/wiki/Fibonacci_sequence"&gt;Fibonacci sequence&lt;/a&gt; or in some cases a bastardized version of it.  I do not know the exact reason that the series was chosen, I do know the intent is that there is a standard set of numbers and using these deters the player from the temptation of using false precision, like a value of 10.5 for example.  Also it captures growth so each next number is a "unit" of growth larger than the last.  I suspect that the sequence of powers of two (1,2,4,8,16,32,64...) would also work, and might be more apropos to the computer industry, but these two sequences are similar in that they both increase by a constant factor, each subsequent power of two is two times larger and in the Fibonacci sequence each term is roughly 1.618... larger than the previous term, also each has a closed form exponential formula for each term 2&lt;sup&gt;n&lt;/sup&gt; or for Fibonacci sequence it's Binet’s Formula, see below.   I don’t know if the Fibonacci sequence is the right way to go, but it seems to work and it is fairly prevalent in nature and art so it’s probably not a bad choice.  I confess that while this in one of my math of programming series, I am using it primarily as an excuse to write a post about some interesting results relating to the Fibonacci sequence and the &lt;a href="http://en.wikipedia.org/wiki/Golden_ratio"&gt;Golden Mean&lt;/a&gt;, so if you are only interested in Agile you may want to treat this as a short post and stop here, but I encourage you to read on, the math is mostly high school level and it really is interesting. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The Fibonacci sequence is generally attributed to a man, &lt;a href="http://en.wikipedia.org/wiki/Leonardo_of_Pisa"&gt;Leonardo Pisano Bigollo&lt;/a&gt; who went by Fibonacci and did not actually discover the sequence, it was known about five hundred years earlier in the tenth century by &lt;a href="http://en.wikipedia.org/wiki/Pingala"&gt;Pingala&lt;/a&gt; and it was probably known much earlier.  Ironically Fibonacci’s greatest mathematical contribution was the introduction of &lt;a href="http://en.wikipedia.org/wiki/Hindu-Arabic_numeral_system"&gt;Hindu-Arabic Numeral System&lt;/a&gt; to Europe, just imagine trying to do multiplication and fractions with &lt;a href="http://en.wikipedia.org/wiki/Roman_numerals"&gt;Roman numerals&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The Fibonacci sequence is what is known as a &lt;a href="http://en.wikipedia.org/wiki/Recurrence_relation"&gt;recurrence relation&lt;/a&gt; or &lt;a href="http://mathworld.wolfram.com/RecursiveSequence.html"&gt;recursive sequence&lt;/a&gt; each term is defined as the sum of the two previous terms where the first two terms, which are the generator or seed values F&lt;sub&gt;0&lt;/sub&gt; = 0 and F&lt;sub&gt;1&lt;/sub&gt; = 1, the formula is:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-_20YNn17BXE/T0kaFzH9JHI/AAAAAAAAAZE/WsHIqG5xmBg/s1600/fib-def.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="14" width="133" src="http://4.bp.blogspot.com/-_20YNn17BXE/T0kaFzH9JHI/AAAAAAAAAZE/WsHIqG5xmBg/s400/fib-def.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;It can alternatively be written as:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Z2VODUo3RR0/T0kZra1PzFI/AAAAAAAAAY4/c8HofRG87dM/s1600/fib-def2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="16" width="133" src="http://4.bp.blogspot.com/-Z2VODUo3RR0/T0kZra1PzFI/AAAAAAAAAY4/c8HofRG87dM/s400/fib-def2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;This form will be more useful to us in a moment.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The &lt;a href="http://oeis.org/A000045"&gt;sequence&lt;/a&gt; is:&lt;/p&gt;&lt;p&gt;0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393,...&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The Fibonacci sequence has a very interesting relation with a very interesting number known as the Golden Mean which is sometimes referred to as phi and has the following value:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-suT9IGtPkOA/T0kasr8V19I/AAAAAAAAAZQ/usrbbD3PdLo/s1600/phi.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="37" width="85" src="http://3.bp.blogspot.com/-suT9IGtPkOA/T0kasr8V19I/AAAAAAAAAZQ/usrbbD3PdLo/s400/phi.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;An irrational number that is approximately: 1.6180339887498948482045868343656...&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The ratio of a Fibonacci number divided by the previous number in the sequence eventually converges to phi, the first few ratios are:&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;table border="0"&gt;&lt;tr&gt;&lt;td align="left"&gt;3/2   &lt;/td&gt;&lt;td align="left"&gt;=&lt;/td&gt;&lt;td align="left"&gt; 1.5&lt;/td&gt;
&lt;tr&gt;
&lt;tr&gt;&lt;td align="left"&gt;5/3   &lt;/td&gt;&lt;td align="left"&gt;=&lt;/td&gt;&lt;td align="left"&gt; 1.666666...&lt;/td&gt;
&lt;tr&gt;
&lt;tr&gt;&lt;td align="left"&gt;8/5   &lt;/td&gt;&lt;td align="left"&gt;=&lt;/td&gt;&lt;td align="left"&gt; 1.6&lt;/td&gt;
&lt;tr&gt;
&lt;tr&gt;&lt;td align="left"&gt;13/8  &lt;/td&gt;&lt;td align="left"&gt;=&lt;/td&gt;&lt;td align="left"&gt; 1.625&lt;/td&gt;
&lt;tr&gt;
&lt;tr&gt;&lt;td align="left"&gt;21/13 &lt;/td&gt;&lt;td align="left"&gt;=&lt;/td&gt;&lt;td align="left"&gt; 1.615384...&lt;/td&gt;
&lt;tr&gt;
&lt;tr&gt;&lt;td align="left"&gt;34/21 &lt;/td&gt;&lt;td align="left"&gt;=&lt;/td&gt;&lt;td align="left"&gt; 1.619047...&lt;/td&gt;
&lt;tr&gt;
&lt;tr&gt;&lt;td align="left"&gt;55/34 &lt;/td&gt;&lt;td align="left"&gt;=&lt;/td&gt;&lt;td align="left"&gt; 1.617647...&lt;/td&gt;
&lt;tr&gt;
&lt;tr&gt;&lt;td align="left"&gt;89/55 &lt;/td&gt;&lt;td align="left"&gt;=&lt;/td&gt;&lt;td align="left"&gt; 1.6181818...&lt;/td&gt;
&lt;tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;As you can see it is already heading there.  It is interesting that a ratio which is in the set of &lt;a href="http://en.wikipedia.org/wiki/Rational_number"&gt;rational numbers&lt;/a&gt; converges to an &lt;a href="http://en.wikipedia.org/wiki/Algebraic_number"&gt;algebraic&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Irrational_number"&gt;irrational number&lt;/a&gt;. The following equation describes this relationship, the Limit of consecutive quotients:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-zTuGsUR3xcw/T0ka5L3cE4I/AAAAAAAAAZc/Ch5LrnA_rz0/s1600/fib-lim1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="37" width="109" src="http://4.bp.blogspot.com/-zTuGsUR3xcw/T0ka5L3cE4I/AAAAAAAAAZc/Ch5LrnA_rz0/s400/fib-lim1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Additionally the following is true:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-r_AELtA7pQo/T0ka-HrC45I/AAAAAAAAAZo/SMQwA6CpJAk/s1600/fib-lim2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="38" width="111" src="http://2.bp.blogspot.com/-r_AELtA7pQo/T0ka-HrC45I/AAAAAAAAAZo/SMQwA6CpJAk/s400/fib-lim2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;If we take the following formula:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Z2VODUo3RR0/T0kZra1PzFI/AAAAAAAAAY4/c8HofRG87dM/s1600/fib-def2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="16" width="133" src="http://4.bp.blogspot.com/-Z2VODUo3RR0/T0kZra1PzFI/AAAAAAAAAY4/c8HofRG87dM/s400/fib-def2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;And divide it by F&lt;sub&gt;n&lt;/sub&gt; we get:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-aOl13y2GKEs/T0kbOHbUNOI/AAAAAAAAAZ0/qTdmS30GkcE/s1600/fib-def-div.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="37" width="129" src="http://4.bp.blogspot.com/-aOl13y2GKEs/T0kbOHbUNOI/AAAAAAAAAZ0/qTdmS30GkcE/s400/fib-def-div.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;We then take the limit as n goes to infinity, replacing the terms using the two limit equations from above:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/--N_v3WS-kc8/T0kbUEMaUxI/AAAAAAAAAaA/v3x8fcKHUvw/s1600/phi-eq1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="38" width="73" src="http://2.bp.blogspot.com/--N_v3WS-kc8/T0kbUEMaUxI/AAAAAAAAAaA/v3x8fcKHUvw/s400/phi-eq1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;And if we multiply by phi:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/--apja114bak/T0kbZEUQMtI/AAAAAAAAAaM/m9Sg6TtM5a8/s1600/phi-eq2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="19" width="77" src="http://4.bp.blogspot.com/--apja114bak/T0kbZEUQMtI/AAAAAAAAAaM/m9Sg6TtM5a8/s400/phi-eq2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Solving for zero gives us:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-b8nfbtVILpM/T0kbeVJkRvI/AAAAAAAAAaY/zRxwRW3yihQ/s1600/phi-eq3.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="19" width="106" src="http://1.bp.blogspot.com/-b8nfbtVILpM/T0kbeVJkRvI/AAAAAAAAAaY/zRxwRW3yihQ/s400/phi-eq3.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Using the &lt;a href="http://en.wikipedia.org/wiki/Quadratic_equation"&gt;quadratic equation&lt;/a&gt; we get the following two roots (conjugates):&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-wEps557o4Mg/T0kbmAFwuRI/AAAAAAAAAak/t0mzi4BuqVU/s1600/phi-tau.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="37" width="85" src="http://4.bp.blogspot.com/-wEps557o4Mg/T0kbmAFwuRI/AAAAAAAAAak/t0mzi4BuqVU/s400/phi-tau.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;This is phi and its &lt;a href="http://en.wikipedia.org/wiki/Conjugate_(algebra)"&gt;conjugate&lt;/a&gt;, which we will call tau:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-CXkE6gkNJWU/T0kbvUXENjI/AAAAAAAAAaw/gkYhIAz2yI4/s1600/phi.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="37" width="85" src="http://1.bp.blogspot.com/-CXkE6gkNJWU/T0kbvUXENjI/AAAAAAAAAaw/gkYhIAz2yI4/s400/phi.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-wYskU2oLWWk/T0kbyybCF5I/AAAAAAAAAa8/5fxJZhoO5Io/s1600/tau.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="37" width="85" src="http://1.bp.blogspot.com/-wYskU2oLWWk/T0kbyybCF5I/AAAAAAAAAa8/5fxJZhoO5Io/s400/tau.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Now that we have defined phi and tau we can describe Binet’s formula, mentioned above, which is an exponential form closed formula:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-tiztJpnrrqg/T0kb_PXG0tI/AAAAAAAAAbI/0C9fzP-0fDY/s1600/binet-fib-closed.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="39" width="102" src="http://2.bp.blogspot.com/-tiztJpnrrqg/T0kb_PXG0tI/AAAAAAAAAbI/0C9fzP-0fDY/s400/binet-fib-closed.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Binet’s formula is an easy way to compute Fibonacci Sequence values without having to calculate all of the values prior to the value you wish to calculate.  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Additionally there is an interesting matrix based calculation:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-5CORx5WcNfc/T0kcFAnX7KI/AAAAAAAAAbU/X8DK2vEzsaU/s1600/fib-mat.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="43" width="215" src="http://3.bp.blogspot.com/-5CORx5WcNfc/T0kcFAnX7KI/AAAAAAAAAbU/X8DK2vEzsaU/s400/fib-mat.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The above matrix raised to the nth power gives the above matrix of Fibonacci numbers, the first few are:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-rUUstxmJTMQ/T0kcJCI8rfI/AAAAAAAAAbg/X9BMbWcEgtE/s1600/fib-mat-ex.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="191" width="156" src="http://4.bp.blogspot.com/-rUUstxmJTMQ/T0kcJCI8rfI/AAAAAAAAAbg/X9BMbWcEgtE/s400/fib-mat-ex.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The &lt;a href="http://en.wikipedia.org/wiki/Determinant"&gt;determinant&lt;/a&gt; of this matrix is (-1)&lt;sup&gt;n&lt;/sup&gt; which is described by &lt;a href="http://en.wikipedia.org/wiki/Cassini%27s_identity"&gt;Cassini’s Identity&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-J2rdut_M7PI/T0kdbOW2YCI/AAAAAAAAAb4/zgHb5CPrszg/s1600/Cassinis%2Bidentity.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="19" width="196" src="http://2.bp.blogspot.com/-J2rdut_M7PI/T0kdbOW2YCI/AAAAAAAAAb4/zgHb5CPrszg/s400/Cassinis%2Bidentity.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The Fibonacci sequence and the Golden mean have many interesting identities and relationships with other mathematical disciplines and natural phenomena, for example there is the famous relation rabbit breeding, it relates to bee ancestry, the packing of seeds in flowers, and other plant growth proportions. The Fibonacci sequence occurs in the shallow diagonals of &lt;a href="http://en.wikipedia.org/wiki/Pascal's_triangle"&gt;Pascal’s Triangle&lt;/a&gt;, it relates to &lt;a href="http://mathworld.wolfram.com/PythagoreanTriple.html"&gt;Pythagorean Triples&lt;/a&gt;. It relates to the similar &lt;a href="http://en.wikipedia.org/wiki/Lucas_number"&gt;Lucas Sequence &lt;/a&gt;, the Fibonacci Spiral form above which is a &lt;a href="http://en.wikipedia.org/wiki/Logarithmic_spiral"&gt;Logarithmic Spiral&lt;/a&gt; and the list goes on, a lot of this can be found on the previously linked &lt;a href="http://en.wikipedia.org/wiki/Fibonacci_number"&gt;Wikipedia Page&lt;/a&gt; and this &lt;a href="http://www.bbc.co.uk/programmes/b008ct2j"&gt;BBC radio program&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; &lt;a href="http://renaissancesoftware.net/papers/14-papers/44-planing-poker.html"&gt;http://renaissancesoftware.net/papers/14-papers/44-planing-poker.html&lt;/a&gt;&lt;br /&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-2049190464708718480?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/UZVFTXhu_j4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/UZVFTXhu_j4/fibonacci-math-of-agile.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-W-cZFF01YC0/T0kZnP7vd3I/AAAAAAAAAYs/p8AmOAizakY/s72-c/fib-spiral.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/02/fibonacci-math-of-agile.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-8017777834717373551</guid><pubDate>Mon, 20 Feb 2012 18:39:00 +0000</pubDate><atom:updated>2012-05-06T12:16:28.045-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Rant</category><category domain="http://www.blogger.com/atom/ns#">Software Development Teams</category><title>Is your Team LCD (Lowest Common Denominator)?</title><description>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-8yAfoFilLNY/T0KS7-O3RJI/AAAAAAAAAYI/aMA3BMLiP8E/s1600/calder.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="280" src="http://3.bp.blogspot.com/-8yAfoFilLNY/T0KS7-O3RJI/AAAAAAAAAYI/aMA3BMLiP8E/s400/calder.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--Is your Team LCD (Lowest Common Denominator)?--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;On some of my previous projects I have felt that the teams became severely dysfunctional and as a result they cater to the lowest common denominator of the team.  This was often a result of a lack of both technical and overall leadership.  In these cases schisms formed in the team I was usually at the center of one side advocating good design practices, a high degree of control and a framework approach to reuse.  I should add here that while I am very passionate about trying to build quality software and I try to be as egoless as possible.  Sadly my &lt;i&gt;opponents&lt;/i&gt; in these situations were the &lt;a href="http://www.elegantcoding.com/2011/10/confederacy-of-cargo-cult-coders.html"&gt;type of programmers&lt;/a&gt; that did not read and in some cases they were woefully ignorant of basic software design concepts like the &lt;a href="http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)"&gt;Solid principles&lt;/a&gt; and &lt;a href="http://sourcemaking.com/design_patterns"&gt;design patterns&lt;/a&gt;.  In one case we had several “senior” java developers who didn’t understand &lt;a href="http://en.wikipedia.org/wiki/Generics_in_Java"&gt;generics&lt;/a&gt; or even &lt;a href="http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)"&gt;inheritance&lt;/a&gt;, that situation really bordered on the absurd.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;In these situations I have often felt that these developers were essentially being very selfish, in some cases it was that the developers wanted a wild west chaotic approach to software development so there were no constraints and they were free to tinker with new libraries and frameworks, what I like to call &lt;a href="http://www.elegantcoding.com/2011/05/driven-development.html#RDD"&gt;Resume Driven Development&lt;/a&gt;. In other cases it was that they didn’t want to have to learn anything new or challenging, and in some cases it seemed to be pure ego driven stubbornness or inferiority complex driven compensatory behavior.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Regardless of the causes of the dysfunctional nature of the team it always resulted in the dominance of the Lowest common denominator, this can applies to technical level as well professional/maturity level, often it’s both.  The lack of leadership and a fractured team often had negative effects on morale especially for the better developers.  It often created an environment that produced suboptimal architecture and code.  Consensus was often impossible to achieve and code duplication was rampant sometimes deliberate.  Naturally code reviews were either not conducted or if they were they were done in a perfunctory way so that any feedback was completely disregarded.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The worst part of the LCD team is the lack of ability to have open objective criticism.  Criticism is hard to take but anyone engaging in any activity, especially a creative one, in which they wish to improve can greatly benefit from it, this is described in detail in a &lt;a href="http://rob.by/2011/responding-to-criticism/"&gt;great essay by Bobby Grossman&lt;/a&gt;.  To parallel that essay we had one person on the team who if you even hinted at being critical he immediately became super defensive.  He was a terrible programmer and will probably never improve.  To engineer a good system you need to have a constructive and positive way to deal with mistakes that occur in code, architecture and process. Discordance on the team causes mistakes to be viewed as validation of an opposing viewpoint.  It’s an extremely counterproductive and demoralizing environment.  It leads to less communication as many people will avoid the conflict, and in one case I felt that I had achieved a level of fatigue and I just stopped caring, I bailed shortly after.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The LCD team illustrates why so many software projects have problems, in the above case the project failed after I left, in part due to the dysfunctional nature of the team.  My goal here is not harp on the negative but to use this as &lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/Negative_space"&gt;negative space&lt;/a&gt;&lt;/i&gt; for what you really want.  The opposite of this is a team that aspires to be great and to be more than the sum of its parts. I know it sounds like a cliché but I really believe a good team is one were the stronger developers help the weaker and less experienced developers become better because everyone wants to.  You want a team that can openly discuss and criticize aspects of the system and discover and fix mistakes early.  I think this can happen with a team of professionals who can put their ego aside to do good work and a strong leader who trusts their team and leads with fairness and wisdom and who is open to hearing input from the team but willing to make firm decisions.   Human nature in most cases probably precludes such a utopian software team, I think the goal here is to optimize and aspire to it.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-8017777834717373551?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/9hsPJos5rE4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/9hsPJos5rE4/is-your-team-lcd-lowest-common.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-8yAfoFilLNY/T0KS7-O3RJI/AAAAAAAAAYI/aMA3BMLiP8E/s72-c/calder.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/02/is-your-team-lcd-lowest-common.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-7134691662677050483</guid><pubDate>Sun, 05 Feb 2012 22:42:00 +0000</pubDate><atom:updated>2012-05-06T12:03:03.394-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Complexity</category><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><category domain="http://www.blogger.com/atom/ns#">Code Reuse</category><category domain="http://www.blogger.com/atom/ns#">Information Entropy</category><title>The Software Reuse Complexity Curve</title><description>&lt;!--The Software Reuse Complexity Curve--&gt;&lt;p&gt;I have come to the conclusion that Complexity and Reuse have a nonlinear relationship that has a parabolic shape, shown below, Complexity increases on the Y axis and reuse increases on the X axis.  Code complexity is high both with very low reuse and very high reuse forming a &lt;a href="http://en.wikipedia.org/wiki/Maxima_and_minima"&gt;minima&lt;/a&gt; which might be viewed as an &lt;a href="http://en.wikipedia.org/wiki/Mathematical_optimization"&gt;optimization&lt;/a&gt; point for reusability, now remember this is a very simple two dimensional graph, a real optimization scenario for this type of problem may include many dimensions and probably would not have a nice clearly defined single minima.&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-nS0Po1Jlg98/Ty7mj9aD3uI/AAAAAAAAAX8/tzP0816pMoo/s1600/reuse-curve.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="400" src="http://3.bp.blogspot.com/-nS0Po1Jlg98/Ty7mj9aD3uI/AAAAAAAAAX8/tzP0816pMoo/s400/reuse-curve.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Scenario #1 Low Reuse&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;In a low reuse situation everything that could have been implemented using reusability is duplicated and may also be implemented inconsistently, so the code base will be larger which would require a maintainer to learn and know more code, also since there will be variations of varying degree between the similar components the maintainer would have to be constantly aware of these differences, which might be subtle, one might even find them confusing at times. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;As we have previously seen reuse relates to &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html"&gt;entropy&lt;/a&gt;, so a low reuse system would have a large random, “uncompressed” codebase, which has high entropy, I have seen this type of system in my career and it is something I hate to work on. &lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;Skill vs. Complexity&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;Before I go to the opposite end of the spectrum, which is probably more interesting, and perhaps more speculative on my part, I’d like to talk about the relationship of code complexity to maintainer developer skill.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I believe, and this really shouldn’t be a stretch, that there are some types of complex code that require certain higher level proficiencies and theoretical knowledge, an obvious choice is parsers and compiler construction.  A developer who works in this area needs to have a good understanding of a number disciplines, which include but are not limited to: &lt;a href="http://en.wikipedia.org/wiki/Formal_language"&gt;Formal Language Theory&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Automata_theory"&gt;Automata Theory&lt;/a&gt; and possibly some Abstract Algebra, which sadly many developers lack.  If you had a project that had components that are any type of compiler or parser and needed someone to create and subsequently work on the maintenance of the code, they would need to know these things, they would need to understand this complexity in an organized theoretical way.  The alternative would be an ad hoc approach to solving these problems which would probably yield significant complexity issues of its own.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;These types of things can be seen at simpler scale, a system that makes use of state machines or heavy use of regular expressions will exhibit more compact and more complex code.  The maintainers have to have a skill level to deal with this more complex approach, sadly not all &lt;a href="http://www.elegantcoding.com/2011/10/confederacy-of-cargo-cult-coders.html"&gt;developers&lt;/a&gt; do.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now you can probably find numerous code bases where these types of approaches and others were not used where they should have been, these codebases will be larger and will require a case by case effort to learn something that could have been “compressed” and generalized  with better theoretical understanding.  It’s a trade off if you cannot hire or retain people who have the advanced skills an advanced codebase can also be a maintenance liability.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;Scenario #2 high reuse&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;Now let’s create a hypothetical example, say we have a system that has many similar components and a brilliant programmer manages to distill this complexity into compact highly reusable code.  The problem is that our brilliant programmer is the only one who can really understand it.  Ideas similar to this are pondered by John Cook in his post &amp;quot;&lt;a href="http://www.johndcook.com/blog/2012/01/09/holographic-source-code/"&gt;Holographic Code&lt;/a&gt;&amp;quot;.  Now it might be the case that it code that is really only understandable to our brilliant programmer, or he may be the only one in the organization with that level of proficiency, also in this case we will assume that complexity was not artificially introduced, i.e. not unnecessary complexity, which is also a real problem that arises in software systems.  Also we will assume that we know that a less complex solution that is more verbose with less reuse exists, and in fact the solution of the maintainer developer might be to completely rewrite it in a less complex fashion.&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;As we have previously &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html#Entropy"&gt;seen&lt;/a&gt;, the complete compressibility of a code base can never be achieved which relates heavily to aspects of both &lt;a href="http://en.wikipedia.org/wiki/Information_theory"&gt;Information Theory&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Algorithmic_information_theory"&gt;Algorithmic Information theory&lt;/a&gt; this results in  diminishing returns in terms of shrinking an algorithm or codebase.  My speculation here, based on observation, is that as a codebase is "compressed" its complexity increases as shown above.  Essentially you need to be increasingly clever to continue to increase reuse.  Now some of these reuse complexity issues may be due to our lack of understanding of complexity in relation to software construction.  It is feasible that things that we find hard to gain reuse with today may be easier in the future with advances in this understanding.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Another idea from the research covered in my previous post is that different domains exhibit different degrees of Favorability/Resistance to reuse. I would also suspect that the types of reusable components would also vary across different domains this makes me think that perhaps in the future reusability in different domains can be guided both qualitatively and quantitatively by either empirical or theoretical means or both. This means that you might have fore-knowledge of the &amp;quot;compressibility&amp;quot; of a &amp;quot;domain solution&amp;quot; and then you would be able to guide the development effort appropriately.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I feel the ideas here are a step back from a possible absolutist thinking to reuse.  Reuse like any important approach in software, for example test coverage, which can also exhibit diminishing returns, needs to be tempered and viewed as an optimization as to the extent of its practice.  In many respects that’s what good engineering is, working within constraints and optimizing your outcome within those constraints.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-7134691662677050483?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/KloltCaFaCM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/KloltCaFaCM/software-reuse-complexity-curve.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-nS0Po1Jlg98/Ty7mj9aD3uI/AAAAAAAAAX8/tzP0816pMoo/s72-c/reuse-curve.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/02/software-reuse-complexity-curve.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-2570985781047552654</guid><pubDate>Sun, 29 Jan 2012 23:47:00 +0000</pubDate><atom:updated>2012-05-06T12:04:10.335-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Abstract Algebra</category><category domain="http://www.blogger.com/atom/ns#">Logic</category><category domain="http://www.blogger.com/atom/ns#">Group Theory</category><title>Abstract Algebra: The Logic of Odd and Even</title><description>&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-LPcyuClBIcQ/TyXXBKatGHI/AAAAAAAAAXY/YI78XK6nuHQ/s1600/squid.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="300" src="http://1.bp.blogspot.com/-LPcyuClBIcQ/TyXXBKatGHI/AAAAAAAAAXY/YI78XK6nuHQ/s400/squid.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--Abstract Algebra: The Logic of Odd and Even--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.stevenstrogatz.com/"&gt;Steven Strogatz&lt;/a&gt; wrote a series of math related articles on the New York Times website one of which is called "&lt;a href="http://opinionator.blogs.nytimes.com/2010/02/07/rock-groups/"&gt;Rock Groups"&lt;/a&gt; where he looks at adding integers visually and with respect to odd and even and ventures into the territory of triangles and squares and visually portrays the closed formula for computing triangular numbers. My previous post on &lt;a href="http://www.elegantcoding.com/2011/07/triangles-triangular-numbers-and.html"&gt;triangular numbers&lt;/a&gt; in some ways parallels his "Rock Groups" article at least in respect to the visual portrayal of triangular numbers.  This post also parallels ideas in that article, in contrast his observations are geometric, these are algebraic observations about, among other things, adding and multiplying even and odd numbers, which work as follows:&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"&gt;&lt;tr&gt;   &lt;td width="221" valign="top" align="center"&gt;&lt;p&gt;+&lt;/p&gt;&lt;/td&gt;   &lt;td width="282" valign="top" align="center"&gt;&lt;p&gt;*&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="221" valign="top" align="center"&gt;&lt;p&gt;Even + Even = Even&lt;/p&gt;&lt;/td&gt;   &lt;td width="282" valign="top" align="center"&gt;&lt;p&gt;Even * Even = Even&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="221" valign="top" align="center"&gt;&lt;p&gt;Odd + Even = Odd&lt;/p&gt;&lt;/td&gt;   &lt;td width="282" valign="top" align="center"&gt;&lt;p&gt;Odd * Even = Even&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="221" valign="top" align="center"&gt;&lt;p&gt;Odd + Odd = Even&lt;/p&gt;&lt;/td&gt;   &lt;td width="282" valign="top" align="center"&gt;&lt;p&gt;Odd * Odd = Odd&lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Now this doesn’t really give one a sense of what is going on here, however, by using a &lt;a href="http://en.wikipedia.org/wiki/Cayley_table"&gt;Cayley Table&lt;/a&gt; it can also be called an operation table in that it shows the details of an operator. It becomes more interesting we now have a better depiction of the &lt;a href="http://en.wikipedia.org/wiki/Group_(mathematics)"&gt;Group&lt;/a&gt; for Addition (+) with Even as the Identity Element and the &lt;a href="http://en.wikipedia.org/wiki/Monoid"&gt;Monoid&lt;/a&gt; for Multiplication (*) with Odd as the Identity Element:&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"&gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;+&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;Even&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;Odd&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;Even&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;Even&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;Odd&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;Odd&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;Odd&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;Even&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;*&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;Even&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;Odd&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;Even&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;Even&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;Even&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;Odd&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;Even&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;Odd&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Now that still may not be very intuitive, however, if you convert Even to Zero (0) and Odd to One (1) you get the following, possibly more familiar Group with 0 as the identity and the Monoid respectively with 1 as the identity:&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;+&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;*&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The Group has 1 as is its own inverse 1 + 1 = 0.  In general these "types" of Algebraic structures consist of a binary operator and a set that is closed under the operation so I am using the notation (Operator, {Set}) to denote these and since the sets are small I can just list the elements, but you could also write (+, Z) where Z is the set of integers and in fact this is a well known group: addition on the set of integers, but the set is infinite in this case in contrast to our finite sets.  We can describe the above as the Group (+, Z&lt;sub&gt;2&lt;/sub&gt;) and the Monoid  (*, Z&lt;sub&gt;2&lt;/sub&gt;) where  Z&lt;sub&gt;2&lt;/sub&gt; is the set {0,1} of the Integers Modulo 2, or simply the Binary digits which are Base 2. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now let’s do another transformation on our Monoid and Group, we will now map Zero (0) to False (F) and One (1) to True (T) . We will also change our operators, + now becomes &lt;a href="http://en.wikipedia.org/wiki/Exclusive_or"&gt;Exclusive-Or&lt;/a&gt; and * now becomes &lt;a href="http://en.wikipedia.org/wiki/Logical_conjunction"&gt;Logical Conjunction&lt;/a&gt; aka Logical And.&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;Xor&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;And&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;All of these transformations are actually &lt;a href="http://en.wikipedia.org/wiki/Isomorphism"&gt;Isomorphisms&lt;/a&gt; and the two structures combine to form a &lt;a href="http://en.wikipedia.org/wiki/Ring_(algebra)"&gt;Ring&lt;/a&gt; this is also a &lt;a href="http://en.wikipedia.org/wiki/Field_(mathematics)"&gt;Field&lt;/a&gt;, the smallest &lt;a href="http://en.wikipedia.org/wiki/Finite_field"&gt;Finite Field&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/GF(2)"&gt;GF(2)&lt;/a&gt;. I have a follow up for this post and I will get into these and other ideas in more detail.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Some basic algebraic structures are:&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Magma_(algebra)"&gt;Magma or Groupoid&lt;/a&gt; – A closed binary operation on a set.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Semigroup"&gt;Semigroup&lt;/a&gt; – A closed binary operation on a set, with associatively. (An associative Groupoid)&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Monoid"&gt;Monoid&lt;/a&gt; – A closed binary operation on a set, with associatively and an identity element. (A Semigroup with an identity element)&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Group_(mathematics)"&gt;Group&lt;/a&gt; – A closed binary operation on a set, with associatively and an identity element. Each element has an inverse element. (A Monoid with inverses)&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Commutative"&gt;Commutative&lt;/a&gt; (&lt;a href="http://en.wikipedia.org/wiki/Abelian"&gt;Abelian&lt;/a&gt;) – used to describe any of the above with the &lt;a href="http://en.wikipedia.org/wiki/Commutative"&gt;commutative&lt;/a&gt; property, these two terms are interchangeable but term &lt;a href="http://en.wikipedia.org/wiki/Abelian"&gt;abelian&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt; in abstract algebra is used mostly just for &lt;a href="http://en.wikipedia.org/wiki/Abelian_group"&gt;groups&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="80" valign="top" align="center"&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt;   &lt;td width="55" valign="top" align="center"&gt;&lt;p&gt;Closed&lt;/p&gt;&lt;/td&gt;   &lt;td width="82" valign="top" align="center"&gt;&lt;p&gt;Associative&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;Identity&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;Inverse&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="80" valign="top" align="center"&gt;&lt;p&gt;Magma&lt;/p&gt;&lt;/td&gt;   &lt;td width="55" valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;   &lt;td width="82" valign="top" align="center"&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="80" valign="top" align="center"&gt;&lt;p&gt;Semigroup&lt;/p&gt;&lt;/td&gt;   &lt;td width="55" valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;   &lt;td width="82" valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width=80 valign="top" align="center"&gt;&lt;p&gt;Monoid&lt;/p&gt;&lt;/td&gt;   &lt;td width=55 valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;   &lt;td width=82 valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;   &lt;td width=66 valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;   &lt;td width=66 valign="top" align="center"&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width=80 valign="top" align="center"&gt;&lt;p&gt;Group&lt;/p&gt;&lt;/td&gt;   &lt;td width=55 valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;   &lt;td width=82 valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;   &lt;td width=66 valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;   &lt;td width=66 valign="top" align="center"&gt;&lt;p&gt;X&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Now Commutative is more of a property of the above, as we saw the &lt;a href="http://www.elegantcoding.com/2011/05/monoid-for-masses.html"&gt;String Monoid&lt;/a&gt; is not or Non-Commutative where as the Group (+, Z&lt;sub&gt;2&lt;/sub&gt;) and the Monoid  (*, Z&lt;sub&gt;2&lt;/sub&gt;) are both Commutative.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Going back to &lt;a href="http://en.wikipedia.org/wiki/Boolean_algebra_(logic)"&gt;Boolean Logic&lt;/a&gt;, if you have had any exposure to Boolean Logic things now may look amiss in regards to operators: such as what about the Or operator? Actually Xor can be defined in terms of &lt;a href="http://en.wikipedia.org/wiki/Logical_conjunction"&gt;Logical Conjunction&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Logical_disjunction"&gt;Logical Disjunction&lt;/a&gt; as follows:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-mLAmncN_GCU/TyXXa67p9UI/AAAAAAAAAXw/BVvtqOnEs20/s1600/XOR1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="21" width="253" src="http://4.bp.blogspot.com/-mLAmncN_GCU/TyXXa67p9UI/AAAAAAAAAXw/BVvtqOnEs20/s400/XOR1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-nBBHaCoRxps/TyXXWxHD5WI/AAAAAAAAAXk/B2Uml7cRxMk/s1600/XOR2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="21" width="240" src="http://2.bp.blogspot.com/-nBBHaCoRxps/TyXXWxHD5WI/AAAAAAAAAXk/B2Uml7cRxMk/s400/XOR2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Our Cayley Table for Logical Disjunction (Or) is:&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;Or&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Now this table is almost the same as Xor with one exception (T or T) = T vs. (T Xor T) = F.  We can still call F an identity since it combines with T to give T, but you can see with that one change we lost our inverse for T so this is a now "downgraded" to Monoid status.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now if we add Logical Conjunction (And) back we get the familiar values in Caley tables:&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;Or&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;And&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;F&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;T&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Above we noted that the Group (+, Z&lt;sub&gt;2&lt;/sub&gt;) and the Monoid (*, Z&lt;sub&gt;2&lt;/sub&gt;)  formed a Ring.  Since Or is a Monoid these now combine to form a slightly different structure, a &lt;a href="http://en.wikipedia.org/wiki/Semiring"&gt;SemiRing&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Another interesting observation about these sets of &lt;a href="http://en.wikipedia.org/wiki/Logical_connective"&gt;operators&lt;/a&gt; comes from a logical standpoint. The combination of these two operators are what’s known as not being &lt;a href="http://en.wikipedia.org/wiki/Functional_completeness"&gt;functionally complete&lt;/a&gt;, which means that there exists &lt;a href="http://en.wikipedia.org/wiki/Truth_function"&gt;truth functional&lt;/a&gt; statements that cannot be expressed by these two operators alone, this can be fixed by adding negation which yields a truth functionally complete set of two dyadic and one monadic&lt;sup&gt;2&lt;/sup&gt; operators: {And, Or, Not}, which is a pretty well known and familiar set of logical operators.  The Ring operators from above {Xor, And} also form a functionally complete set. It turns out that just {And, Not} and just {Or, Not} are also each functionally complete sets as are the one element operator sets {&lt;a href="http://en.wikipedia.org/wiki/Logical_NAND"&gt;Nand&lt;/a&gt;} and {&lt;a href="http://en.wikipedia.org/wiki/Logical_NOR"&gt;Nor&lt;/a&gt;}, this is why digital logic circuits can be constructed solely with &lt;a href="http://en.wikipedia.org/wiki/NAND_gate"&gt;Nand&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Logic_gate"&gt;Gates&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The thing that bothered me the most was the fact that And and Xor had this nice mapping from Boolean Logic with {T,F} to Binary Integer Arithmetic {0,1} but Or seemed to be an oddball and then I realized that you can  remap both Logical Conjunction and Logical Disjunction to the Numerical functions Min and Max, respectively:&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;p&gt;Max(0,0) = 0&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Max(0,1) = Max(1,0) =1&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Max(1,1) =1&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Min(0,0) = 0&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Min(0,1) = Min(1,0) =0&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Min(1,1) =1&lt;/p&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;In Caley table form which better shows the isomorphisms (&amp;cong; means bidirectionally isomorphic to) from our Caley tables above: (And, {T,F}) &amp;cong; (Min, Z&lt;sub&gt;2&lt;/sub&gt;) and (Or, {T,F}) &amp;cong; (Max, Z&lt;sub&gt;2&lt;/sub&gt;):&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"  &gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;Max&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;table border="1" cellspacing="0" cellpadding="4"&gt;&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;Min&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td width="47" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;   &lt;td width="54" valign="top" align="center"&gt;&lt;p&gt;0&lt;/p&gt;&lt;/td&gt;   &lt;td width="66" valign="top" align="center"&gt;&lt;p&gt;1&lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Interestingly this mapping is the effectively definition of &lt;a href="http://en.wikipedia.org/wiki/Fuzzy_logic"&gt;Fuzzy Logic &lt;/a&gt; mapped to the discrete cases (two value logic).  &lt;a href="http://en.wikipedia.org/wiki/Boolean_algebra_(logic)"&gt;Boolean Logic&lt;/a&gt; also maps to &lt;a href="http://en.wikipedia.org/wiki/Lattice_theory"&gt;Lattices&lt;/a&gt; with disjunction being &lt;a href="http://en.wikipedia.org/wiki/Join_and_meet"&gt;meet&lt;/a&gt; and conjunction being &lt;a href="http://en.wikipedia.org/wiki/Join_and_meet"&gt;join&lt;/a&gt;, the min and max ideas give a nice intuition in relation to ordering.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;To recap we saw a number of Group and Monoid Isomorphisms (remember Z&lt;sub&gt;2&lt;/sub&gt; = {0, 1}), we saw:&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;p&gt;(+, Z&lt;sub&gt;2&lt;/sub&gt;) &amp;cong; (+, {Odd, Even})&lt;/p&gt;&lt;br /&gt;
&lt;p&gt; (*, Z&lt;sub&gt;2&lt;/sub&gt;) &amp;cong; (*, {Odd, Even})&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;(+, Z&lt;sub&gt;2&lt;/sub&gt;) &amp;cong; (Xor, {F, T})&lt;/p&gt;&lt;br /&gt;
&lt;p&gt; (*, Z&lt;sub&gt;2&lt;/sub&gt;) &amp;cong; (And, {F, T})&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;(Or, {F, T}) &amp;cong; (Max, Z&lt;sub&gt;2&lt;/sub&gt;)&lt;/p&gt;&lt;br /&gt;
&lt;p&gt; (And, {F, T}) &amp;cong; (Min, Z&lt;sub&gt;2&lt;/sub&gt;)&lt;/p&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;We also saw Ring Isomorphisms and a Semiring Isomorphism:&lt;/p&gt;&lt;br /&gt;
&lt;div align="center"&gt;&lt;br /&gt;
&lt;p&gt;[(+, Z&lt;sub&gt;2&lt;/sub&gt;), (*, Z&lt;sub&gt;2&lt;/sub&gt;))] &amp;cong; [(+, {Odd, Even}), (*, {Odd, Even})]&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;[(+, Z&lt;sub&gt;2&lt;/sub&gt;), (*, Z&lt;sub&gt;2&lt;/sub&gt;))] &amp;cong; [(Xor, {F, T}), (And, {F, T})]&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;[(Or, {F, T}), (And, {F, T})] &amp;cong; [(Max, Z&lt;sub&gt;2&lt;/sub&gt;), (Min, Z&lt;sub&gt;2&lt;/sub&gt;))] &lt;/p&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;I have always felt that examples are helpful and I think these give some sense of the diversity that can be found in just a small little corner of math. In researching this I came across some interesting facts which also highlight this diversity, for example the Nand operation is not associative but is commutative so it’s a commutative Groupoid.  The &lt;a href="http://en.wikipedia.org/wiki/Octonions"&gt;Octonions&lt;/a&gt;, which are &lt;a href="http://en.wikipedia.org/wiki/Hypercomplex_number"&gt;hypercomplex numbers&lt;/a&gt;,are neither associative nor commutative under multiplication but have an identity of 1 making it a non commutative Groupoid with an identity, so my point here is that the above table of basic algebraic structures that makes everything look so hierarchical is deceiving as the diversity does not seem to be constrained in any way, as far as I can tell. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; This term is named after the Norwegian mathematician &lt;a href="http://en.wikipedia.org/wiki/Niels_Henrik_Abel"&gt;Niels Henrik Abel&lt;/a&gt; who developed Group Theory independently of &lt;a href="http://en.wikipedia.org/wiki/%C3%89variste_Galois"&gt;Galois&lt;/a&gt; and like Galois tragically died young(&amp;lt;30).&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;2&lt;/sup&gt; Dyadic means takes two operators, e.g. (And, Or) and monadic means takes one operand, in this case the negation (Not) operator, this should not be confused with other uses of the term Monad. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-2570985781047552654?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/NHXEMis3Bjk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/NHXEMis3Bjk/abstract-algebra-logic-of-odd-and-even.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-LPcyuClBIcQ/TyXXBKatGHI/AAAAAAAAAXY/YI78XK6nuHQ/s72-c/squid.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/01/abstract-algebra-logic-of-odd-and-even.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-5595387300558512969</guid><pubDate>Wed, 25 Jan 2012 01:26:00 +0000</pubDate><atom:updated>2012-05-06T12:25:56.578-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Software Process</category><category domain="http://www.blogger.com/atom/ns#">Agile</category><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><title>Real Software Engineering: The Good, The Bad, and The Ugly</title><description>&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-0maylgi6ib4/TxyEatAkIYI/AAAAAAAAAXM/r3zqNrbIDPA/s1600/800px-GoldenGateBridge-001.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://1.bp.blogspot.com/-0maylgi6ib4/TxyEatAkIYI/AAAAAAAAAXM/r3zqNrbIDPA/s400/800px-GoldenGateBridge-001.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}
&lt;/style&gt;&lt;!--Real Software Engineering: The Good, The Bad, and The Ugly--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Deconstructing Glenn VanderBurg’s &amp;quot;Real Software Engineering&amp;quot;&lt;/h2&gt;&lt;br /&gt;
&lt;p&gt;Many years ago when I started my career, fresh out of school with a Bachelors in Computer Science, I chose to answer that ubiquitous question &amp;quot;What do you do?&amp;quot; with the title of &amp;quot;Software Engineer&amp;quot;. Now you must realize that this was back at a time when any technical title including Programmer was as rare and mysterious as any engineering field to the average person who probably had never used a computer, not like today when everyone seems to have one in their hand at all times. When I was younger I always felt weird calling myself a programmer and I had a number of associations with other engineering disciplines, including starting my college studies in Chemical Engineering. Actually I was a chemistry nerd before I was a computer nerd, which you might have guessed as much if you read my &lt;a href="http://www.elegantcoding.com/2011/12/metaphorically-thinking-about-software.html"&gt;previous post on Software Engineering&lt;/a&gt;. I also felt weird and perhaps even a bit phony using the title Software Engineer, I still do, so now I mostly go by Software Developer.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;My original foray into the contemplation of Software Engineering lead me to do some more research which yielded an enlightening and informative presentation by Glenn Vanderburg called &amp;quot;&lt;a href="http://confreaks.net/videos/282-lsrc2010-real-software-engineering"&gt;Real Software Engineering&lt;/a&gt;&amp;quot;, &lt;a href="http://en.oreilly.com/rails2010/public/schedule/detail/14216"&gt;PDF Slides here&lt;/a&gt;, which attempts to explore ideas of what a real discipline of Software Engineering might be.  I strongly recommend watching it. It’s about 52 minutes long. I feel that his presentation has some very good points but it also has some flaws and biases.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;The good&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;He starts with a critique about the state of software engineering today, which includes the following points:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Doesn’t reliably control costs.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Doesn’t reliably produce quality software.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Sometimes doesn’t produce software at all.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Software Engineering doesn’t work.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The term engineering is reserved for practices that work, a good capsule definition of engineering independent of any particular discipline.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The set of practices and techniques that have been determined to work reliably through experience.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Software engineering is a caricature of engineering.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;In software we have these practices that don’t work and that is called engineering&lt;/p&gt;&lt;br /&gt;
&lt;/blockquote&gt;&lt;p&gt;I find myself agreeing with these, and sadly Software Engineering does seem to be a ridiculous farce that often seems to resemble a real engineering practice only minimally. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;He then goes on to talk about the NATO Software Engineering Conference in 1968 which he cites as the origin of the waterfall process as a misinterpretation of a document called:&lt;br /&gt;
&lt;a href="http://www.cs.umd.edu/class/spring2003/cmsc838p/Process/waterfall.pdf"&gt;MANAGING THE DEVELOPMENT OF LARGE SOFTWARE SYSTEMS&lt;/a&gt; by Dr. Winston W. Royce who it seems inadvertently started the waterfall process through what might be called &amp;quot;Poor Information Design&amp;quot;.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;He continues with a quote from Parness about the document oriented path into engineering captured by the following quote:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;In Enginering ... people design through documents.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;-Parness &lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;This is followed by a list that might be considered failed attempts at such an approach:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Computer-aided_software_engineering"&gt;CASE Tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Object-oriented_software_engineering"&gt;OOSE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Vienna_Development_Method"&gt;VDM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Unified_Modeling_Language"&gt;UML&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Model-driven_architecture"&gt;MDA&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Object-modeling_technique"&gt;OMT&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Booch_method"&gt;Booch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;He refers to this as:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Modelling and what I call ‘Math Envy’&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;While I agree with this last statement in practice, I feel that he goes too far with this opinion, more on that later.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;His presentation provides a good historical survey of Software Engineering with respect to the 1968 NATO Software Engineering Conference and is worth watching for that alone. He continues with some great observations about engineering in general:&lt;/p&gt;&lt;br /&gt;
&lt;a name="Creativity"&gt;&lt;/a&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Engineering is a creative activity it’s about designing and building and creating new things and there are always blind alleys and missteps and mistakes and discoveries and reactions to those reactions and adjustments.&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I especially like the trial and error aspect in relation to creativity. I think this is a fundamentally important and potentially overlooked aspect of software development.  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The following succinctly sums up what might be the kernel of general engineering:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Different Engineering Disciplines are &lt;b&gt;Different&lt;/b&gt;&lt;/p&gt;&lt;br /&gt;
&lt;ul type=disc&gt;&lt;li&gt;Different materials, physical effects, forces &lt;/li&gt;
&lt;li&gt;Different degrees of complexity in requirements, designs, processes, and artifacts &lt;/li&gt;
&lt;li&gt;Varied reliance on formal modeling and analysis vs. experimentation, prototyping, and testing &lt;/li&gt;
&lt;li&gt;Varied use of defined and empirical processes&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;This leads to a comparison between the empirical vs. formal predefined models:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;The defined process control model requires that every piece of work be completely understood. A defined process can be started and allowed to run until completion, with the same results every time.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The empirical process control model provides and exercises control through frequent inspection and adaptation for processes that are imperfectly defined and generate unpredictable and unrepeatable outputs.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;He then takes the following ideas from Structural Engineering:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Structural engineering is the science and art of designing and making, with economy and elegance, […] structures so that they can safely resist the forces to which they may be subjected.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;—Structural Engineer’s Association &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Science and art, it employs the findings of science and yet is done with creativity &amp;quot;designing and making&amp;quot; engineers don’t sketch something on paper and validate it with math and throw it over the wall and never look at it again they participate in the building of what they design structural engineers have hard hats in their office because they visit the site and talk to the construction people and work with them during the process. &amp;quot;With economy and elegance&amp;quot; cost is always an object.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;From these ideas he derives a brief description of Software Engineering:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Software engineering is the science and art of designing and making, with economy and elegance, Systems so that they can readily adapt to situations which they may be subjected. &lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;With the following caveat: &lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Software engineering will be different from other kinds of engineering.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;We know that software engineering will be different from other kinds of engineering we know that because other kinds of engineering are different from each other. Software systems are usually more complex in terms of number of moving parts and things like that than artifacts in other engineering disciplines we’re not working with physical materials we have different laws we work with and it is rare for a software project to run up against the limitations of physical materials, very rare.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;He reiterates this from the Structural Engineering piece:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Cost is always an object.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;This is more eloquently stated by Arthur Mellen Wellington:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Engineering is not the art of constructing. It is rather the art of not constructing: or, it is the art of doing well with one dollar what any bungler can do with two.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;—Arthur Mellen Wellington &lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;The following are elements that in part drive the agile philosophy:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;The source code is the model and the document.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Source code is the detailed design&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The design and construction of software is tightly coupled.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;He draws the following inferences from the above:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Encourage continued innovations in processes&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;And do like other engineering disciplines do. Take the processes that work and call those engineering.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Agile software development, far from being anti-engineering, represents the responsible application of engineering ideals to the field of software.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I know that was a lot of quotes with sparse commentary, but it seemed like the best way to capture the really good points that he makes in his talk and &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html#ApiDesign"&gt;again&lt;/a&gt; I am trying to create a written artifact that I can reference and build upon in the future.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;The Bad&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;One thing that I really don’t like about his presentation is the comparison of the two bridge builders: &lt;a href="http://en.wikipedia.org/wiki/Robert_Maillart"&gt;Robert Maillart&lt;/a&gt; who designed the Valtschielbach Bridge in Switzerland among others and &lt;a href="http://en.wikipedia.org/wiki/Leon_Moisseiff"&gt;Leon Moisseiff&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The distinction being that Maillart used testing and all but one of his bridges are still standing while &lt;a href="http://en.wikipedia.org/wiki/Leon_Moisseiff"&gt;Moisseiff&lt;/a&gt; used modeling most notably &lt;a href="http://www.wsdot.wa.gov/tnbhistory/people/people1.htm"&gt;Deflection Theory&lt;/a&gt; and was responsible for designing the ill fated Tacoma Narrows Bridge aka &lt;a href="http://en.wikipedia.org/wiki/Galloping_Gertie"&gt;Galloping Gertie&lt;/a&gt; possibly one of the most famous engineering disasters in history. Moisseiff was also involved in the design of Manhattan Bridge which is still standing and his Deflection Theory was used in the design of the &lt;a href="http://en.wikipedia.org/wiki/Golden_Gate_Bridge"&gt;Golden Gate Bridge&lt;/a&gt; and was later determined to be of sound design and is also still standing. The &lt;a href="http://en.wikipedia.org/wiki/Frommers"&gt;Frommers&lt;/a&gt; travel guide considers the Golden Gate Bridge &amp;quot;possibly the most beautiful, certainly the most photographed bridge in the world&amp;quot;, what bridge Maillart design?&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I will not dispute that the collapse of the Tacoma Narrows Bridge was probably one of the most famous if not the most famous engineering disaster of all time and Moisseiff certainly suffered as a result, his career was shattered and he died shortly thereafter. Wikipedia states: &amp;quot;Though he [Moisseiff] had designed many other famous spans, the Narrows collapse overshadowed them all. It became a symbol of failed engineering and the dangers of arrogance in design.&amp;quot; I am in no position nor do I care to debate the soundness of deflection theory or the reasons for the collapse, actually it seems that reasons for the collapse are pretty &lt;a href="http://arxiv.org/abs/physics/0408101"&gt;complicated&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;From my limited understanding of Civil Engineering it seems that problems with wind are a continuous problem for Civil and Structural Engineers, I know that the &lt;a href="http://en.wikipedia.org/wiki/John_Hancock_Tower"&gt;John Hancock Tower&lt;/a&gt; in Boston was plagued by problems where wind induced twisting which caused large plate glass windows to &lt;a href="http://en.wikipedia.org/wiki/John_Hancock_Tower#Falling_glass_panes"&gt;careen&lt;/a&gt; hundreds of feet to the street making it a deadly hazard.  These were replaced with plywood earning it nicknames like the &amp;quot;Plywood Palace&amp;quot; and causing it to be condemned as a fire hazard, eventually these problems were resolved and it won awards for enhancing the Boston skyline. More recently, only twelve years ago in 2000 the &lt;a href="http://en.wikipedia.org/wiki/Millennium_Bridge_(London)"&gt;Millennium Bridge&lt;/a&gt; in London exhibited similar &lt;a href="http://en.wikipedia.org/wiki/Millennium_Bridge_(London)#Resonance"&gt;resonance problems&lt;/a&gt; to those of Galloping Gertie, it was shut down and reinforced.  So while all of this makes for interesting history of engineering fodder and good showmanship, I am not sure how directly relevant it is to software engineering. I Again I agree with his assertion that testing, perhaps not necessarily TDD in my opinion, is most likely a very important component in creating a real software engineering discipline but I feel this particular comparison argument is flawed as it is completely irrelevant to software engineering and in no way can be used to conclude that TDD should be used in software engineering. Also he contradicts his own argument with the statement, from above:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Software engineering will be different from other kinds of engineering.&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;He also contradicts this in his slides:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Software is very unlike bridges and buildings.&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;He ends his presentation abruptly with: &lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Today software engineering is called Agile. &lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I hate to say it but the way he states it, it sounds a bit like &amp;quot;Mission Accomplished&amp;quot; to me and I may be misinterpreting him here but to me it sounds like his whole presentation is designed to conclude that Agile and TDD are the solution to the problem and I agree that they are probably the best solutions to the problem today, but I think they are severely lacking as an effective and precise framework for a real engineering discipline, I think we still need more cowbell. &lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;The Ugly&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;I feel that his presentation has anti-math and anti-academic undertones and I have to say: &amp;quot;No Sir I don’t like it.&amp;quot; The two main themes that I take issue with are:&lt;/p&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;He mostly dismisses the work of non practitioner academics. &lt;/li&gt;
&lt;li&gt;He dismisses Math and views it as only a cost saving tool.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;At various points He states the following:&lt;/p&gt;&lt;blockquote class="quote"&gt;&lt;p&gt;Advances come from practitioners not from academia.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&amp;quot;Advances come from practitioners.&amp;quot; And then are brought into academia. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Important advances often from practitioners not necessarily from academia and they are brought into the academic world and are refined and so forth. But they come from practitioners.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;They were practitioners … and there were a few academics, but the academics had good things to say as well.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;Perhaps I am misinterpreting his tone here, but the in the last statement he seems surprised that the academics had something of value to contribute. Actually I feel that he has this somewhat backwards, for example I think the work that companies like Google are doing and the general trend in analytics fundamentally contradict this sentiment. I think the way that both the fields of Computer Science and Software Engineering will inevitably move forward in both efficiently and efficacy will be through more collaboration between practitioners and academicians with both groups refining each other’s ideas. I anticipate and hope this is a trend that we will see more of. In fact some really interesting things are happening in that regard one interesting example is the &lt;a href="http://blog.mikemccandless.com/2010/12/using-finite-state-transducers-in.html"&gt;work&lt;/a&gt; that &lt;a href="http://blog.mikemccandless.com/"&gt;Mike McCandless&lt;/a&gt; has done with &lt;a href="http://lucene.apache.org/java/docs/index.html"&gt;Lucene&lt;/a&gt; using &lt;a href="http://en.wikipedia.org/wiki/Finite_state_transducer"&gt;Finite State Transducers&lt;/a&gt; which was based on &lt;a href="http://www.cs.nyu.edu/~mohri/pub/fla.pdf"&gt;academic work&lt;/a&gt;, not to mention the &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html"&gt;Entropy-Framework relationship&lt;/a&gt; that we have already looked at. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;He goes on to say:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Mathematical Models were introduced to engineering as a cost saving tool it would be easy if you hear software engineering people talk about math and modeling, it would easy to get the idea that it’s the only way to do things right and that it is a tool for robustness and you don’t know it really works that it is really works unless have math to prove it, I’ve heard all of those statements. But, that’s not why it was introduced to engineering at all it was introduced to save cost because in other engineering fields they are working with real materials and things that require people and labor to go out and build and building prototypes and testing them especially at scale is extremely costly and if you can build a model, an approximation of reality you can save money.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Ask your friendly neighborhood aerospace engineer how much math he would do if building a model of his design and testing it were was effectively instantaneous and free. The answer would probably not be none, but a lot less than I do now.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I am not sure if I agree with the idea, that seems to be implied, which is that mathematical models are strictly a cost saving measure. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Towards the end he states the following are approaches needed to advance software engineering:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Not Math &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Not Models&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Not Documents&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Not copying other disciplines&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Learn From practioners&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Bias towards empirical processes&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;Ironically he mentions the following:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Programming languages are formal languages some of them even have mathematically specified semantics ... and we understand the math behind them at least as well as your average structural engineer understands the math behind the procedures that he was taught to do to validate his designs.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Programs themselves are models of the solution to the problem, our very tools are mathematical in nature.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;In the slides he has the following quote, which I think he skips in his presentation due to time constraints, but I believe it is intended to reinforce his anti math-argument:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;What is needed is not classical mathematics, but mathematics. Systems should be built at levels and modules, which form a mathematical structure.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;—Friedrich Bauer &lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I was unable to find it elsewhere, so I don’t know the context of the Friedrich Bauer quote, but I find the quote interesting. I feel the key here is: &amp;quot;not classical mathematics, but mathematics&amp;quot;. My interpretation of this is that he is saying that math is important, but not the math many people think about, hence &amp;quot;not classical mathematics&amp;quot;. &lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;In Conclusion&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;I hope I didn’t come across as too harsh on Glenn Vanderburg but I am just being honest and as he said about Bruce Eckel, &amp;quot;He said it so I get to pick on him&amp;quot;.  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The real strength of his presentation is that he really does step back from software and give some perspective on general engineering, and while we can all debate the utility of comparing different engineering fields it does hold that they all have a several common threads, including the application of artistry and creativity to design and construction, the objective to design and build things, working within certain constraints including cost, and the organization of people and resources to accomplish the tasks of design and construction. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I admit that my experience with real Agile is limited and while I like what I have seen.  I still doubt that it truly fulfills very little beyond an empirical approach and it seems that its focus is primarily on the process of creating software, which is not necessarily a bad thing.  The structural aspect of software is not ignored by Agile, but I do feel that it is the structural aspects of software which is where we currently lack a real engineering framework.  This is really what needs to become more established.  Ideas like &lt;a href="http://en.wikipedia.org/wiki/Coupling_(computer_programming)"&gt;Coupling&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Cohesion_(computer_science)"&gt;Cohesion&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Refactoring"&gt;Refactoring&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)"&gt;Patterns&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Anti-patterns"&gt;Anti-patterns&lt;/a&gt;, etc. are the state of the art in terms of structure but they seem too &amp;quot;squishy&amp;quot; which leads me to ask the question, is it not possible to have more comprehensive math backed concepts like the types of things you find in other engineering disciplines?&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The answers to these questions in the past have been dominated by ideas like formal methods and metrics, ideas which have mostly failed to live up to a real promise, however, that does not mean that we should completely discount these and similar ideas in the future.  These and other more math oriented approaches may represent a failed lineage that will go extinct or they may represent the nascent ideas from which we are only now developing the theoretical and mathematical ideas to truly conquer these problems. For example the Nato Conference of 1968 is often cited as a milestone in the development of software engineering. It was only about forty years proir that Category Theory was discovered.  I wonder how many attendees or general practitioners knew about it, unlike today where it seems that almost every software blogger writes about Monads and many also mention Category Theory.  I feel that the new era of software engineering will be forged from math but it won’t be &amp;quot;Classical Math&amp;quot; like &lt;a href="http://en.wikipedia.org/wiki/Calculus"&gt;Calculus&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Algebra"&gt;Algebra&lt;/a&gt; over the &lt;a href="http://en.wikipedia.org/wiki/Field_(mathematics)"&gt;Field&lt;/a&gt; of &lt;a href="http://en.wikipedia.org/wiki/Real_number"&gt;Real Numbers&lt;/a&gt;, it will be from areas like &lt;a href="http://en.wikipedia.org/wiki/Graph_theory"&gt;Graph Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Lattice_(order)"&gt;Lattice Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Category_theory"&gt;Category Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Information_theory"&gt;Information Theory&lt;/a&gt; and other related disciplines and not only will it be built on those disciplines but also the interrelation of those disciplines. I may be wrong about this but I have seen research that seems to point in these directions, ideas I will explore in future posts.  It seems crazy to assume that the failures of the past imply failures of the future. If math can make software cheaper and more reliable to produce it will become an inevitability.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-5595387300558512969?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/CLRnUk7C5xs" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/CLRnUk7C5xs/real-software-engineering-good-bad-and.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-0maylgi6ib4/TxyEatAkIYI/AAAAAAAAAXM/r3zqNrbIDPA/s72-c/800px-GoldenGateBridge-001.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2012/01/real-software-engineering-good-bad-and.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-4001940086836528079</guid><pubDate>Sat, 24 Dec 2011 16:27:00 +0000</pubDate><atom:updated>2012-05-06T12:05:13.409-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><title>Metaphorically Thinking about Software Engineering</title><description>&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-RzhmswF5dck/TcIN2IxdWyI/AAAAAAAAADg/TE9SuRYxNf4/s1600/767px-Disney_Concert_Hall_by_Carol_Highsmith_edit2.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="250" width="320" src="http://2.bp.blogspot.com/-RzhmswF5dck/TcIN2IxdWyI/AAAAAAAAADg/TE9SuRYxNf4/s320/767px-Disney_Concert_Hall_by_Carol_Highsmith_edit2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;style&gt;
blockquote {
   padding-bottom: 5px; padding-left: 5px; padding-right: 5px; font-family: calibri, tahoma, arial, sans-serif; background: #f5f5f5; color: #333; padding-top: 5px
}
&lt;/style&gt;&lt;br /&gt;
&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}
&lt;/style&gt;&lt;!--Metaphorically Thinking about Software Engineering--&gt; &lt;div&gt;&lt;br /&gt;
&lt;p&gt;Please note this is a rewrite previous &lt;a href="http://www.elegantcoding.com/2011/05/qare-we-not-engineers.html"&gt;post&lt;/a&gt; that I was unhappy with.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Years ago I heard a comparison of &lt;a href="http://en.wikipedia.org/wiki/Software_Engineering"&gt;software engineering&lt;/a&gt; to &lt;a href="http://en.wikipedia.org/wiki/Chemical_engineering"&gt;chemical engineering&lt;/a&gt;. I believe the intent of the analogy between the two fields was due to the fact that Software Engineering is a very young discipline just as Chemical Engineering was in relatively recent history, circa 1900.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Metaphors get used a lot in our industry, in Chapter 2: “Metaphors for a Richer Understanding of Software Development” of Steve McConnell’s Code Complete they are discussed in some detail.&amp;nbsp; In that chapter he cites the following:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;A confusing abundance of metaphors has grown up around software development. David Gries says writing software is a science (1981). Donald Knuth says it's an art (1998). Watts Humphrey says it's a process (1989). P. J. Plauger and Kent Beck say it's like driving a car, although they draw nearly opposite conclusions (Plauger 1993, Beck 2000). Alistair Cockburn says it's a game (2002). Eric Raymond says it's like a bazaar (2000). Andy Hunt and Dave Thomas say it's like gardening. Paul Heckel says it's like filming Snow White and the Seven Dwarfs (1994). Fred Brooks says that it's like farming, hunting werewolves, or drowning with dinosaurs in a tar pit (1995). Which are the best metaphors?&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I am not sure how apt the chemical engineering metaphor is either, but there are some interesting parallels.&amp;nbsp; The early chemical manufacturing process to produce &lt;a href="http://en.wikipedia.org/wiki/Sulfuric_acid"&gt;sulfuric acid&lt;/a&gt; is called the Lead &lt;a href="http://en.wikipedia.org/wiki/Lead_chamber_process"&gt;chamber process&lt;/a&gt; and it was invented in the mid 1700s. The process was not very well understood and was inefficient in that it required the use of expensive &lt;a href="http://en.wikipedia.org/wiki/Nitrate"&gt;nitrates&lt;/a&gt; often from &lt;a href="http://en.wikipedia.org/wiki/Guano"&gt;Chile&lt;/a&gt; which were partially lost as &lt;a href="http://en.wikipedia.org/wiki/Nitric_oxide"&gt;nitric oxide&lt;/a&gt; vapor, and it took over a hundred years before a way to recycle the part of nitrates was added to increase the efficiency of the process.&amp;nbsp; The discipline of chemical engineering was codified in the late 1800s when college curricula and associations for chemical engineering were created.&amp;nbsp; Over time the science of chemistry and &lt;a href="http://en.wikipedia.org/wiki/Stoichiometry"&gt;stoichiometry&lt;/a&gt; advanced as did &lt;a href="http://en.wikipedia.org/wiki/Thermodynamics"&gt;thermodynamics&lt;/a&gt; which made major steps forward around the same &lt;a href="http://en.wikipedia.org/wiki/Ludwig_Boltzmann"&gt;time&lt;/a&gt;. I am over simplifying here but eventually little understood processes that were discovered and tweaked empirically became understood and could be controlled and improved by applying the laws of science and mathematics.&amp;nbsp; Another parallel is the focus on &lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.27.3202"&gt;reusable processes&lt;/a&gt;, in that if you are building a new plant to manufacture sulfuric acid you don’t want to design it from scratch each time.&amp;nbsp; An interesting and abstract parallel is that both disciplines have their entropies, i.e. &lt;a href="http://en.wikipedia.org/wiki/Entropy_(classical_thermodynamics)"&gt;thermodynamic&lt;/a&gt; vs. &lt;a href="http://en.wikipedia.org/wiki/Entropy_(information_theory)"&gt;information&lt;/a&gt;. A social parallel may be the transformative effect that software is having on our lives and our society is as profound as that of industrial scale chemical production, this keyboard and almost thing I can see right now has been influenced in some way by chemical engineering.&amp;nbsp; Also what are the negative sides of these industries, what problems are we creating by the unregulated and somewhat opaque policies in regards to &lt;a href="http://en.wikipedia.org/wiki/Xenoestrogen"&gt;chemicals&lt;/a&gt; and what might some of the issues with software and IT &lt;a href="http://en.wikipedia.org/wiki/Network_neutrality"&gt;be&lt;/a&gt;?&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-ND-X2rE9_Fc/TgX48fBQ5hI/AAAAAAAAAGU/snC1DxotuW4/s1600/583px-Rafineria.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="200" width="194" src="http://1.bp.blogspot.com/-ND-X2rE9_Fc/TgX48fBQ5hI/AAAAAAAAAGU/snC1DxotuW4/s200/583px-Rafineria.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Now admittedly there is pretty big difference between a physical chemical process or the construction of something physical like bridge and software construction.&amp;nbsp; There are obvious parallels to building things in that people have to come together to build something that is greater than what one single individual could &lt;a href="http://en.wikipedia.org/wiki/Great_Pyramid_of_Giza"&gt;build&lt;/a&gt;. And there are similarities to Chemical processes in that once you build it that you have keep it up and running and you will probably need to do maintenance and make improvements while it is operational and even in some cases take it off line or build a new one in parallel while the old one is still in production.&amp;nbsp; Also might we possibly view Computer Science and Math as related to Software Engineering as Chemistry, stoichiometry and thermodynamics are related to Chemical Engineering?&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Like &lt;a href="http://www-cs-faculty.stanford.edu/~uno/"&gt;Donald Knuth&lt;/a&gt; I too think there is an artistic element to software, this idea is not incongruent with building or bridge architecture which is a process that organizes groups of people to build something beautiful. Perhaps a possible analogy for software engineering would be the construction of a bridge where we still don’t really understand all of the physics behind it or the best way to go about it. As a result when we are done it might stay up and it might &lt;a href="http://en.wikipedia.org/wiki/Tacoma_Narrows_Bridge"&gt;not&lt;/a&gt; and it will probably take longer than we thought to build it.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I guess the question is it possible to create a discipline of software engineering that is as effective as the other engineering disciplines? If we use the chemical engineering metaphor, where are we in the time line of understanding the underlying science and applying it to our process? Perhaps we are at the equivalent point to the mid to late 1800s in terms of process and our understanding of the underlying science but I very much doubt the years will map linearly, it’s probably more like an exponential mapping. The elusive software engineering is probably its own entity, are our metaphors confining our thinking and hindering our ability to objectively look at this problem?&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The software industry is also different from almost any other technical industry in history just in the sheer number of people who now participate in it worldwide and it seems that the barriers to enter the field can be lower than that of other engineering and scientific disciplines in regards to formal degrees.&lt;/p&gt;&lt;br /&gt;
&lt;p class=MsoNormal&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-4001940086836528079?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/yTveuqqNeEA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/yTveuqqNeEA/metaphorically-thinking-about-software.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-RzhmswF5dck/TcIN2IxdWyI/AAAAAAAAADg/TE9SuRYxNf4/s72-c/767px-Disney_Concert_Hall_by_Carol_Highsmith_edit2.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/12/metaphorically-thinking-about-software.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-1481582665395249582</guid><pubDate>Mon, 05 Dec 2011 16:51:00 +0000</pubDate><atom:updated>2012-05-06T12:06:43.648-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Combinatorics</category><category domain="http://www.blogger.com/atom/ns#">Set Theory</category><category domain="http://www.blogger.com/atom/ns#">Logic</category><category domain="http://www.blogger.com/atom/ns#">Linguistics</category><title>Responding to "Eleven Equations" Comments, Math Notation, and More</title><description>&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}
&lt;/style&gt;&lt;!--Responding to "Eleven Equations" Comments, Math Notation, and More--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-62wBjFX8c1M/Ttz18PzUi2I/AAAAAAAAAUk/gJSybgD-VrU/s1600/780px-Claude_Monet%252C_Impression%252C_soleil_levant%252C_1872.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="308" width="400" src="http://3.bp.blogspot.com/-62wBjFX8c1M/Ttz18PzUi2I/AAAAAAAAAUk/gJSybgD-VrU/s400/780px-Claude_Monet%252C_Impression%252C_soleil_levant%252C_1872.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Wow that was quite an experience, I have been looking at sites like Hacker News, Reddit and DZone for years but to see my own post go to #1 on Hacker News and rise high on Reddit and DZone was quite a thrill, with over 70K hits at the time of this writing.  It has completely changed my life the phone is ringing off the hook with endorsement offers, it looks like I will only be wearing Nike for the next year. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The best part was the over 200 comments on my &lt;a href="http://www.elegantcoding.com/2011/11/eleven-equations-true-computer-science.html"&gt;Blog&lt;/a&gt;, &lt;a href="http://news.ycombinator.com/item?id=3286459"&gt;Hacker News&lt;/a&gt;, and &lt;a href="http://www.reddit.com/r/programming/comments/msl7x/eleven_equations_every_computer_science_geeks/"&gt;Reddit&lt;/a&gt;, it spawned some spirited discussion on all three locations and many people added their own equations some that I was unfamiliar with and I learned a few new things, excellent!  The various discussions for the most part were great and very enjoyable and I’d like to thank everyone who contributed.   In the post I commented that I wondered how I would feel about the list in a year and I already think I would change the list by one equation.  I was tempted to respond to the comments on all of the forums, I know I should at least respond on my own blog, I just figured I’d do it as a post that way I could hit a number of topics.  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;One thing that people objected to was the title, which induced some inferences in the tone of the title. One redditer summed it up as:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Someone presuming, yet again, to know what &amp;quot;every&amp;quot; Computer Scientist should know? A title like &amp;quot;my favourite computer science equations&amp;quot; might be better. This list contains a lot of ideas which are only relevant in very narrow domains.&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;Yes, probably on the title comment, but the title was an intentional "spoof" if you will of a title of an article on Wired, and if you read my post you would have gotten that.  Actually I confess that you might even accuse me of "Hacker News Post Popularity Hacking" as I saw the Wired post rise up and figured that there was a high probability that a similar CS related post could achieve a similar placement, actually I think it exceeded my expectations and went even higher, it shot to #1 in under two hours of my submitting it and it stayed on the front page for almost a day.  I felt the tone I was setting, by using the term "rip off" and the &lt;a href="http://en.wikipedia.org/wiki/This_Is_Spinal_Tap"&gt;Spinal tap&lt;/a&gt; joke (This one goes to eleven) that I don’t think anyone got, was subtly light hearted, perhaps it was too subtle.  I recall reading that the title is key to getting people to read posts, and clearly this title was somewhat controversial which probably helped it, actually most of my titles are fairly boring or references that make them less popular, but I generally title things the way want not for popularity, well with this one exception.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Another thing that people took umbrage with was the use of the equations, as I just explained since I had set my title accordingly my format was now set.  One commenter, in two different comments on a thread on Hacker News added: &lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;I think this is a pretty silly post, to be honest. CS covers so much, and everytime I see a list of &amp;quot;things you should know&amp;quot;, I have to resist the urge to roll my eyes and ignore it. But then I read it, and inevitably roll my eyes anyway.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;...&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I disagree. Programming is math. Highly advanced math, in fact. It's just a different type of math. And the 11 equations in the OP's article just barely touches on what CS is about. There is far more to it than that.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I mostly agree with this commenter. I admit that the sentiment that this not really about the equations but the general domain knowledge is implied, again perhaps too subtle.  At one point someone mentions memorizing these equations which again means you are missing the point.  It’s about knowing what these equations mean and how to use them.  I feel that the math domain knowledge for our field is growing and becoming more important. Do I use any of this for my day job? Well no, but I hope to one day.  As to the broad domain I actually have a post "&lt;a href="http://www.elegantcoding.com/2011/06/math-for-programmers-tng.html"&gt;Math For Programmer TNG&lt;/a&gt;" that covers a very broad domain of math that I think is potentially relevant.  Also not all areas of math are going to be used in every math related job.  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;As to the narrowness insinuated by the two comments above, the post touched on the following domains: &lt;a href="http://en.wikipedia.org/wiki/Combinatorics"&gt;Combinatorics&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Mathematical_logic"&gt;Logic&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Boolean_Algebra"&gt;Boolean Algebra&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Set_Theory"&gt;Set Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Lattice_theory"&gt;Lattice Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Probability_Theory"&gt;Probability Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Statistics"&gt;Statistics&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Category_Theory"&gt;Category Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Number_Theory"&gt;Number Theory&lt;/a&gt; including &lt;a href="http://en.wikipedia.org/wiki/Complex_Numbers"&gt;Complex Numbers&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Relational_Algebra"&gt;Relational Algebra&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Abstract_Algebra"&gt;Abstract Algebra&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Linear_Algebra"&gt;Linear Algebra&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Shannon_information_theory"&gt;Shannon Information Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Algorithmic_Information_Theory"&gt;Algorithmic Information Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Kolmogorov_complexity"&gt;Kolmogorov complexity&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Graph_Theory"&gt;Graph Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Formal_language_theory"&gt;Formal Language Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Automata_Theory"&gt;Automata Theory&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Combinatory_logic"&gt;Combinatory Logic&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Lambda_Calculus"&gt;Lambda Calculus&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Machine_Learning"&gt;Machine Learning&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Data_Mining"&gt;Data Mining&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Encryption"&gt;Encryption&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Limit_(mathematics)"&gt;Limits&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Topology"&gt;Topology&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Fourier_analysis"&gt;Fourier Analysis&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/The_Simpsons"&gt;The Simpsons&lt;/a&gt;. Not exactly narrow, or am I missing something here?  In fact the list was picked in part for diversity. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The &lt;a href="http://en.wikipedia.org/wiki/Pumping_lemma"&gt;Pumping Lemma&lt;/a&gt; turned out to be fairly controversial, I do admit that the Pumping Lemma was perhaps a bit "contrived" as an Equation and as one person put it: "that's the most hideous formulation of the pumping lemma I have ever seen". That formulation came from Wikipedia.  As I mentioned I really did want something from Formal Language Theory or Automata Theory and it’s not so much about determining which language is regular but knowing the difference between a &lt;a href="http://en.wikipedia.org/wiki/Regular_Language"&gt;Regular Language&lt;/a&gt; and a &lt;a href="http://en.wikipedia.org/wiki/Context_free_language"&gt;Context Free Language&lt;/a&gt; so that you are not the &lt;a href="http://www.elegantcoding.com/2011/10/confederacy-of-cargo-cult-coders.html"&gt;cargo cult coder&lt;/a&gt; who tries to parse html with &lt;a href="http://en.wikipedia.org/wiki/Regular_expression"&gt;regular expressions&lt;/a&gt; because you understand these distinctions. I think the following exchange summed up what I was going for:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;(except the Pumping Lemma, WTF?)&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Reply:"Seriously, you never learnt theoretical computer science? As in, theory of computation? Automata theory? Complexity theory? Nothing like that?"&lt;/p&gt;&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;There were a number of comments about the use of mathematical notation including the following:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;"Shannon's Information Theory, Eigenvector, DeMorgan's Laws, etc. None of those names are meaningful or descriptive. And then the greek letters and made up symbols. Math could learn something from Computer Science:&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;"&lt;a href="https://www.google.com/search?q=readable+code"&gt;https://www.google.com/search?q=readable+code&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;This commenter seemed to have an issue with the actual names of things in math.  I found this to be very narrow minded. Math is many things including being a domain of knowledge, that’s like complaining about the names: &lt;a href="http://en.wikipedia.org/wiki/Ytterbium"&gt;Ytterbium&lt;/a&gt; in Chemistry, &lt;a href="http://en.wikipedia.org/wiki/Bose%E2%80%93Einstein_condensate"&gt;Bose–Einstein Condensate&lt;/a&gt; in Physics, &lt;a href="http://en.wikipedia.org/wiki/Borneo"&gt;Borneo&lt;/a&gt; in world Geography, or &lt;a href="http://en.wikipedia.org/wiki/Impressionism"&gt;Impressionism&lt;/a&gt; in art. Really!?! &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now the complaints about the notation are more understandable but still unreasonable in my opinion, math in some respects is a language, perhaps somewhere between a natural language and programming language, it has a notation and to really be able to understand it you need to learn this notation (language).  Someone remarked that symbols were "unfriendly".  Well I find Chinese, Arabic&lt;sup&gt;1&lt;/sup&gt;, etc. to consist of unfriendly symbols, but that’s because I don’t know them.  Also like natural languages you have inconsistencies, and multiple meanings for symbols.  One person complained about my notation for the Set version of De Morgan's laws, this may be a nonstandard notation, I saw it in some course notes on probability and set theory and I liked it and I just used it without thinking about it. I do think it’s more elegant.  This makes a good point about math.  If you learn it and read from diverse sources you will encounter notational differences.  This has been my experience, in fact if you look on the Wikipedia page for &lt;a href="http://en.wikipedia.org/wiki/De_Morgan's_laws"&gt;De Morgan's laws&lt;/a&gt; you will find the following example from &lt;a href="http://en.wikipedia.org/wiki/Modal_logic"&gt;Modal Logic&lt;/a&gt;: &lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-sm13G4W5p8g/Ttz2HSvWB8I/AAAAAAAAAUw/W1sLNpO_i8U/s1600/dem-mod1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="16" width="98" src="http://2.bp.blogspot.com/-sm13G4W5p8g/Ttz2HSvWB8I/AAAAAAAAAUw/W1sLNpO_i8U/s400/dem-mod1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-CnTW5TY8nGo/Ttz2MWdgQdI/AAAAAAAAAU8/QIOuhuknko0/s1600/dem-mod2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="16" width="98" src="http://4.bp.blogspot.com/-CnTW5TY8nGo/Ttz2MWdgQdI/AAAAAAAAAU8/QIOuhuknko0/s400/dem-mod2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;I am used to the notation used in Hughes and Cresswell:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-1JpHEQk7CMs/Ttz2PrMiG6I/AAAAAAAAAVI/_NtJapVWJ0o/s1600/dem-mod-h1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="16" width="104" src="http://3.bp.blogspot.com/-1JpHEQk7CMs/Ttz2PrMiG6I/AAAAAAAAAVI/_NtJapVWJ0o/s400/dem-mod-h1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-egYfTTkjT80/Ttz2TIccVkI/AAAAAAAAAVU/O4svPO-yj2I/s1600/dem-mod-h2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="16" width="104" src="http://3.bp.blogspot.com/-egYfTTkjT80/Ttz2TIccVkI/AAAAAAAAAVU/O4svPO-yj2I/s400/dem-mod-h2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;That’s just how things work.  You can get hung up on it and complain or you can accept it and move on.   Don’t get me wrong it would be nice if there was a notational standard that every one followed for all math.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Like natural languages Math has its equivalences of "&lt;a href="http://en.wikipedia.org/wiki/Homograph"&gt;Homographs&lt;/a&gt;", for example the following  symbols can have multiple context dependent meanings: &amp;#124;b&amp;#124; can mean absolute value of b if it is a number or cardinality of b if it is a set or length of b if it is string, &amp;part; can mean &lt;a href="http://en.wikipedia.org/wiki/Partial_Derivative"&gt;Partial Derivative&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/Boundary_(topology)"&gt;Topological Boundary&lt;/a&gt;,  and as we saw &amp;and; and &amp;or; can mean meet and join or "logical and" and "logical or".  &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Just as Math has "Homographs", as in natural languages it also has its equivalences of "&lt;a href="http://en.wikipedia.org/wiki/Polysemy"&gt;Polysemes&lt;/a&gt;", meaning that there are multiple ways to express the same ideas. For example set difference can be expressed as (S – T) or (S \ T), the Powerset notation can be either 2&lt;sup&gt;S&lt;/sup&gt; or P(S), and meet and join can be expressed as the either of the following sets of symbols:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-DG1Ii9SIzog/Tt0NwkZaXGI/AAAAAAAAAWo/SX5vLH2zvew/s1600/wv.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="11" width="26" src="http://4.bp.blogspot.com/-DG1Ii9SIzog/Tt0NwkZaXGI/AAAAAAAAAWo/SX5vLH2zvew/s400/wv.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-N3RHlilNOhc/Tt0N0Nw72hI/AAAAAAAAAW0/7crHyhnjM_E/s1600/sqwv.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="10" width="27" src="http://3.bp.blogspot.com/-N3RHlilNOhc/Tt0N0Nw72hI/AAAAAAAAAW0/7crHyhnjM_E/s400/sqwv.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The list of both math "Homographs" and "Polysemes" is much longer.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;For De Morgan's laws, someone added the following generalization using the Existential and Universal Quantifiers, which is really interesting and also illustrates the &lt;a href="http://en.wikipedia.org/wiki/Duality_(mathematics)#Order-reversing_dualities"&gt;duality&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;It's not much of a generalization, but I prefer the predicate version of De Morgan's: &lt;/p&gt;&lt;p&gt;~&amp;#8704;x p(x) &amp;#8801;&amp;#8707;x ~p(x)&lt;br /&gt;
~&amp;#8707;x p(x) &amp;#8801;&amp;#8704;x ~p(x)&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;If you read the Wikipedia Article it includes this generalization as well:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-T1uzCCUm7wY/Ttz24JPpEgI/AAAAAAAAAVg/Qx_7sHSNHLY/s1600/dem-wik1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="43" width="117" src="http://4.bp.blogspot.com/-T1uzCCUm7wY/Ttz24JPpEgI/AAAAAAAAAVg/Qx_7sHSNHLY/s400/dem-wik1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-vMwmDxUUx6c/Ttz29Kx3cRI/AAAAAAAAAVs/5czQhFZ4oSQ/s1600/dem-wik2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="43" width="117" src="http://2.bp.blogspot.com/-vMwmDxUUx6c/Ttz29Kx3cRI/AAAAAAAAAVs/5czQhFZ4oSQ/s400/dem-wik2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The above equations do generalize De Morgan's laws within Logic and Set Theory respectively but my point was to further generalize them in terms of &lt;a href="http://en.wikipedia.org/wiki/Lattice_theory"&gt;Lattices&lt;/a&gt; which is a different concept all together and gets at the deeper intuition about the interrelation of Logic and Set Theory, quoting from &lt;u&gt;Combinatorics the Rota way:&lt;/u&gt; by Rota and Kung, an amazing book I am trying to read, emphasis on the word trying:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;"As John Von Neumann put it, the theory of Boolean Algebras is "pointless" set theory.&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;This set version would be written using the complement exponentiation notation as follows:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-ULozrRNZj7U/Ttz3G4-2QiI/AAAAAAAAAV4/PTzEu9ikagk/s1600/Dem-set1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="53" width="141" src="http://4.bp.blogspot.com/-ULozrRNZj7U/Ttz3G4-2QiI/AAAAAAAAAV4/PTzEu9ikagk/s400/Dem-set1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-U8zUWgP4LTY/Ttz3KAvnAOI/AAAAAAAAAWE/mLt5dY7nDkw/s1600/Dem-set2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="53" width="141" src="http://2.bp.blogspot.com/-U8zUWgP4LTY/Ttz3KAvnAOI/AAAAAAAAAWE/mLt5dY7nDkw/s400/Dem-set2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;I really do prefer this notation, I originally encountered it in "&lt;a href="http://www.sics.se/~ali/prob/"&gt;Introduction to Probability Theory&lt;/a&gt;" by By &lt;a href="http://www.sics.se/~ali/"&gt;Ali Ghodsi&lt;/a&gt; and Cosmin Arad, &lt;a href="http://www.sics.se/~ali/prob/l1/l1.pdf"&gt;lecture 1&lt;/a&gt;(pdf).  This notation is also used in &lt;u&gt;Combinatorics the Rota way&lt;/u&gt;. So this notation is now the official notation of my blog, get used to it or hit the road. ;)&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;A commenter (who was also the demorgans notation complainer) responded with the following:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;...&lt;/p&gt;&lt;p&gt;For the rest, they seem more likely to be used by someone doing something related to machine learning/AI/information theory than you run of the mill I-spend-all-day-parsing-user-input programmer.&lt;br /&gt;
&lt;p&gt;Thank you for making me feel like I'm not a 'true' computer scientist. Next would you like to tell me about how I'm not a 'man' because I don't like to work on cars?&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;Well I hate to break it to you, but if this list makes you feel that way then chances are you are like me: a software developer with a CS Degree and that does not make you or me a Computer Scientist. This is from &lt;a href="http://en.wikipedia.org/wiki/Computer_science"&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;"The general public sometimes confuses computer scientists with other &lt;a href="http://en.wikipedia.org/wiki/Computer_professional" title="Computer professional"&gt;computer professionals&lt;/a&gt; having careers in &lt;a href="http://en.wikipedia.org/wiki/Information_technology" title="Information technology"&gt;information technology&lt;/a&gt;, or think that computer science relates to their own experience with computers, ...&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;Oh, and yes you are not a man if you do not at least know how to change your oil, including the filter. ;)&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Also a number of people remarked that I did not explain the equations in enough detail and I did not provide code examples.  It was meant as high level post, if I were to explain all of these equations the post would have been excessively long, maybe even a whole book.  As to the code examples again it would be too long, if you want code examples that relate to math, I have posts for that, I recommend the following posts on my blog, some were linked in the original post: "&lt;a href="http://www.elegantcoding.com/2011/10/ologn.html"&gt;O(log(n))&lt;/a&gt;", "&lt;a href="http://www.elegantcoding.com/2011/07/triangles-triangular-numbers-and.html"&gt;Triangles, Triangular Numbers, and the Adjacency Matrix&lt;/a&gt;", "&lt;a href="http://www.elegantcoding.com/2011/05/combinatorial-and-other-math-of-java.html"&gt;The Combinatorial and Other Math of the Java Collections API&lt;/a&gt;", "&lt;a href="http://www.elegantcoding.com/2011/04/math-you-can-use.html"&gt;Math You Can Use : Refactoring If Statements with De Morgan's Laws&lt;/a&gt;", and "&lt;a href="http://www.elegantcoding.com/2011/05/monoid-for-masses.html"&gt;Monoid for the Masses&lt;/a&gt;".&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Regrettably some people responded with the sentiment of: I’m not good at math or that math is too hard, I don’t think I can get a CS degree.  Fortunately there were a number of comments of encouragement to counter these sentiments, my favorite was this one:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Don't let this be intimidating to you - instead of asking yourself &amp;quot;how come I don't know this?&amp;quot; ask yourself &amp;quot;how can I learn more about this?&amp;quot;. This might sound cheesy and simplified but it's as simple as &amp;quot;nobody was born knowing this&amp;quot;. I'm 31 and I wish I had the money to go back in education and learn all of this with the official way but for now I'm just picking resources on the web and who knows? It just might happen...&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I have a post planned to talk about my experiences and thoughts about learning math, I will say if you are a programmer you are doing math in a sense.  You just need to formalize your understanding of the underlying concepts.  If it is any consolation I find Math to be very hard at times, I pretty much suck at it in the traditional sense, but it is so beautiful and when you grok a concept, at least for me, it is an incredible buzz.  Every new concept that you learn changes how you see everything, I see so much math in programming and the world now it’s scary, I just wish I could figure out how to express it.  Everything is math.  Over the last few years my ability to understand things has greatly increased and continues to do so.  Yes it’s hard but it is so worth it.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;A number of commenters added their own equations to the discussion, and this was the best part, which included a few new things for me. In general my list was mostly directed at more pure math oriented equations that I felt were fairly central to a specific discipline and encapsulated certain principles.  Here are a few recommendations and thoughts: &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;One person pointed out the absence of P=NP or P &amp;ne; NP, to which I would respond "D’oh!" If I was doing this over I might even replace the Pumping Lemma with P=NP. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;One poster recommended triangular numbers:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;Here's a real simple and practical equation: 1+2+3+4 . . .&amp;nbsp;N&amp;nbsp;=&amp;nbsp;N(N+1)/2&lt;/p&gt;&lt;p&gt;This equation represents the number ofedges on a complete&amp;nbsp;graph&amp;nbsp;with&amp;nbsp; N+1 vertices or the number of possible pairings given &amp;nbsp;N+1 objects. Useful whenestimating O(N) for certain algorithms that involve comparing an item to everyother item in a set.&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;I love &lt;a href="http://en.wikipedia.org/wiki/Triangular_Numbers"&gt;Triangular Numbers&lt;/a&gt; and this is a great equation, I wrote a whole post "&lt;a href="http://www.elegantcoding.com/2011/07/triangles-triangular-numbers-and.html"&gt;Triangles, Triangular Numbers, and the Adjacency Matrix&lt;/a&gt;" on exactly what he is mentioning, and considered that equation but rejected it because triangular numbers are sort of a special case of the &lt;a href="http://en.wikipedia.org/wiki/Binomial_coefficient"&gt;Binomial Coefficient&lt;/a&gt; equation:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-sH1zDuJBL_w/Ttz3V_sVjvI/AAAAAAAAAWQ/4wKkJ_AsVxk/s1600/triangualr-wiki.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="46" width="400" src="http://3.bp.blogspot.com/-sH1zDuJBL_w/Ttz3V_sVjvI/AAAAAAAAAWQ/4wKkJ_AsVxk/s400/triangualr-wiki.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Here are some of the other equations and theorems that were suggested, I wouldn’t really consider these because they didn’t fit my theme and criteria but that doesn’t mean they aren’t interesting:&lt;/p&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Amdahl's_law"&gt;Amdahl's law&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Fitts's_law"&gt;Fitts's Law&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Master_theorem"&gt;Master Theorem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Akra%E2%80%93Bazzi_method"&gt;Akra–Bazzimethod&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Little%27s_law"&gt;Little's Law&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Cook%E2%80%93Levin_theorem"&gt;Cook-Levin theorem&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;p&gt;One commenter accused me of shoehorning in Euler’s Identity.  This is partially true.  He also accused me of "Name Dropping". That’s not true.  A defender supplied the following course notes: &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.lsi.upc.edu/~conrado/docencia/udelar-course-2011.pdf"&gt;Analytic Combinatorics: A Primer&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I followed up on that and found that you can download a copy of &lt;a href="http://algo.inria.fr/flajolet/Publications/AnaCombi/"&gt;Analytic Combinatorics&lt;/a&gt;:&lt;br /&gt;
by &lt;a href="http://algo.inria.fr/flajolet/index.html"&gt;Flajolet&lt;/a&gt; and &lt;a href="http://www.cs.princeton.edu/~rs/"&gt;Sedgewick&lt;/a&gt;. Warning: pretty advanced stuff.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;As the popularity of my post was waning on Hacker News a math oriented post called "&lt;a href="http://ntz-develop.blogspot.com/2011/03/fuzzy-string-search.html"&gt;Fuzzy string search&lt;/a&gt;" was making its way up the ranks. It’s an interesting post and I think it helps illustrate a couple of points I have been making here, first of all it uses mathematical notation, which is not uncommon when writing about these types of topics.  Additionally the post includes the equation for the &lt;a href="http://en.wikipedia.org/wiki/Triangle_inequality"&gt;Triangle Inequality&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-jyWMfYvOTWs/Ttz3oYbNHEI/AAAAAAAAAWc/KLCjRsLT840/s1600/triangle.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="17" width="181" src="http://1.bp.blogspot.com/-jyWMfYvOTWs/Ttz3oYbNHEI/AAAAAAAAAWc/KLCjRsLT840/s400/triangle.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;An equation that crossed my mind when writing my equations post.  It is not the equation itself, but the concept, if you become familiar with the idea of a &lt;a href="http://en.wikipedia.org/wiki/Metric_(mathematics)"&gt;Metric&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/Metric_space"&gt;Metric Spaces&lt;/a&gt;, you instantly recognize this equation concept without having to read the associated text, not that you shouldn’t read the associated text.  Knowing these ideas gives you the ability to better understand more complex ideas that are based on these concepts. I think this is the case in all knowledge domains.  Also I noticed that there was not one comment on that post complaining about math notation.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;A lot of what went on is part of an ongoing conversation, I blogged about it in "&lt;a href="http://www.elegantcoding.com/2011/03/math-debate.html"&gt;The Math Debate&lt;/a&gt;" which links to other famous blogs of the same ilk.  Ultimately the equations probably don’t apply to most programming jobs, the title contained as some commenters pointed out "Computer Science Geeks" not "Corporate Software Developers".  A few people castigated the commenters who seemed to be advocating positions of ignorance, thanks, BTW.  I personally find it tragic, the following comment sums this up:  &lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;&lt;p&gt;"Someone with a CS degree who knows nothing of De Morgan's law should have their credit removed and be demoted to making websites or performing tech support tasks.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Reply: "There goes 98% of your CS graduates then. I wish I was joking, but alas.."&lt;/p&gt;&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;Of course it’s a bit I ironic that as I am wrapping this up, "&lt;a href="http://queue.acm.org/detail.cfm?id=1961297&amp;amp;repost"&gt;A co-Relational Model of Data for Large Shared Data Banks&lt;/a&gt;"  by Erik Meijer, Gavin Bierman just popped up on Hacker News, the relevant quote is:&lt;/p&gt;&lt;br /&gt;
&lt;blockquote class="quote"&gt;Every programmer is familiar with the two dual forms of De Morgan’s laws&lt;/blockquote&gt;&lt;br /&gt;
&lt;p&gt;The writing quality of the post was criticized.  I don't know what people will think of this post, I feel like I just wrote a &lt;a href="http://en.wikipedia.org/wiki/Clip_show"&gt;clip show&lt;/a&gt;.  I admit that previous post was not my best effort, while it was fun putting it together it was not easy, I had hoped to learn all of the equations in more detail, I did to some degree, I confess I still don’t fully get the Y-Combinator, but I will.  I finally decided to just push it out and move on.  This post, while being relevant to my mission of blogging about math was something of a social experiment in popularity, it was interesting but I will be returning to the true mission of my blog which is my journey through math and the pursuit of a real Software Engineering discipline.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Ultimately I am interested in the readers, like a young colleague of mine who was too busy to comment because he was following the links to learn new things he didn't know, not the complainers and naysayers.   There were many positive comments and again, thanks. I did feel a needed to refute some of the negative comments. The bottom line is if you want to read about math, you need to get used to the notation, it probably won't help you to build &lt;a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete"&gt;CRUD&lt;/a&gt; Web apps but it will hopefully help you take your career to the next level.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt;Actually this is not true I find them to be quite beautiful, especially Arabic.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-1481582665395249582?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/BIIcE8W5hYM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/BIIcE8W5hYM/responding-to-eleven-equations-comments.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-62wBjFX8c1M/Ttz18PzUi2I/AAAAAAAAAUk/gJSybgD-VrU/s72-c/780px-Claude_Monet%252C_Impression%252C_soleil_levant%252C_1872.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/12/responding-to-eleven-equations-comments.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-3552176205618998576</guid><pubDate>Sun, 27 Nov 2011 21:13:00 +0000</pubDate><atom:updated>2012-05-06T12:08:42.258-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Linear Algebra</category><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Complex numbers</category><category domain="http://www.blogger.com/atom/ns#">Formal Language Theory</category><category domain="http://www.blogger.com/atom/ns#">Bayes</category><category domain="http://www.blogger.com/atom/ns#">Number Theory</category><category domain="http://www.blogger.com/atom/ns#">Combinatorics</category><category domain="http://www.blogger.com/atom/ns#">Set Theory</category><category domain="http://www.blogger.com/atom/ns#">Logic</category><category domain="http://www.blogger.com/atom/ns#">Relational Algebra</category><category domain="http://www.blogger.com/atom/ns#">Information Entropy</category><category domain="http://www.blogger.com/atom/ns#">Computer Science</category><title>Eleven Equations True Computer Science Geeks Should (at Least Pretend to) Know</title><description>&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-O4a_eSkqeNE/TtKrcgal6zI/AAAAAAAAAUY/C8P7Ex09bhk/s1600/Bayes%2527_Theorem_MMB_01.1.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="256" width="400" src="http://4.bp.blogspot.com/-O4a_eSkqeNE/TtKrcgal6zI/AAAAAAAAAUY/C8P7Ex09bhk/s400/Bayes%2527_Theorem_MMB_01.1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;!--Eleven Equations True Computer Science Geeks Should (at Least Pretend to) Know --&gt;&lt;br /&gt;
&lt;p&gt;This idea is a complete rip off an article that appeared in &lt;a href="http://www.wired.com/wiredscience/2011/11/equations-for-geeks/?pid=2364&amp;amp;viewall=true"&gt;Wired&lt;/a&gt; a little while ago and it got me thinking what would my list for Computer Science look like?  Plus I thought it might be a fun post and unlike the Wired list this one goes to eleven.  So here they are in no particular order:&lt;/p&gt;&lt;br /&gt;
&lt;a name="Binomial_Coefficient" /&gt;&lt;br /&gt;
&lt;h2&gt;Binomial Coefficient&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-l5kBy3x6eEI/TtKoHv3wvDI/AAAAAAAAAQE/MFL0ejup3vc/s1600/binomial.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="41" width="138" src="http://3.bp.blogspot.com/-l5kBy3x6eEI/TtKoHv3wvDI/AAAAAAAAAQE/MFL0ejup3vc/s400/binomial.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The &lt;a href="http://en.wikipedia.org/wiki/Binomial_coefficient"&gt;Binomial Coefficient equation&lt;/a&gt; generates &lt;a href="http://en.wikipedia.org/wiki/Pascal%27s_triangle"&gt;Pascal’s Triangle&lt;/a&gt; and gives you the coefficients for the &lt;a href="http://en.wikipedia.org/wiki/Binomial_theorem"&gt;Binomial Theorem&lt;/a&gt; these ideas are often attributed to Pascal but in fact they have been known in part for over a millennia.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;As I mentioned that this list is no particular order and I don’t wish to play favorites but if there is one equation here that you should really consider learning and committing to memory this is it. It is central to &lt;a href="http://en.wikipedia.org/wiki/Combinatorics"&gt;Combinitorics&lt;/a&gt; which has connections to many areas of math, I guess I should qualify that if you are serious about computer science and math related programming topics then you should be able to recite and apply it from memory, even when you are drunk, sleep deprived or being held at gun point. Ok that might be a bit much but you get the idea.  If you are programmer and you haven’t learned it, or need a refresher, I have a post that relates it to the &lt;a href="http://www.elegantcoding.com/2011/05/combinatorial-and-other-math-of-java.html"&gt;Java Collections API&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Demorgans_Laws" /&gt;&lt;br /&gt;
&lt;h2&gt;Demorgan’s Laws&lt;/h2&gt;&lt;br /&gt;
&lt;p&gt;Logical form:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-dnSUiAWWyYs/TtKoTWDV-qI/AAAAAAAAAQQ/kVwvQMkQlIA/s1600/demorgan-logical-1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="17" width="172" src="http://3.bp.blogspot.com/-dnSUiAWWyYs/TtKoTWDV-qI/AAAAAAAAAQQ/kVwvQMkQlIA/s400/demorgan-logical-1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-AOfZxmR5cbg/TtKoW8T6GhI/AAAAAAAAAQc/jg7xoMy2ons/s1600/demorgan-logical-2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="17" width="172" src="http://2.bp.blogspot.com/-AOfZxmR5cbg/TtKoW8T6GhI/AAAAAAAAAQc/jg7xoMy2ons/s400/demorgan-logical-2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Set Form:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-ry-FqDGZxJU/TtKomnBvoEI/AAAAAAAAAQo/fokmM9hv2pw/s1600/demorgan-set-1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="17" width="143" src="http://2.bp.blogspot.com/-ry-FqDGZxJU/TtKomnBvoEI/AAAAAAAAAQo/fokmM9hv2pw/s400/demorgan-set-1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-PJA7GIKtK8M/TtKou13h4oI/AAAAAAAAAQ0/smrKEw7nLzs/s1600/demorgan-set-2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="17" width="143" src="http://1.bp.blogspot.com/-PJA7GIKtK8M/TtKou13h4oI/AAAAAAAAAQ0/smrKEw7nLzs/s400/demorgan-set-2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Ok so that’s like four "equations" for &lt;a href="http://en.wikipedia.org/wiki/De_Morgan's_laws"&gt;DeMorgan’s Laws&lt;/a&gt;, one can’t help but to struck by the similarity between the two sets and this is not a coincidence these two sets of formulas are essentially the same thing, they are special cases of &lt;a href="http://en.wikipedia.org/wiki/Complemented_lattice"&gt;complemented&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Distributive_lattice"&gt;distributive&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Lattice_(order)"&gt;lattices&lt;/a&gt;&lt;sup&gt;&amp;dagger;&lt;/sup&gt;  which means technically it’s really just two formulas:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-mMW8VHofNxs/TtKozfpNScI/AAAAAAAAARA/TsFraEDN414/s1600/demorgan-lattice-1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="17" width="160" src="http://3.bp.blogspot.com/-mMW8VHofNxs/TtKozfpNScI/AAAAAAAAARA/TsFraEDN414/s400/demorgan-lattice-1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-g1Vxzl1Qh_s/TtKo3SES3jI/AAAAAAAAARM/Nw7JtwiVx6o/s1600/demorgan-lattice-2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="17" width="160" src="http://4.bp.blogspot.com/-g1Vxzl1Qh_s/TtKo3SES3jI/AAAAAAAAARM/Nw7JtwiVx6o/s400/demorgan-lattice-2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;In this case the &amp;or; symbol means lattice &lt;a href="http://en.wikipedia.org/wiki/Join_and_meet"&gt;join&lt;/a&gt; operation and the &amp;and; symbol is the lattice &lt;a href="http://en.wikipedia.org/wiki/Join_and_meet"&gt;meet&lt;/a&gt; operation and the dash with the right downward mark means lattice complementation, I used this to differentiate from the tilde for Boolean complementation.  Also these two formulas are &lt;a href="http://en.wikipedia.org/wiki/Category_theory"&gt;categorical&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Duality_(mathematics)"&gt;duals&lt;/a&gt; of each other, which means that if one were smart and had a good grasp of &lt;a href="http://en.wikipedia.org/wiki/Category_theory"&gt;Category Theory&lt;/a&gt; we could probably be really OCD about it and get it down to one formula.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Understanding &lt;a href="http://en.wikipedia.org/wiki/Set_theory"&gt;Set Theory&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Boolean_algebra_(structure)"&gt;Boolean Algebra&lt;/a&gt; are very important basic concepts in our profession and the Boolean version can make you better programmer, as you can use it to &lt;a href="http://www.elegantcoding.com/2011/04/math-you-can-use.html"&gt;refactor logical if statements&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;a name="Eigenvector_and_Eigenvalue" /&gt;&lt;br /&gt;
&lt;h2&gt;Eigenvector and Eigenvalue&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-GCgdDQ3ueUc/TtKo8uJGqUI/AAAAAAAAARY/cZkhPfq1zM8/s1600/eigenL.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="26" width="126" src="http://1.bp.blogspot.com/-GCgdDQ3ueUc/TtKo8uJGqUI/AAAAAAAAARY/cZkhPfq1zM8/s400/eigenL.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;This &lt;a href="http://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors"&gt;equation&lt;/a&gt; and these concepts are not only central to &lt;a href="http://en.wikipedia.org/wiki/Linear_algebra"&gt;Linear Algebra&lt;/a&gt; but these Linear Algebraic ideas and others are both used and extend into many other areas of math including &lt;a href="http://en.wikipedia.org/wiki/Linear_transformation"&gt;Linear Transformations&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Graph_theory"&gt;Graphs&lt;/a&gt; in terms of matrices like the &lt;a href="http://en.wikipedia.org/wiki/Adjacency_matrix"&gt;Adjacency Matrix&lt;/a&gt; and much more.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href=""&gt;Linear Algebra&lt;/a&gt; is becoming increasingly central to the types of things we are doing in our profession, it is used heavily in &lt;a href="http://en.wikipedia.org/wiki/Statistics"&gt;Statistics&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Machine_learning"&gt;Machine Learning&lt;/a&gt; not to mention the &lt;a href="http://en.wikipedia.org/wiki/Page_rank"&gt;Page Rank Algorithm&lt;/a&gt; is based in part on this equation.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Pumping_Lemma" /&gt;&lt;br /&gt;
&lt;h2&gt;Pumping Lemma for Regular Languages&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/--UjYoIZ2Gy4/TtKpMS7ttEI/AAAAAAAAARw/m782_lhMsFo/s1600/PumpingLema.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="57" width="400" src="http://3.bp.blogspot.com/--UjYoIZ2Gy4/TtKpMS7ttEI/AAAAAAAAARw/m782_lhMsFo/s400/PumpingLema.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;No Comp Sci list would be complete with at least one formula from either &lt;a href="http://en.wikipedia.org/wiki/Formal_language"&gt;Formal Language Theory&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/Automata_Theory"&gt;Automata Theory&lt;/a&gt;.  The problem is that these two are pretty different from other areas of math in terms of "Equations" I tried to think of some basic Ideas and &lt;a href="http://en.wikipedia.org/wiki/Pumping_lemma_for_regular_languages"&gt;The Pumping Lemma&lt;/a&gt; came to mind, and I found the above formula concisely expressed on Wikipedia.  This version of the Pumping Lemma is a more limited version of Another Theory which is used to check whether a &lt;a href="http://en.wikipedia.org/wiki/Formal_grammar"&gt;Language&lt;/a&gt; is &lt;a href="http://en.wikipedia.org/wiki/Regular_language"&gt;Regular&lt;/a&gt;.  Also this is maybe not the best choice as it is pretty dense, if you want a better explanation I recommend &lt;a href="http://stackoverflow.com/questions/461619/in-laymens-terms-what-is-the-pumping-lemma"&gt;this&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;While this "equation" is pretty specialized, it is actually a special case of the more general Iteration Theorem, the real point here is really about more general domain knowledge.  It is central to what you do every day you are programming such as &lt;a href="http://en.wikipedia.org/wiki/Compiler"&gt;compilers&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Regular_expression"&gt;regular expressions&lt;/a&gt; not to mention the almost ubiquitous &lt;a href="http://en.wikipedia.org/wiki/Kleene_star"&gt;Kleene Star&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a name="Information_Entropy" /&gt;&lt;br /&gt;
&lt;h2&gt;Information Entropy&lt;/h2&gt;&lt;br /&gt;
&lt;p&gt;I confess after all my machinations to try to reduce Demorgan’s Laws down to less equations I am totally cheating here by pulling a twofer in including two formulas, both &lt;a href="http://en.wikipedia.org/wiki/Information_theory"&gt;Shannon’s Information Theory&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-m_cV_hocRqs/TtKpQmDQxhI/AAAAAAAAAR8/QZ2IEXBTCFA/s1600/Shannon.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="37" width="285" src="http://3.bp.blogspot.com/-m_cV_hocRqs/TtKpQmDQxhI/AAAAAAAAAR8/QZ2IEXBTCFA/s400/Shannon.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;And the formula for &lt;a href="http://en.wikipedia.org/wiki/Chaitin's_constant"&gt;Chaitin’s Constant&lt;/a&gt;, which is associated with &lt;a href="http://en.wikipedia.org/wiki/Algorithmic_information_theory"&gt;Algorithmic Information Theory&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Kolmogorov_complexity"&gt;Kolmogorov Complexity&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-f2pTyVUHz3Y/TtKpUIJ8J4I/AAAAAAAAASI/8VX0MsTzeqQ/s1600/Chaitin.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="39" width="114" src="http://1.bp.blogspot.com/-f2pTyVUHz3Y/TtKpUIJ8J4I/AAAAAAAAASI/8VX0MsTzeqQ/s400/Chaitin.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Interestingly this area has a parallel in the physical word, in terms of &lt;a href="http://en.wikipedia.org/wiki/Entropy"&gt;Thermodynamic Entropy&lt;/a&gt;, which also parallels the &lt;a href="http://en.wikipedia.org/wiki/Boltzmann%27s_entropy_formula"&gt;Boltzman Equation&lt;/a&gt; mentioned in the Wired Article.  &lt;a href="http://arxiv.org/abs/quant-ph/9908043"&gt;Seth Loyd&lt;/a&gt; draws some interesting &lt;a href="http://en.wikipedia.org/wiki/Limits_to_computation"&gt;connections&lt;/a&gt; between computation and the physical world&lt;a/&gt; including Entropy and Boltzman’s Equation.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;In programming and computer science information is our business and these ideas are central to many things that we deal with especially the storage, transmission, computational transformation (like &lt;a href="http://mattmahoney.net/dc/dce.html?year=2011#Section_1"&gt;compression&lt;/a&gt;), and computation of information.  We’ve already seen the possible relationship between both of these theories and Reusability and &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html"&gt;Software Frameworks&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Bayes_Theorem" /&gt;&lt;br /&gt;
&lt;h2&gt;Bayes' Theorem&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-YVZ2X0--nbo/TtKpYN2GRBI/AAAAAAAAASU/2YYh8v7eKxs/s1600/bayes.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="39" width="205" src="http://3.bp.blogspot.com/-YVZ2X0--nbo/TtKpYN2GRBI/AAAAAAAAASU/2YYh8v7eKxs/s400/bayes.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Of all of equations on the list, &lt;a href="http://en.wikipedia.org/wiki/Bayes'_theorem"&gt;Bayes' Theorem &lt;/a&gt; may stand out on its own merits as being one of the most recognizable and it might even qualify as a poster child for the statistical revolution sweeping our industry.  It rose from obscurity to being used for &lt;a href="http://www.paulgraham.com/better.html"&gt;spam detection&lt;/a&gt; and with such applications as &lt;a href="http://en.wikipedia.org/wiki/Classifier_(mathematics)"&gt;classifiers&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Machine_learning"&gt;Machine Learning&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Data_mining"&gt;Data Mining&lt;/a&gt; and more.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Mathematically it is part of a &lt;a href="http://en.wikipedia.org/wiki/Probability_interpretations"&gt;rift&lt;/a&gt; in statistics and probability and I confess I may not yet call myself "&lt;a href="http://www.codinghorror.com/blog/2007/04/an-initiate-of-the-bayesian-conspiracy.html"&gt;an initiate of the bayesian conspiracy&lt;/a&gt;" but it hard to deny its utility plus there seems to be a more axiomatic basis that relates to Boolean Logic Set Theory, which makes it all the more alluring.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Fermats_Little_Theorem" /&gt;&lt;br /&gt;
&lt;h2&gt;Fermat’s Little Theorem&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-E9IYaI654Aw/TtKpfbPogDI/AAAAAAAAASg/2DbPQBe7kwU/s1600/Fermat1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="22" width="309" src="http://2.bp.blogspot.com/-E9IYaI654Aw/TtKpfbPogDI/AAAAAAAAASg/2DbPQBe7kwU/s400/Fermat1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-nGl3qvRHqHA/TtKpjbK9n5I/AAAAAAAAASs/aMpMSBGczgY/s1600/Fermat2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="20" width="291" src="http://3.bp.blogspot.com/-nGl3qvRHqHA/TtKpjbK9n5I/AAAAAAAAASs/aMpMSBGczgY/s400/Fermat2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;These two equations of &lt;a href="http://en.wikipedia.org/wiki/Fermat%27s_little_theorem"&gt;Fermat’s Little Theorem&lt;/a&gt; are really the same equation written in two different forms, where (a &amp;perp; p) means coprime and (p &amp;isin; P) means prime.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;This is a beautiful little theorem in &lt;a href="http://en.wikipedia.org/wiki/Number_theory"&gt;Number Theory&lt;/a&gt; which can be generalized and written even more succinctly using &lt;a href="http://en.wikipedia.org/wiki/Euler%27s_totient_function"&gt;Eulers Totient Function&lt;/a&gt; which is represented by &amp;phi; (n): &lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Qhxat4y8d-g/TtKpzVUmQRI/AAAAAAAAAS4/R5MEoWwk7As/s1600/totient.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="25" width="165" src="http://4.bp.blogspot.com/-Qhxat4y8d-g/TtKpzVUmQRI/AAAAAAAAAS4/R5MEoWwk7As/s400/totient.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;These ideas are crucial for understanding encryption algorithms like &lt;a href="http://en.wikipedia.org/wiki/RSA_(algorithm)#Proof_using_Fermat.27s_Little_Theorem_and_Chinese_Remainder_Theorem"&gt;RSA&lt;/a&gt; and there’s this &lt;a href="http://en.wikipedia.org/wiki/Recurring_decimal#Fractions_with_prime_denominators"&gt;cool result&lt;/a&gt;.&lt;/p&gt;&lt;a name="Natural_Join" /&gt;&lt;br /&gt;
&lt;h2&gt;Natural Join&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-7E5rRgqBA1A/TtKp2w-D_ZI/AAAAAAAAATE/Ca9H0XCsqZE/s1600/NatL.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="20" width="213" src="http://3.bp.blogspot.com/-7E5rRgqBA1A/TtKp2w-D_ZI/AAAAAAAAATE/Ca9H0XCsqZE/s400/NatL.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Relational_algebra"&gt;Natural Join&lt;/a&gt;, like all of the Relational Algebra Join Operations is a composition of the more basic, operations: Selection (&amp;sigma;), Projection (&amp;pi;), Cartesian Product (&amp;times;), Set Difference (-) and Union (&amp;cup;).  Natural Join is the Cartesian Product of two tables selecting matching rows and eliminating duplicate columns.  (In the formula above the projection (&amp;pi;) is the set (A) of attributes with duplicates removed and then selects (&amp;sigma;) the set (C) of common attributes which match in both sets and are equal in both sets.)&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The Relational Algebra is in my opinion a bit of an odd beast when it comes to algebraic structures, but if you use SQL you are already using an implementation of it.  As data persistence becomes more heterogeneous I think understanding these concepts, will become more important.  Additionally Relational Algebra also has strong ties to Abstract Algebra[&lt;/a&gt; and Category Theory[&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Fixed_Point_Combinator" /&gt;&lt;br /&gt;
&lt;h2&gt;The Fixed-Point (Y) Combinator&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-JsWDcsVPJzM/TtKp8xuLctI/AAAAAAAAATQ/lyHdEG0gJxQ/s1600/Y.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="17" width="227" src="http://3.bp.blogspot.com/-JsWDcsVPJzM/TtKp8xuLctI/AAAAAAAAATQ/lyHdEG0gJxQ/s400/Y.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Just as we need a "equation" from Formal Language Theory or Automata Theory we really should have one that is related to &lt;a href="http://en.wikipedia.org/wiki/Lambda_calculus"&gt;Lambda Calculus&lt;/a&gt;, in this case this equation is in the untyped lambda calculus.  Even though the &lt;a href="http://en.wikipedia.org/wiki/Fixed-point_combinator"&gt;Fixed-point Combinator&lt;/a&gt; stands up on its own, it is fairly well known, well at least in name due to the use of it by &lt;a href="http://www.paulgraham.com/"&gt;Paul Graham&lt;/a&gt; for his incubator (&lt;a href="http://ycombinator.com/"&gt;Y-Combinator&lt;/a&gt;). &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The Fixed-Point Combinator allows one to implement anonymous recursion which is a powerful programming technique.  It also ties into some deeper theoretical aspects of computer science and logic such as &lt;a href="http://en.wikipedia.org/wiki/Combinatory_logic"&gt;Combinatory Logic&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="O_n" /&gt;&lt;br /&gt;
&lt;h2&gt;O(n)&lt;/h2&gt;&lt;br /&gt;
&lt;p&gt;Many CS majors may cringe at this, and another possible reaction is that’s not much of an equation.  There’s actually quite a bit to this for example did you know there are some substantial and quite beautiful equations associated with this seemingly simple formula.  They are:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-rRTU9GHz7Xg/TtKqOF2ceiI/AAAAAAAAATc/9FlV0g1SFvk/s1600/On1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="20" width="379" src="http://1.bp.blogspot.com/-rRTU9GHz7Xg/TtKqOF2ceiI/AAAAAAAAATc/9FlV0g1SFvk/s400/On1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-hMQPlPgOuFo/TtKqVQcSoxI/AAAAAAAAATo/Jizwxovmqrc/s1600/On2.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="47" width="333" src="http://4.bp.blogspot.com/-hMQPlPgOuFo/TtKqVQcSoxI/AAAAAAAAATo/Jizwxovmqrc/s400/On2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Also the following is a definition of (lim sup) &lt;a href="http://en.wikipedia.org/wiki/Limit_superior_and_limit_inferior"&gt;Limit Superior&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-BVsnr6J9H74/TtKq3QzX7JI/AAAAAAAAAUM/hm4TY-HM9HY/s1600/limitsup.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="32" width="364" src="http://1.bp.blogspot.com/-BVsnr6J9H74/TtKq3QzX7JI/AAAAAAAAAUM/hm4TY-HM9HY/s400/limitsup.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Where inf is &lt;a href="http://en.wikipedia.org/wiki/Infimum"&gt;infimum&lt;/a&gt; and sup is &lt;a href="http://en.wikipedia.org/wiki/Supremum"&gt;supremum&lt;/a&gt; two concepts that seem to show up quite a bit especially when you are concerned with bounds like with &lt;a href="http://en.wikipedia.org/wiki/Lattice_(order)"&gt;Lattices&lt;/a&gt; and they also seem to show up in relation to &lt;a href="http://en.wikipedia.org/wiki/Topology"&gt;Topology&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;And we all know why we should care about his one: Algorithms, Algorithms, Algorithms.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Eulers_Identity" /&gt;&lt;br /&gt;
&lt;h2&gt;Euler’s Identity&lt;/h2&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-sOx8imv9krw/TtKqawS-K3I/AAAAAAAAAT0/9uKKqYfa85o/s1600/Euler-identy.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="19" width="91" src="http://2.bp.blogspot.com/-sOx8imv9krw/TtKqawS-K3I/AAAAAAAAAT0/9uKKqYfa85o/s400/Euler-identy.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Euler's_identity"&gt;Euler’s Identity&lt;/a&gt; is also listed in Wired’s article and I have to agree that it is one the most beautiful and intriguing formulas in math.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now this isn’t really as relevant to CS as the other formulas but if you a true computer geek you are hopefully some kind of math geek, and this is such a great formula, not to mention that it appears in &lt;a href="http://en.wikipedia.org/wiki/Treehouse_of_Horror_VI"&gt;The Simpsons' Homer&lt;sup&gt;3&lt;/sup&gt;&lt;/a&gt;. It’s actually a specific case (where &amp;theta; = &amp;pi;) of &lt;a href="http://en.wikipedia.org/wiki/Euler%27s_formula"&gt;Euler’s Formula&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-908bQxyVSy4/TtKqfsHyYYI/AAAAAAAAAUA/zhSF4l1luVA/s1600/Euler-form.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="20" width="157" src="http://1.bp.blogspot.com/-908bQxyVSy4/TtKqfsHyYYI/AAAAAAAAAUA/zhSF4l1luVA/s400/Euler-form.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;These formulas will give one a better understanding complex numbers which are needed in other areas of advanced math also these formulas relate to &lt;a href="http://en.wikipedia.org/wiki/Fourier_analysis"&gt;Fourier Analysis&lt;/a&gt; which does have applications in Computer Science.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I am curious to see how well this list holds up, how will I feel about it in a year?  Also in writing this I realized that I still have quite a bit more to learn about at least half of this list, if not all of it, which made it hard to write as it was quite a little (unfinished) research project. I have already written individual articles on several of these equations and have at least two in the works for Linear Algebra, at least two on the Relational Algebra and one planned for Pascal’s Triangle, and those are just the ideas I’ve already had, who knows what the future holds.  I hope you enjoyed it as much as I did writing it. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;&amp;dagger;&lt;/sup&gt; The Set version may not apply to all cases in set theory, this assumes Union and Intersection over the &lt;a href="http://en.wikipedia.org/wiki/Power_set"&gt;Power Set&lt;/a&gt; of a &lt;a href="http://en.wikipedia.org/wiki/Universe_(mathematics)#In_set_theory"&gt;Set Universe&lt;/a&gt;, this would be &lt;a href="http://en.wikipedia.org/wiki/Closure_(mathematics)"&gt;closed&lt;/a&gt; under these operations and would include complements of all elements.  The Set Universe is the upper bound and the empty set is the lower bound.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-3552176205618998576?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/yirsKBYjuA8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/yirsKBYjuA8/eleven-equations-true-computer-science.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-O4a_eSkqeNE/TtKrcgal6zI/AAAAAAAAAUY/C8P7Ex09bhk/s72-c/Bayes%2527_Theorem_MMB_01.1.jpg" height="72" width="72" /><thr:total>36</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/11/eleven-equations-true-computer-science.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-235651697858759228</guid><pubDate>Sat, 22 Oct 2011 14:39:00 +0000</pubDate><atom:updated>2012-05-06T12:15:42.803-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Programming</category><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">Rant</category><category domain="http://www.blogger.com/atom/ns#">Software Development Teams</category><title>A Confederacy of Cargo Cult Coders</title><description>&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-zRDIvGUhPKc/TqLUbUEUPcI/AAAAAAAAAPo/QAG04yPtXo4/s1600/800px-JohnFrumCrossTanna1967.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="266" width="400" src="http://2.bp.blogspot.com/-zRDIvGUhPKc/TqLUbUEUPcI/AAAAAAAAAPo/QAG04yPtXo4/s400/800px-JohnFrumCrossTanna1967.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;!--A Confederacy of Cargo Cult Coders--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;I hate to say it but I feel that one of the biggest problems with Software Engineering is the prevalence of programmers who are &lt;a href="http://en.wikipedia.org/wiki/Cargo_cult_programming"&gt;Cargo Cult Coders&lt;/a&gt;.  Now I know this may seem a bit extreme but it is my feeling that many software projects suffer in part due to the fact that most developers are mediocre at best and there are quite a few developers some who are more senior who are "faking it" .  So before you call me a cynic or worse, think about this, it’s pretty well known that really good developers are really rare and good developers are rare.  So let’s assume for sake of argument that developer ability falls on the &lt;a href="http://en.wikipedia.org/wiki/Normal_distribution"&gt;Normal Distribution&lt;/a&gt;, I am not asserting that it does, that means the vast majority of developers fall into the average category it also runs along the lines of the &lt;a href="http://www.codinghorror.com/blog/2007/11/the-two-types-of-programmers.html"&gt;80/20 rule&lt;/a&gt; in that most developers range from average to bad.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Now I have seen these types of developers a fair amount and this is one possible down side of frameworks such as Spring and Hibernate.  If you read my blog you know that I am a big fan of frameworks and the concept in general, but they can be abused as can any other technique or methodology. The plus side of technologies like Spring and Hibernate is that good developers can quickly create large complex well engineered systems, of course mediocre and bad programmers can, by blindly implementing framework patterns, create large complex monstrosities.  I have seen cases where through the use of cutting and pasting of example code, bad programmers can create working systems with a limited understanding of the underlying technologies, I often use googled code snippets myself, but at least I understand the fundamentals and if I don’t fully understand what I am doing at the time I try to go back and learn more about how the underlying technology works.  Essentially these Cargo Cult Programmers are mostly just configuring boilerplate code and code snippets by trial and error within the confines of a framework.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;On one of my previous contracts I had the misfortune to work with perhaps one of the worst developers I have ever met, he was truly a consummate cargo cult coder, he was musician turned programmer&lt;sup&gt;1&lt;/sup&gt; with about eight years of professional experience.  He had zero understanding of Computer Science fundamentals and seemingly no understanding of good Software Engineering principles and yet during his career he had accumulated enough basic knowledge of Web Design, Javascript, Java, Spring, Hibernate, SQL and various other technologies and components to cobble together enterprise applications.  Ironically his ability to create these applications was actually somewhat impressive, as long as you didn’t look at the code.  I think the scariest thing about this developer is that he had garnered a &lt;a href="http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect"&gt;false sense&lt;/a&gt; of the level of his abilities which he would project, which in turn would cause others to falsely believe that he was a highly competent developer.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I use this particular developer as an example, but this is a trend that I am seeing, developers who now claim themselves as "senior level" because they have gained proficiency as cargo cult coders, but when you see their non boilerplate code it will often demonstrate an egregious lack of knowledge of basic concepts like cohesion, coupling, inheritance, basic OOP design, threading, the underlying workings of the framework technologies themselves, etc.  I think the biggest danger is the complacency and perhaps &lt;a href="http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect"&gt;self delusion&lt;/a&gt; or naivety which can even manifest itself as hubris, that these developers acquire from this limited perspective, in fact it is ultimately self limiting behavior because all new technologies and languages are then viewed in the same narrow context, usually as another resume bullet, practitioners of what I call &lt;a href="http://www.elegantcoding.com/2011/05/driven-development.html#RDD"&gt;RDD (Resume Driven Development)&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;I believe that you can boil down what makes a good developer to two relatively simple things, one is ability and the other is desire.  Ability is a complex web of inherent skill, intellect including a good memory, experience etc. and desire is the hunger for knowledge and aspiration to want to improve one’s skill and the passion to find better ways to do things. In some ways the two go hand in hand but not always, the "consummate cargo cult coder" from above had a high degree of passion, but he was stubborn and did not work well with others and was unable to take advantage of the opportunity to benefit from the knowledge of others, I actually found his situation to be somewhat tragic.  The other side is people who are talented who lack desire, ironically I have been accused of this one, it’s usually not due to my lack of desire, I just sometimes find what I am working on to be boring which in turn can cause me to lag in terms of productivity, fortunately this is fairly aberrant behavior for me.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Sadly I have recently been on some pretty dysfunctional teams and I feel the biggest tragedy is that on those teams there have been developers in whom I saw that they could be more than they were on the project, but they mainly lacked guidance, which I could not provide due to team’s dynamics.  This type of situation is really a double tragedy, it is tragic for the developer in that a better opportunity for the developer is missed, and it is a missed opportunity for project, the team, and the management of the team as they could have a had a better developer who was producing better quality code.  I guess what I am saying is that there should be a way to try to avoid wasting developer potential, I think this is some of what &lt;a href="http://agilemanifesto.org/principles.html"&gt;Agile Process&lt;/a&gt; tries to achieve.  "Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done." I think this should be taken further to try maximize each developer’s skill and inspire their inherent passion and to kindle increased passion to maximize the efficiency of the team.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;If you are lucky the cargo cult coders on your team are just plodding along and hopefully not messing up your codebase too much and are the ones who just need that extra guidance or encouragement. Unfortunately they can do far worse damage, there are many out there who have been getting by for many years and have formed overrated opinions of themselves, these are the worst, not only can they disrupt the software structure they can often disrupt the team dynamics and create more substantial problems, in my &lt;a href="http://www.elegantcoding.com/2011/05/driven-development.html"&gt;Driven Development&lt;/a&gt; post I mentioned developers who I was in conflict with creating a &lt;a href="http://www.elegantcoding.com/2011/05/driven-development.html#CDD"&gt;CDD (Cognitive Dissonance Development)&lt;/a&gt; environment, they were cargo cult coders who had taken very defensive and recalcitrant positions, you couldn’t reason with them because if you tried to talk about good design principles or standard practices you were speaking a language they did not understand, they only saw software development as learning some new technology that they could then claim to be experts in.  They will pollute your system with redundant inconsistent shoddy code that will degrade its quality, performance and maintainability.  Worst yet, they will be excessively defensive in the face of criticism, which makes code reviews hard if not impossible, and since they don’t read or understand good engineering principles they often argue against them.  Also they will often disrupt the team dynamics and poison it with their defensive and sometimes arrogant behavior this can result in the team becoming highly dysfunctional which can create a toxic working environment that is hostile to good developers and is the opposite of the optimal environment in that the team will not function as whole that is greater than the sum of its parts it will function as whole that is less than the sum of its parts.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; I have worked with plenty of non-technical/non-CS converts and there are some who are good and go the extra mile to learn the basics and beyond.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-235651697858759228?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/-YeuBhgJHgU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/-YeuBhgJHgU/confederacy-of-cargo-cult-coders.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-zRDIvGUhPKc/TqLUbUEUPcI/AAAAAAAAAPo/QAG04yPtXo4/s72-c/800px-JohnFrumCrossTanna1967.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/10/confederacy-of-cargo-cult-coders.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-4349239778944383067</guid><pubDate>Tue, 18 Oct 2011 22:03:00 +0000</pubDate><atom:updated>2012-05-06T12:32:02.137-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Programming</category><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Big O</category><category domain="http://www.blogger.com/atom/ns#">Computer Science</category><title>O(log(n))</title><description>&lt;br /&gt;
&lt;style&gt;
div.source-code {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px dashed #999999;
    line-height       : 13px;
    padding           : 1px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
}

div.source-code p {

    padding-top       : 5px;
    padding-bottom    : 5px;
    margin-top        : 2px;
    margin-bottom     : 2px;
}

ol.olbold { font-weight : bold; }

p.ptight {
    padding-top       : 2px;
    padding-bottom    : 2px;
    margin-top        : 2px;
    margin-bottom     : 2px;
}
&lt;/style&gt;&lt;!-- O(log(n)) --&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-y8MsXWI-u4g/TpR4rcrpK5I/AAAAAAAAAPc/iY256j2Xz-w/s1600/800px-Messier51_sRGB.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="278" width="400" src="http://1.bp.blogspot.com/-y8MsXWI-u4g/TpR4rcrpK5I/AAAAAAAAAPc/iY256j2Xz-w/s400/800px-Messier51_sRGB.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;I find O(log(n)) to be a very interesting algorithm complexity, it’s also highly desirable and if you achieve it you are probably doing well, or you are just using a couple of common time tested algorithms and data structures such as Binary Search or [&lt;a href="http://en.wikipedia.org/wiki/Self-balancing_binary_search_tree"&gt;Self&lt;/a&gt;] &lt;a href="http://en.wikipedia.org/wiki/Binary_tree"&gt;Balanced Binary Trees&lt;/a&gt; like &lt;a href="http://en.wikipedia.org/wiki/Red%E2%80%93black_tree"&gt;Red Black&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/AVL_tree"&gt;AVL&lt;/a&gt; trees.  The order of &lt;a href="http://en.wikipedia.org/wiki/Big_O_notation"&gt;Big O Complexities&lt;/a&gt; is:&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;table border="1" cellpadding="4" cellspacing="0"&gt;&lt;tr&gt;     &lt;td width="188"&gt;O(1)&lt;/td&gt;     &lt;td width="328"&gt;constant&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(log log n)&lt;/td&gt;     &lt;td width="328"&gt;Double Logarithmic&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(log n)&lt;/td&gt;     &lt;td width="328"&gt;Logarithmic&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(n&lt;sup&gt;m&lt;/sup&gt;)  0 &amp;lt; m &amp;lt; 1&lt;/td&gt;     &lt;td width="328"&gt;fractional power&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(n)&lt;/td&gt;     &lt;td width="328"&gt;Linear&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(n log n) = O(log n!)&lt;/td&gt;     &lt;td width="328"&gt;Loglinear&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(n&lt;sup&gt;2&lt;/sup&gt;)&lt;/td&gt;     &lt;td width="328"&gt;Quadratic&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(n&lt;sup&gt;3&lt;/sup&gt;)&lt;/td&gt;     &lt;td width="328"&gt;Cubic&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(n&lt;sup&gt;m&lt;/sup&gt;)  m &amp;gt; 1&lt;/td&gt;     &lt;td width="328"&gt;(general) polynomial (m is a fixed, non-negative integer; e.g. n&lt;sup&gt;4&lt;/sup&gt;, n&lt;sup&gt;5&lt;/sup&gt;)&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(m&lt;sup&gt;n&lt;/sup&gt;)&lt;/td&gt;     &lt;td width="328"&gt;exponential (m &amp;gt;= 2; ; e.g. 2&lt;sup&gt;n&lt;/sup&gt;, 3&lt;sup&gt;n&lt;/sup&gt;)&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;     &lt;td width="188"&gt;O(n!)&lt;/td&gt;     &lt;td width="328"&gt;Factorial&lt;/td&gt; &lt;/tr&gt;
&lt;/table&gt;&lt;br /&gt;
&lt;p&gt;When I was growing up and hand held calculators were quickly evolving much like smart phones are now, although perhaps not as rapidly, my father would bring these calculators home and I would play with them, this was my first exposure to logarithms when I got to high school I learned more about them including some of the &lt;a href="http://en.wikipedia.org/wiki/List_of_logarithmic_identities"&gt;identities&lt;/a&gt;.&amp;nbsp; Actually I find the Logarithmic Identities to be quite interesting and have found them important in understanding logarithms which are useful in understanding other areas of science and math.&amp;nbsp; I even used to use log base 10 to calculate the number of digits of numbers for print formatting way back before we had better ways to do number formatting&lt;sup&gt;&amp;dagger;&lt;/sup&gt;, &lt;nobr&gt;&amp;lceil;log&lt;sub&gt;10&lt;/sub&gt;(n)&amp;rceil;&lt;/nobr&gt;, of any base 10 number is its number of digits, where &lt;nobr&gt;&amp;lceil;x&amp;rceil;&lt;/nobr&gt; is the &lt;a href="http://en.wikipedia.org/wiki/Floor_and_ceiling_functions"&gt;ceiling function&lt;/a&gt;.    Also many common measurements like the &lt;a href="http://en.wikipedia.org/wiki/Richter_magnitude_scale"&gt;Richter Scale&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wikiH"&gt;pH&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Decibel"&gt;Decibel&lt;/a&gt;   among other things are  &lt;a href="http://en.wikipedia.org/wiki/Logarithmic_scale"&gt;logarithmic scale&lt;/a&gt;.  Also we have previously encountered logs in relation to  &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html"&gt;information entropy&lt;a/&gt;.  Some useful logarithmic identities are: &lt;/p&gt;&lt;br /&gt;
&lt;ol class="olbold"&gt;&lt;li&gt;y = log&lt;sub&gt;b&lt;/sub&gt;(x) if and only if x = b&lt;sup&gt; y&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;log&lt;sub&gt;b&lt;/sub&gt;(1) = 0&lt;/li&gt;
&lt;li&gt;log&lt;sub&gt;b&lt;/sub&gt;(b) = 1&lt;/li&gt;
&lt;li&gt;-log&lt;sub&gt;b&lt;/sub&gt;(x) = log&lt;sub&gt;b&lt;/sub&gt;(1/x)&lt;/li&gt;
&lt;li&gt;log&lt;sub&gt;b&lt;/sub&gt;(x*y) = log&lt;sub&gt;b&lt;/sub&gt;(x) + log&lt;sub&gt;b&lt;/sub&gt;(y)&lt;/li&gt;
&lt;li&gt;log&lt;sub&gt;b&lt;/sub&gt;(x/y) = log&lt;sub&gt;b&lt;/sub&gt;(x) - log&lt;sub&gt;b&lt;/sub&gt;(y)&lt;/li&gt;
&lt;li&gt;log&lt;sub&gt;b&lt;/sub&gt;(x&lt;sup&gt;n&lt;/sup&gt;) = n log&lt;sub&gt;b&lt;/sub&gt;(x)&lt;/li&gt;
&lt;li&gt;log&lt;sub&gt;b&lt;/sub&gt;(x) = log&lt;sub&gt;b&lt;/sub&gt;(c) * log&lt;sub&gt;c&lt;/sub&gt;(x)&lt;/li&gt;
&lt;li&gt;log&lt;sub&gt;b&lt;/sub&gt;(x) = log&lt;sub&gt;c&lt;/sub&gt;(x) / log&lt;sub&gt;c&lt;/sub&gt;(b)&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;p&gt;The first one demonstrates the relation between the functions of logarithm and exponentiation, as you can see the value y, which is log base b of the value x, is the exponent to raise b to get the value x, so a logarithm is just a way to get the exponent. Log base 10 of 100 is 2, log&lt;sub&gt;10&lt;/sub&gt;(100) = 2, since 10 to second power is 100, 10&lt;sup&gt;2&lt;/sup&gt; = 100.&amp;nbsp; Log base b of y, x = log&lt;sub&gt;b&lt;/sub&gt;(y) is inverse function of raising b to the y power, x=b&lt;sup&gt;y&lt;/sup&gt;, so:&lt;/p&gt;&lt;p&gt;&lt;b&gt;b&lt;sup&gt; log&lt;sub&gt;b&lt;/sub&gt;(x)&lt;/sup&gt; = x&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Another interesting observation that one can draw from the logarithmic identities is the answer to the question:&amp;nbsp; What is the difference between O(log&lt;sub&gt;2&lt;/sub&gt;(x))&amp;nbsp; and O(log&lt;sub&gt;10&lt;/sub&gt;(x))?  It’s a little trick question that I like. The answer is they are the same.&amp;nbsp; Using the second to last identity (#8):&lt;/p&gt;&lt;br /&gt;
&lt;div style="text-indent:.5in"&gt;&lt;p&gt;O(log&lt;sub&gt;2&lt;/sub&gt;(x))  =  O(log&lt;sub&gt;2&lt;/sub&gt;(10) * log&lt;sub&gt;10&lt;/sub&gt;(x))&lt;/p&gt;&lt;p&gt;Since log&lt;sub&gt;2&lt;/sub&gt;(10) is a constant:&lt;/p&gt;&lt;p&gt;O(log&lt;sub&gt;2&lt;/sub&gt;(x))  =  O(log&lt;sub&gt;10&lt;/sub&gt;(x))&lt;/p&gt;&lt;p&gt;Pretty cool!&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;This would also work with the second to last identity (#9) as well and remember that Big O notation is about [asymptotic] growth, so equals in the case of Big O notation is not the same as equals e.g. log&lt;sub&gt;2&lt;/sub&gt;(x) &amp;ne; log&lt;sub&gt;10&lt;/sub&gt;(x). Also for small quantities like the examples in this article, the base does make a difference.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Simlarily exponetiation has its &lt;a href="http://mathworld.wolfram.com/ExponentLaws.html"&gt;identities&lt;/a&gt; as well:&lt;/p&gt;&lt;br /&gt;
&lt;ol class="olbold"&gt;&lt;li&gt;b&lt;sup&gt;0&lt;/sup&gt; = 1&lt;/li&gt;
&lt;li&gt;b&lt;sup&gt;1&lt;/sup&gt; = b&lt;/li&gt;
&lt;li&gt;b&lt;sup&gt;-n&lt;/sup&gt; = 1/b&lt;sup&gt;n&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;b&lt;sup&gt;m&lt;/sup&gt;b&lt;sup&gt;n &lt;/sup&gt;= b&lt;sup&gt;m+n&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;b&lt;sup&gt;m&lt;/sup&gt;/b&lt;sup&gt;n &lt;/sup&gt;= b&lt;sup&gt;m-n&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;(b&lt;sup&gt;m&lt;/sup&gt;)&lt;sup&gt;n&lt;/sup&gt; = b&lt;sup&gt;mn&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;(b/b)&lt;sup&gt;n&lt;/sup&gt; = b&lt;sup&gt;n&lt;/sup&gt;/b&lt;sup&gt;n&lt;/sup&gt;&lt;/li&gt;
&lt;li&gt;(b/a)&lt;sup&gt;-n&lt;/sup&gt; = (a/b)&lt;sup&gt;n&lt;/sup&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-7F_TXm6YNn4/TpRftEVpYnI/AAAAAAAAAPE/Fk2lxq-OXv8/s1600/BinaryTree.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="210" width="400" src="http://4.bp.blogspot.com/-7F_TXm6YNn4/TpRftEVpYnI/AAAAAAAAAPE/Fk2lxq-OXv8/s400/BinaryTree.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The binary tree structure (a &lt;a href="http://en.wikipedia.org/wiki/Rooted_tree"&gt;rooted acyclic graph&lt;/a&gt;) visually illustrates O(log(n)) and the inverse function relationship between logarithms and exponentiation.&amp;nbsp; The diagram above shows a complete&lt;sup&gt;&amp;Dagger;&lt;/sup&gt; and therefore &lt;a href="http://en.wikipedia.org/wiki/Binary_tree"&gt;balanced&lt;/a&gt; binary tree structure.&amp;nbsp; As you can see the number of items in each row grows exponentially as powers of two, shown in red, also the total number of elements in the tree as each row is added grows in the same exponential fashion, denoted in square braces.&amp;nbsp; So in a balanced tree you will fill all of the n rows up to the 2&lt;sup&gt;n&lt;/sup&gt; – 1 item, and when that number is exceeded (greater than or equal to 2&lt;sup&gt;n&lt;/sup&gt;) a new (n + 1) row will be added.&amp;nbsp;&amp;nbsp; Now the growth is not necessarily exponential, you can add items at any rate, but the structure in which items are stored are broken down along “exponential row boundaries”.&amp;nbsp;&amp;nbsp; So to search 2&lt;sup&gt;4&lt;/sup&gt; – 1 (15) items for the number 7 value we would traverse 8-4-6-7, shown in green, which is 4 nodes, this is the maximum searches for this tree, a search can also be 1,2, or 3 depending on the depth of the item.  Since 4 the exact exponent of the total size of the graph, which is [2&lt;sup&gt;4&lt;/sup&gt;-1], and therefore the log: [log&lt;sub&gt;2&lt;/sub&gt;(2&lt;sup&gt;4&lt;/sup&gt;-1) = 3.9…], almost 4, our max traversal, O(log(2&lt;sup&gt;n&lt;/sup&gt;-1)) = O(log(2&lt;sup&gt;n&lt;/sup&gt;)).  Since we know that these two functions are inverses this illustrates O(log(n)) in visual terms. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The &lt;a href="http://en.wikipedia.org/wiki/Binary_search_algorithm"&gt;Binary Search&lt;/a&gt; algorithm has similar log base 2 characteristics, if you remember the algorithm it takes list which has to be ordered, and it repeatedly halves the length of the remaining items and checks the element at each new position, if it is equal  you are done, if it is not then depending on whether the search value is greater or less than the midpoint value you then half the bottom or top of the list respectively and repeat the process. This is better illustrated by the following Java code: &lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;public static int binarySearch(int value, int[] array) {&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;int min = 0;&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;int max = array.length - 1;&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;while (min &amp;lt;= max) {&lt;/p&gt;&lt;p style="text-indent:1in"&gt;int mid = min + (max - min) / 2;&lt;/p&gt;&lt;p style="text-indent:1in"&gt;if (value &amp;lt; array[mid])&lt;/p&gt;&lt;p style="text-indent:1.5in"&gt;max = mid - 1;&lt;/p&gt;&lt;p style="text-indent:1.5in"&gt;else if (value &amp;gt; array[mid])&lt;/p&gt;&lt;p style="text-indent:1.5in"&gt;min = mid + 1;&lt;/p&gt;&lt;p style="text-indent:1in"&gt;else&lt;/p&gt;&lt;p style="text-indent:1.5in"&gt;return mid;&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;}&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;return -1;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;The following recursive code example is both more elegant and gives a more intuitive feel for the &lt;a href="http://en.wikipedia.org/wiki/Divide_and_conquer_algorithm"&gt;Divide and Conquer&lt;/a&gt; nature of the algorithm.  Also it is this Divide and Conquer behavior that breaks the list apart logarithmically.&lt;/p&gt;&lt;br /&gt;
&lt;div class="source-code"&gt;&lt;p&gt;public static int binarySearch(int value, int[] array) {&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;returnbinarySearch(value, array, 0, array.length – 1);&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;public static intbinarySearch(int value, int[] array, int min, int max) {&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;if (max &amp;lt; min)&lt;/p&gt;&lt;p style="text-indent:1in"&gt;return -1;&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;int mid = min + (max - min) / 2;&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;if (array[mid] &amp;gt; value)&lt;/p&gt;&lt;p style="text-indent:1in"&gt;return binarySearch(value, array, min, mid - 1);&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;else if (key &amp;gt; array[mid])&lt;/p&gt;&lt;p style="text-indent:1in"&gt;return binarySearch(value, array, mid + 1, max);&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;return mid;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;Let's view a search visually:&lt;/p&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-CUDYQ0WfpvY/TpRfzYQzTMI/AAAAAAAAAPQ/dAbgsyM--bM/s1600/BinarySearch.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="192" width="400" src="http://3.bp.blogspot.com/-CUDYQ0WfpvY/TpRfzYQzTMI/AAAAAAAAAPQ/dAbgsyM--bM/s400/BinarySearch.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;In our search for the value 7 in our 16 item list we first go to 8, which is too large, then to 4 which is too small and then to 6, and then 7, at each point in our search the size of what remains to be searched is half of the size of the previous search space. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;In our visual example needed to search 4 positions (8, 4, 6, 7) and log&lt;sub&gt;2&lt;/sub&gt;(16) = 4 which is O(log(n)).&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;An interesting side note is that many binary search algorithms are broken due to possible overflow problems with integers, as pointed out in a blog post by Joshua Bloch, I account for the issue, you can read more about it &lt;a href="http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;sup&gt;&amp;dagger;&lt;/sup&gt; Due to computing a logarithm, this may not be optimally efficient.&lt;/p&gt;&lt;p&gt;&lt;sup&gt;&amp;Dagger;&lt;/sup&gt; Complete in this context means that all positions up to and including 2&lt;sup&gt;n&lt;/sup&gt;-1 positions are filled, i.e. have a node.  Also it should be noted that Self Balancing algorithms may not yield such a well balanced tree and it might have more rows for 15 items, but it is still O(log(n)).&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-4349239778944383067?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/ocb3H9vl-GE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/ocb3H9vl-GE/ologn.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-y8MsXWI-u4g/TpR4rcrpK5I/AAAAAAAAAPc/iY256j2Xz-w/s72-c/800px-Messier51_sRGB.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/10/ologn.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-1211700559481524989</guid><pubDate>Sun, 21 Aug 2011 22:55:00 +0000</pubDate><atom:updated>2012-05-06T12:11:35.387-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">Agile</category><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><category domain="http://www.blogger.com/atom/ns#">Software Development Teams</category><title>You can control what you can’t measure</title><description>&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}
&lt;/style&gt;    &lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-JFxoeOMj49o/TlGKQXUu_9I/AAAAAAAAAO8/_ZZ8eVYxDkk/s1600/IMG_2905.JPG" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://3.bp.blogspot.com/-JFxoeOMj49o/TlGKQXUu_9I/AAAAAAAAAO8/_ZZ8eVYxDkk/s400/IMG_2905.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt; &lt;!--You can control what you can’t measure--&gt;  &lt;p&gt;A couple of years ago, Tom Demarco published a brief article titled: "&lt;a href="http://www2.computer.org/cms/Computer.org/ComputingNow/homepage/2009/0709/rW_SO_Viewpoints.pdf"&gt;Software Engineering:An Idea Whose Time Has Come and Gone?&lt;/a&gt;". Now I know this is old news, and in it he claims that the role of measurement and hence control has not been a factor in some notable successful projects, he cites Google Earth and Wikipedia, now I cannot comment on those or many famous successful projects as I have no firsthand knowledge, however, I suspect that control has been important it just was not employed as he has anticipated and as he points out he is no longer involved in hands on development. So perhaps the premise of the famous quote "You can’t control what you can’t measure" is what is flawed.  I believe that the majority of successful software projects and successful companies built around successful software have exhibited at least some if not a large degree of control over the both the software construction process and the software structure.  I admit my assertion is tenuous at best as I have very little data to support this but I do have what I consider some interesting anecdotal support.&lt;/p&gt;&lt;p&gt;My own experience also tells me this is true, I am not well versed in the world of &lt;a href="http://en.wikipedia.org/wiki/Software_metric"&gt;software metrics&lt;/a&gt; but what we have see m to be largely unwieldy and even potentially dubious (&lt;a href="http://en.wikipedia.org/wiki/Source_lines_of_code"&gt;KSLOC&lt;/a&gt;)  not to mention a lack of tooling and methodologies to apply them.  Still I feel that I can look at code base and make "aesthetic" judgments about good and bad, &lt;a href="http://en.wikipedia.org/wiki/Cohesion_(computer_science)"&gt;cohesion&lt;/a&gt; and  &lt;a href="http://en.wikipedia.org/wiki/Coupling_(computer_programming)"&gt;coupling&lt;/a&gt; are fairly abstract, understanding them can shed light on how to &lt;a href="http://en.wikipedia.org/wiki/Code_refactoring"&gt;refactor&lt;/a&gt; code to improve it and to give a general indication of quality.  In looking at code, both good and bad patterns emerge and can be utilized to assess and improve a code base.  One thing I can often do is reduce code size by refactoring general code into a framework and refactor it to more effectively use API’s like the Java API and API’s like Apache’s StringUtil and DateUtil classes or things like effectively employing the Spring Framework’s data binding.  Also code can often be better abstracted by  &lt;a href="http://en.wikipedia.org/wiki/Object_composition"&gt;composition&lt;/a&gt;,  &lt;a href="http://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)"&gt;inheritance&lt;/a&gt; and general  &lt;a href="http://en.wikipedia.org/wiki/Modular_programming"&gt;modularization&lt;/a&gt; and the use of &lt;a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)"&gt;patterns&lt;/a&gt;  like the &lt;a href="http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)"&gt;SOLID principles&lt;/a&gt;. These are all things that even the best developers occasionally miss, I often apply these refactoring to my own code as well, and if you are a good practitioner, what I am saying here is probably what you do every day.&lt;/p&gt;&lt;p&gt;While my personal control has mostly been limited to small and midsize projects and I can tell you that I have received some complements about my work to create cleaner more structured systems, my professional experience pales in comparison to that of others and I find their stories more interesting as you probably do also.  I’ll start with Steve Yegge’s  "&lt;a href="http://steve-yegge.blogspot.com/2008/06/done-and-gets-things-smart.html"&gt;Done, and Gets Things Smart&lt;/a&gt;" post where he talks, not about his role, but his observations about what went on at Google: &lt;/p&gt;&lt;blockquote class="quote"&gt;&lt;p&gt;... but I've realized that one of the Google seed engineers (exactly one) is almost singlehandedly responsible for the amazing quality of Google's engineering culture. And I mean both in the sense of &lt;b&gt;&lt;span style="color:#0070C0"&gt;having established it, and also in the sense of keeping the wheel spinning&lt;/span&gt;&lt;/b&gt;. ... &lt;b&gt;Done, and Gets Things Smart&lt;/b&gt; folks aren't necessarily your friends. They're just people you're lucky enough to have worked with.&lt;/p&gt;&lt;a name="EngineeringDiscipline"&gt;&lt;/a&gt; &lt;p&gt;At first it's entirely non-obvious who's responsible for Google's &lt;b&gt;&lt;span
style="color:#0070C0"&gt;culture of engineering discipline: the design docs, audited code reviews, early design reviews, readability reviews, resisting introduction of new languages, unit testing and code coverage, profiling and performance testing, etc.&lt;/span&gt;&lt;/b&gt; You know. The whole gamut of processes and tools that quality engineering organizations use &lt;b&gt;&lt;span
style="color:#0070C0"&gt;to ensure that code is open, readable, documented, and generally non-shoddy work&lt;/span&gt;&lt;/b&gt;. &lt;/p&gt;&lt;p&gt;But if you keep an eye on the emails that go out to Google's engineering staff, over time a pattern emerges: &lt;/span&gt;&lt;b&gt;&lt;span style="color:#0070C0"&gt;there's one superheroic dude who's keeping us all in line&lt;/span&gt;&lt;/b&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;The black bolding is his and the blue bolding is my highlighting. Clearly this demonstrates a pretty high degree of control.  The next comes from Martin Fowler’s  "&lt;a href="http://martinfowler.com/ieeeSoftware/whoNeedsArchitect.pdf"&gt;Who Needs an Architect?&lt;/a&gt;": &lt;/p&gt;&lt;blockquote class="quote"&gt;&lt;p&gt;Architectus Oryzus [is the] kind of architect &lt;b&gt;&lt;span style="color:#0070C0"&gt;must be very aware of what's going on in the project, looking out for important issues and tackling them before they become a serious problem&lt;/span&gt;&lt;/b&gt;. &lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;p&gt;In many ways, the most important activity of Architectus Oryzus is to mentor the development team, to raise their level &lt;b&gt;&lt;span style="color:#0070C0"&gt;so that they can take on more complex issues&lt;/span&gt;&lt;/b&gt;. Improving the development team's ability gives an architect much greater leverage than being the sole decision maker and thus running the risk of being an architectural bottleneck. This leads to the satisfying rule of thumb that an architect's value is inversely proportional to the number of decisions he or she makes.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;A similar sentiment is found in &lt;b&gt;&lt;u&gt;Lean Software Development: An Agile Toolkit&lt;/u&gt;&lt;/b&gt; By Mary Poppendieck and Tom Poppendieck:&lt;/p&gt;&lt;blockquote class="quote"&gt; &lt;span style="font-size:16px"&gt;&lt;b&gt;Master Developers&lt;/b&gt;&lt;/span&gt;  &lt;p&gt;In an extensive study of large system design, &lt;sub&gt;[22]&lt;/sub&gt; Bill Curtis and his coauthors found that for most large systems, &lt;/span&gt;&lt;b&gt;&lt;span style="color:#0070C0"&gt;a single or small team of exceptional designers emerge to assume primary responsibility for the design&lt;/span&gt;&lt;/b&gt;. Exceptional designers exercise leadership through their superior knowledge rather than bestowed authority. Their deep understanding of both the customers and the technical issues gain them the respect of the development team. Exceptional designers are people who are extremely familiar with the application domain and are skilled at communicating their technical vision to the development team. They are usually consumed with the success of &lt;i&gt;their &lt;/i&gt;systems.&lt;/p&gt;&lt;p class=docfootnote&gt;&lt;sup&gt;[22]&lt;/sup&gt;&lt;span style="color:#5E5E5E"&gt;Curtis, Kransner, and Iscoe, &amp;quot;A field Study of the Software Design Process for Large Systems,&amp;quot; 1272. &lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Another person who seems to support this is Joshua Block in his talk about API design, I have already blogged about that and the relevant quote is &lt;a href="http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html#DesignLead"&gt;here&lt;/a&gt;.   Also John Carmack of Id Software talks about controlling the software &lt;a href="http://www.youtube.com/watch?v=4zgYG-_ha28&amp;amp;feature=player_detailpage#t=54m00s"&gt;development process&lt;/a&gt;,  among other things, and he makes many points that I think jibe with my control argument.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;I my opinion these all show that good control does occur but it’s probably done more intuitively and it is more art than science and probably occurs without traditional metrics. That is why software projects can be insanely successful without measurement.  Actually it is my experience that control and success is not a binary relation in that control does not unconditionally imply success but rather it is a continuum such that control increases the probability of success.  Also I am not saying that software metrics is an idea whose time has come and gone, actually I believe quite the opposite, but that is another topic for another time. Another takeaway from these quotes is that having the right people and empowering them in that very critical role is a very important point in software management, again another entire topic. &lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-1211700559481524989?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/A9J6WV4-hsc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/A9J6WV4-hsc/you-can-control-what-you-cant-measure.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-JFxoeOMj49o/TlGKQXUu_9I/AAAAAAAAAO8/_ZZ8eVYxDkk/s72-c/IMG_2905.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/08/you-can-control-what-you-cant-measure.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-4488049621253920919</guid><pubDate>Fri, 19 Aug 2011 18:38:00 +0000</pubDate><atom:updated>2012-05-06T12:32:33.306-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Programming</category><category domain="http://www.blogger.com/atom/ns#">Graph Theory</category><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Computer Science</category><title>The Object Graph</title><description>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-V1aqbRnu-AI/Tk6sN0ObPDI/AAAAAAAAAOc/_T47TpT10ao/s1600/Image-Koenigsberg%252C_Map_by_Merian-Erben_1652.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="278" width="400" src="http://3.bp.blogspot.com/-V1aqbRnu-AI/Tk6sN0ObPDI/AAAAAAAAAOc/_T47TpT10ao/s400/Image-Koenigsberg%252C_Map_by_Merian-Erben_1652.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--The Object Graph--&gt;  &lt;p&gt;In the &lt;a href="http://en.wikipedia.org/wiki/Object-relational_mapping"&gt;ORM&lt;/a&gt; world, e.g. &lt;a href="http://www.hibernate.org/"&gt;Hibernate&lt;/a&gt;, the term &lt;a href="http://en.wikipedia.org/wiki/Object_graph"&gt;Object Graph&lt;/a&gt; is used quite a bit and it is a powerful notion, however, I suspect that Object Graph often gets used without much thought to some of the underlying concepts.  Generally the term refers to an Object, usually a Domain Object which often contains other Domain Objects and/or Collections of other Domain Objects via &lt;a href="http://en.wikipedia.org/wiki/Object_composition"&gt;composition&lt;/a&gt;.  With an ORM like Hibernate very complex Object Graphs can be read, altered and persisted with very little work, it is a effective concept that can make building applications both easy and elegant especially if you have the proficiency and forethought to design your mappings properly.&lt;/p&gt;&lt;p&gt;In order to talk more intelligently about some of the underlying concepts regarding the Object Graph it is helpful to get a few fundamentals of &lt;a href="http://en.wikipedia.org/wiki/Graph_theory"&gt;Graph Theory&lt;/a&gt; out of the way, if you know them feel free to skip ahead.  Actually this is a good opportunity to put them in a context that may be more intuitive for many developers.  Graph Theory is an abstraction, a framework if you will, built on top of &lt;a href="http://en.wikipedia.org/wiki/Set_theory"&gt;Set Theory&lt;/a&gt;, however, we don’t need to get bogged down in a Set based definition here, I do encourage you to pursue this on your own as it is extremely seminal and becoming increasingly essential.  We just need to get four fairly simple &lt;a href="http://en.wikipedia.org/wiki/Graph_(mathematics)"&gt;graph&lt;/a&gt; concepts out of the way which can be explained easily and visually, they are: The difference between a simple graph and a multi graph, the difference between a cyclic graph and an acyclic graph, the definition of a directed graph, and the definition of a tree.   Let’s start with the graphs:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-TdmUcaHn2XI/Tk6sTuwEBjI/AAAAAAAAAOk/XlT0sfUdl58/s1600/graphType.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="320" src="http://3.bp.blogspot.com/-TdmUcaHn2XI/Tk6sTuwEBjI/AAAAAAAAAOk/XlT0sfUdl58/s400/graphType.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;As you can see from the above diagram we have several different types of graphs, now it should be noted that these attributes can overlap, the &lt;a href="http://mathworld.wolfram.com/UndirectedGraph.html"&gt;Undirected Graph&lt;/a&gt; contains cycles, so it is &lt;a href="http://mathworld.wolfram.com/CyclicGraph.html"&gt;cyclic&lt;/a&gt; as does the &lt;a href="http://en.wikipedia.org/wiki/Directed_graph"&gt;Directed Graph&lt;/a&gt;, the &lt;a href="http://en.wikipedia.org/wiki/Multigraph"&gt;Multi-Graph&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt;, by definition contains cycles so it is cyclic this one is also undirected.  The &lt;a href="http://en.wikipedia.org/wiki/Acyclic_graph"&gt;Acyclic Graph&lt;/a&gt; is undirected. So these attributes can combine, except for an acyclic multi-graph which by definition can’t exist, I think.&lt;/p&gt;&lt;p&gt;In order to limit complexity for our discussion we are going to limit our object graph to the case of a &lt;a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph"&gt;directed acyclic graph&lt;/a&gt;, which is also known as a DAG.  More specifically we will be considering a specific case of this known as a directed &lt;a href="http://en.wikipedia.org/wiki/Tree_(graph_theory)"&gt;rooted tree&lt;/a&gt;, where edges have a direction away from the root. The following example shows a "rooted" DAG aka a tree:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-qGb_PB9EEb8/Tk6sYTKQquI/AAAAAAAAAOs/cjrAvZOjteU/s1600/personObjectGraph.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="316" width="400" src="http://2.bp.blogspot.com/-qGb_PB9EEb8/Tk6sYTKQquI/AAAAAAAAAOs/cjrAvZOjteU/s400/personObjectGraph.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;As you can see the above tree is also a domain object graph it is also it is a directed graph where the direction indicates containment via composition, which can be thought of as a "has-a" relation.  Now in some cases using ORM’s like hibernate one might include a mapping from Address back to Person so the ORM knows how to manage the relation and this is a cycle but it is an artifact created by the ORM since all accesses to this object graph by the application are from the root (Person node).  Now that is not to say that there might not be other structural reasons for such a cycle, perhaps an application needs to hold a list of addresses, but needs to get some of the Person attributes, then in this use case the Address node becomes the "relative" root from which the application access occurs so the object graph would then have two roots and need a cycle to maintain that duality.&lt;/p&gt;&lt;p&gt;So in many cases in regards to the ORM entity model the object graph can be thought of as a tree, a rooted directed acyclic graph (DAG).  There is one important divergence from traditional graph theory which is the presence of collections in graphs, these form a special node that can have &lt;a href="http://www.elegantcoding.com/2011/05/combinatorial-and-other-math-of-java.html"&gt;combinatorial&lt;/a&gt; enumerative properties, in the case of the various types of &lt;a href="http://www.elegantcoding.com/2011/05/combinatorial-and-other-math-of-java.html"&gt;collections&lt;/a&gt; also it can have certain mapping properties in the case of a &lt;a href="http://en.wikipedia.org/wiki/Hash_table"&gt;Map&lt;/a&gt; object. An example of a modified person object that might hold a collection of addresses is:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-XgqEO_sWBmU/Tk6sb_WYpfI/AAAAAAAAAO0/GkERpO3nWR8/s1600/personObjectGraphCollection.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="316" width="400" src="http://4.bp.blogspot.com/-XgqEO_sWBmU/Tk6sb_WYpfI/AAAAAAAAAO0/GkERpO3nWR8/s400/personObjectGraphCollection.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;There are a number of ways to expand on these ideas further but I think I will leave those for future posts.  &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; This is the graph that Euler came up with for famous the &lt;a href="http://en.wikipedia.org/wiki/Seven_Bridges_of_K%C3%B6nigsberg"&gt;Seven Bridges of K&amp;ouml;nigsberg&lt;/a&gt; problem. The bridges are shown in the top image.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-4488049621253920919?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/0NWNOGuWzXI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/0NWNOGuWzXI/object-graph.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-V1aqbRnu-AI/Tk6sN0ObPDI/AAAAAAAAAOc/_T47TpT10ao/s72-c/Image-Koenigsberg%252C_Map_by_Merian-Erben_1652.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/08/object-graph.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-1609531230628037429</guid><pubDate>Mon, 01 Aug 2011 00:07:00 +0000</pubDate><atom:updated>2012-05-06T12:37:39.252-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">API Design</category><category domain="http://www.blogger.com/atom/ns#">Software Complexity</category><category domain="http://www.blogger.com/atom/ns#">Software Engineering</category><category domain="http://www.blogger.com/atom/ns#">Code Reuse</category><category domain="http://www.blogger.com/atom/ns#">Software Frameworks</category><category domain="http://www.blogger.com/atom/ns#">Information Entropy</category><title>Software Frameworks: Resistance isn’t Futile</title><description>&lt;style&gt;
blockquote.quote {
   border-bottom: #ddd 1px dotted;
   border-left: #ddd 1px dotted;
   padding-bottom: 0.6em;
   font-style: italic;
   font-family: calibri, tahoma, arial, sans-serif;
   margin: 1em 10% 1em 0px;
   min-height: 40px;
   padding-left: 3.8em;
   padding-right: 1em;
   background: url(http://4.bp.blogspot.com/-WkhuNlv2j88/TjXlBh6SySI/AAAAAAAAAN0/O_G2Z8YdMk8/s320/blockquote.white.png) #f0f0f0 no-repeat 4px top;
   color: #474747;
   border-top: #ddd 1px dotted;
   border-right: #ddd 1px dotted;
   padding-top: 0.6em
}
&lt;/style&gt;   &lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-wBVulAkw994/TjXkydzVppI/AAAAAAAAANs/VrbB1ZcB13E/s1600/800px-Menger-Schwamm-farbig.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="400" src="http://2.bp.blogspot.com/-wBVulAkw994/TjXkydzVppI/AAAAAAAAANs/VrbB1ZcB13E/s400/800px-Menger-Schwamm-farbig.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;!--Software Frameworks: Resistance isn’t Futile--&gt;   &lt;p&gt;As I have &lt;a href="http://www.elegantcoding.com/2011/03/what-does-your-framework-look-like.html"&gt;previously discussed&lt;/a&gt;, in my opinion there are three main framework components that can be described succinctly as, libraries, rules, and templates.  It is the library component that I wanted to talk about here, perhaps in a context that might be seen as more evidence in support of frameworks in certain cases.  Now to recap, building a framework does not make sense for all projects, the two main scenarios that I have seen that are extremely conducive to it are an organization with multiple similar projects with similar problem domains.  The second case is a medium to large project with a lot of commonality that would favor reusability across the project.  One of my complaints about the Framework debate is that it is debated as a black and white argument. Either frameworks are absolutely required or the worst thing you can do.  Now I am sure that many developers can anecdotally cite either side of this argument, which is what I feel really drives this debate and there is no doubt that I do this as well, but the goal, in my opinion, is to step back and look at this problem from a bigger perspective.&lt;/p&gt;&lt;a name="Veldhuizen"&gt;&lt;/a&gt; &lt;p&gt;One place that I have found some interesting perspective is in a paper by Todd L. Veldhuizen titled: &amp;quot;&lt;a href="http://lcsd05.cs.tamu.edu/papers/veldhuizen.pdf"&gt;Software Libraries and Their Reuse:Entropy, Kolmogorov Complexity, and Zipf’s Law&lt;/a&gt;&amp;quot;, there is a &lt;a href="http://lcsd05.cs.tamu.edu/slides/veldhuizen.pdf"&gt;slide version here&lt;/a&gt;, now a word of caution this paper is very math intensive, but it should be possible to read it and gain some insights without understanding the math, for example in the paper he states the following: &lt;/p&gt;&lt;blockquote class="quote"&gt;A common theme in the software reuse literature is that if we can only get the right environment in place— the right tools, the right generalizations, economic incentives, a "culture of reuse" — then reuse of software will soar, with consequent improvements in productivity and software quality. The analysis developed in this paper paints a different picture: the extent to which software reuse can occur is an intrinsic property of a problem domain, and better tools and culture can have only marginal impact on reuse rates if the domain is inherently resistant to reuse.&lt;/blockquote&gt;&lt;a name="Resistance"&gt;&lt;/a&gt; &lt;p&gt;I think this is a good observation, many projects that I have worked on have exhibited characteristics that are favorable to reuse, but I have read a number of counter arguments especially by people in fast paced startups where the flux of the system evolution is potentially resistant to reusability, actually in this case it’s probably the SDLC, not necessarily the problem domain that is resistant.  Also I would suspect the probability of reuse is in part inversely proportional to system size, so for small systems it’s less likely or at least will have a smaller set of reusable components, so an investment in reuse may not be seen as justified.&lt;/p&gt;&lt;p&gt;Another interesting observation from the paper is:&lt;/p&gt;&lt;a name="Entropy"&gt;&lt;/a&gt; &lt;blockquote class="quote"&gt;Under reasonable assumptions we prove that no finite library can be complete: there are always more components we can add to the library that will allow us increase reuse and make programs shorter. To make this work we need to settle a subtle interplay between the Kolmogorov complexity notion of compressibility (there is a shorter program doing the same thing) and the information theoretic notion of compressibility (low entropy over an ensemble of programs). &lt;/blockquote&gt;&lt;p&gt;This is especially interesting if you have some familiarity with Information Theory, and if you don’t I recommend learning more about it. Here he is comparing characteristics of both &lt;a href="http://en.wikipedia.org/wiki/Algorithmic_information_theory"&gt;Algorithmic Information Theory&lt;/a&gt; [Kolmogorov complexity] and &lt;a href="http://en.wikipedia.org/wiki/Information_theory"&gt;Shannon’s Information Theory&lt;/a&gt; [information theoretic notion].  Roughly, Algorithmic Information Theory is concerned with the smallest algorithm to generate data and Shannon’s Information Theory is about how to represent the data in the most compact form.  These concepts are closely related to data compression and in the paper this is paralleled to the idea that reusing code, will make the system smaller in terms of lines of code, or more specifically: symbols, which effectively "compresses" the codebase.  In Algorithmic Information theory you can never really know if you have the smallest algorithm so I may be taking some liberty here, but I think the takeaway is that when trying to create reuse you can probably do it forever so one needs to temper this desire with practicality. In other words there is probably a point where any subsequent work towards reuse is a diminishing return.&lt;/p&gt;&lt;a name="PowerLaw"&gt;&lt;/a&gt; &lt;p&gt;I find the paper compelling and I confess that perhaps I am being bamboozled by math that I still do not fully understand, but intuitively these ideas feel right to me.  Also the application of &lt;a href="http://en.wikipedia.org/wiki/Zipf%27s_law"&gt;Zipf’s law&lt;/a&gt; is interesting and should be pretty intuitive, once again roughly, &lt;a href="http://arxiv.org/abs/cond-mat/0412004"&gt;Zipfs law&lt;/a&gt; relates to &lt;a href="http://en.wikipedia.org/wiki/Power_law"&gt;power curve&lt;/a&gt; distributions, also related to the &lt;a href="http://en.wikipedia.org/wiki/Pareto_principle"&gt;80/20 rule&lt;/a&gt;, the prime example is the frequency of English words in text, words like [and, the, some, in, etc.] are much, perhaps orders of magnitude, more common than words like [deleterious, abstruse, etc.].  This distribution shows up in things like the distribution of elements in the universe, think hydrogen vs. platinum, the wealth distribution of people you vs. Bill Gates, how many followers people have on twitter, etc. and to a smaller scale, the curve is &lt;a href="http://en.wikipedia.org/wiki/Scale_invariance"&gt;scale invariant&lt;/a&gt;,  in software, often some components will have a fair amount of reuse, things string copy functions, entity base classes, etc., whereas others may only have a couple of reuses.&lt;/p&gt;&lt;a name="Chaos"&gt;&lt;/a&gt; &lt;p&gt;On the lighter side, Power curves relate to Chaos Theory, I have seen a number of people including &lt;a href="http://pragprog.com/magazines/2011-05/guru-meditation"&gt;Andy Hunt&lt;/a&gt; draw parallels between Agile and Chaos theory, although these are usually pretty loose, it does strike me that one way to model chaos is through iterated maps, which is reminiscent of the iterative process of agile, also the &lt;a href="http://en.wikipedia.org/wiki/Attractor"&gt;attractor&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Orbit_(dynamics)"&gt;orbit&lt;/a&gt; concepts seem to parallel the target software system as well.&lt;/p&gt;&lt;a name="ApiDesign"&gt;&lt;/a&gt; &lt;p&gt;Another place, and this is one that most developers will find more accessible, I would have lead with this but the title and flow leaned the other way, is Joshua Bloch’s "&lt;a href="http://www.youtube.com/watch?v=aAb7hSCtvGw"&gt;How To Design A Good API and Why it Matters&lt;/a&gt;".  Actually I think this a presentation that every developer should watch especially if you are involved in high level design and architecture related work, and don’t worry, there is no math to intimidate the average developer.  A summary article version can be found &lt;a href="http://www.infoq.com/articles/API-Design-Joshua-Bloch"&gt;here&lt;/a&gt;, but I would still recommend watching the full video at least once if not multibple times. Slides to an older version of the talk can be found &lt;a href="http://lcsd05.cs.tamu.edu/#keynote"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;a name="Predictive_Adaptive"&gt;&lt;/a&gt; &lt;p&gt;In his presentation he talks about getting the API right the first time because you are stuck with it. I think this helps illuminate one very important and problematic aspect of framework design and software development.  The problem can be illustrated with a linguistic analogy, in linguistics there are two ways to define rules for a language: &lt;a href="http://en.wikipedia.org/wiki/Linguistic_prescription"&gt;prescriptive&lt;/a&gt;, is where you apply (prescribe) the rules on to the language vs. &lt;a href="http://en.wikipedia.org/wiki/Descriptive_linguistics"&gt;descriptive&lt;/a&gt; where the rules describe the language as it exists, I strongly favor the descriptive.  One of the most famous English language rules: "not to end sentences with prepositions" is a prescriptive rule thought to be from Latin which was introduced by &lt;a href="http://en.wikipedia.org/wiki/John_Dryden"&gt;John Dryden&lt;/a&gt; and famously mocked by &lt;a href="http://en.wikipedia.org/wiki/Winston_Churchill"&gt;Winston Churchill&lt;/a&gt; "This is the sort of nonsense &lt;b&gt;up with which&lt;/b&gt; I will not put.", pointing out that it really doesn’t always fit a Germanic language like &lt;a href="http://en.wikipedia.org/wiki/History_of_the_English_language"&gt;English&lt;/a&gt;.  I know I’m a bit off topic again with my "writer’s embellishment", not to mention that the same idea is discussed in depth by Martin Fowler which he terms "&lt;a href="http://martinfowler.com/articles/newMethodology.html#PredictiveVersusAdaptive"&gt;Predictive versus Adaptive&lt;/a&gt;".  &lt;/p&gt;&lt;p&gt;It is a common problem which Agile attempts to address and it is common in general software design and construction, it also occurs API and framework design.  Software construction as we know is an organic process and I feel that frameworks are best developed in part out of that process though &lt;a href="http://martinfowler.com/bliki/HarvestedFramework.html"&gt;Martin Fowler’s Harvesting&lt;/a&gt; which can be termed as descriptive framework creation.  What Joshua Bloch in part describes and to some degree cautions against can be described as a prescriptive approach to API/Frameworks.  I think many developers including me have attempted to create framework components and API’s early in a project usually driven by a high level vision of what the resulting system will look like only to find out later that certain assumptions were not valid or certain cases were not accounted for&lt;sup&gt;1&lt;/sup&gt;.  What he talks about is a pretty rigid prescriptive model which is in many ways at odds with an adaptive agile approach, I feel that the more adaptive agile approach is really what is needed for the framework approach and we do see this via versioning, for example the differences between Spring 1.x and Spring 3.x are substantial and no one would want to use 1.x now, but there are apps that are tied to it now.  Also this approach of complete backwards compatibility was used with &lt;a href="http://en.wikipedia.org/wiki/Generics_in_Java"&gt;Java Generics&lt;/a&gt;, specifically &lt;a href="http://en.wikipedia.org/wiki/Generics_in_Java#Type_erasure"&gt;Type Erasure&lt;/a&gt; which has lead to a significant weakening of the implementation of that abstraction.  It is my understanding that Scala has recently undergone some substantial changes from version to version leading some to criticize its stability while others cite that it is the only way to avoid painting yourself into a corner like with Java.  The harvesting approach will often involve refinement and changes to the components which are extracted and this can lead to the need for refactorings that can potentially affect large amounts of already existing code. It’s a real chicken and egg problem.&lt;/p&gt;&lt;p&gt;He starts his presentation with the following Characteristics of a Good API:&lt;/p&gt;&lt;a name="Characteristics"&gt;&lt;/a&gt; &lt;blockquote class="quote"&gt;Characteristics of a Good API &lt;ul&gt;&lt;li&gt;Easy to learn&lt;/li&gt;
&lt;li&gt;Easy to use, even without documentation&lt;/li&gt;
&lt;li&gt;Hard to misuse&lt;/li&gt;
&lt;li&gt;Easy to read and maintain code that uses it&lt;/li&gt;
&lt;li&gt;Sufficiently powerful to satisfy requirements&lt;/li&gt;
&lt;li&gt;Easy to extend&lt;/li&gt;
&lt;li&gt;Appropriate to audience&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;a name="Assets"&gt;&lt;/a&gt; &lt;p&gt;He also makes the following point:&lt;/p&gt;&lt;blockquote class="quote"&gt;APIs can be among a company's greatest assets&lt;/blockquote&gt;&lt;p&gt;I think this is sentiment is reflected in Paul Graham’s "&lt;a href="http://www.paulgraham.com/avg.html"&gt;Beating the Averages&lt;/a&gt;" of course that is more about Lisp but underlying principle is the same, actually an interesting language agnostic point comes from Peter Norvig, I can’t find the reference, but he said he had a similar attitude towards Lisp until he got to Google and saw good programmers who were incredibly productive in C++.  I feel that this is all just the framework argument, maximizing reusability by building reusable high level abstractions within your problem domain that allow you to be more productive and build new high level components more quickly, it’s all about efficiency.&lt;/p&gt;&lt;p&gt;In regards to API’s he adds:&lt;/p&gt;&lt;a name="Simplicity"&gt;&lt;/a&gt; &lt;blockquote class="quote"&gt;API Should Be As Small As Possible But No Smaller&lt;/blockquote&gt;&lt;p&gt;To which he adds:&lt;/p&gt;&lt;!--24:30--&gt;  &lt;blockquote class="quote"&gt;&lt;ul&gt;&lt;li&gt;When in doubt leave it out.&lt;/li&gt;
&lt;li&gt;Conceptual weight is more important than the bulk - The number of concepts.&lt;/li&gt;
&lt;li&gt;The most important way to reduce weight is reusing interfaces.&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;p&gt;He attributes this sentiment to Einstein, but he wasn’t sure about it, I did some follow up the paraphrasing is "Everything should be made as simple as possible, but no simpler." or "Make things as simple as possible, but not simpler." More about that can be found &lt;a href="http://en.wikiquote.org/wiki/Albert_Einstein"&gt;here&lt;/a&gt;. These are good cautions about over-design or over-engineering APIs, Frameworks, and Software in general, I have definitely been guilty of this at times, once again this is something that needs to be balanced. &lt;/p&gt;&lt;a name="ProgrammerDesigner"&gt;&lt;/a&gt; &lt;p&gt;The following is what I consider to be seminal advice:&lt;/p&gt;&lt;blockquote class="quote"&gt;All programmers are API designers because good programming is inherently modular and these inter modular boundaries are API’s and good API’s tend to get reused. &lt;/blockquote&gt;&lt;p&gt;As stated in his slides:&lt;/p&gt;&lt;blockquote class="quote"&gt;Why is API Design Important to You? &lt;ul&gt;&lt;li&gt;If you program, you are an API designer         &lt;ul&gt;&lt;li&gt;Good code is modular–each module has an API&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Useful modules tend to get reused         &lt;ul&gt;&lt;li&gt;Once module has users, can’t change API at will&lt;/li&gt;
&lt;li&gt;Good reusable modules are corporate assets&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt; Thinking in terms of APIs improves code quality&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;p&gt;The next two quotes are pretty long, and it was no easy task transcribing them, he talks really fast, I tried to accurately represent this as best as possible, also I feel that he really nails some key ideas and I wanted to have a written record of it to reference, since I am not aware of any other:&lt;/p&gt;&lt;a name="Names"&gt;&lt;/a&gt;  &lt;blockquote class="quote"&gt;Names matter a lot, there are some people that think that names don’t matter and when you sit down and say well this isn’t named right, they say don’t waste your time let’s just move on, it’s good enough. No! Names, in an API, that are going to be used by anyone else that includes yourself in a few months mater an awful lot.  The idea is that every API is kind of a little language and people who are going to use your API needs to learn that language and then speak in that language and that means that names should be self explanatory, you should avoid cryptic abbreviations so the original Unix names, I think, fail this one miserably. &lt;/blockquote&gt;&lt;p&gt;He augments these ideas by adding consistency and symmetry: &lt;/p&gt;&lt;a name="Consistency_Symmetry"&gt;&lt;/a&gt;  &lt;blockquote class="quote"&gt;You should be consistent, it is very important that the same word means the same thing when used repeatedly in your API and you don’t have multiple words meaning  that same thing so let us say that you have a remove and a delete in the same API that is almost always wrong what’s the difference between remove and delete, Well I don’t know when I listen to those two things they seem to mean the same thing if they do mean the same thing then call them both the  same thing if they don’t then make the names different enough to tell you how they differ if they were called let’s say delete and expunge I would know that expunge was a more permanent kind of removal or something like that. Not only should you strive for consistency you should strive for symmetry so if you API has two verbs add and remove and two nouns entry and key, I would like to see addEntry, addKey, removeEntry, removeKey if one of them is missing there should be a very good reason for it I am not saying that all API’s should be symmetric but the great bulk of them should.  If you get it right the code should read like prose, that’s the prize.&lt;/blockquote&gt;&lt;a name="Prose"&gt;&lt;/a&gt;  &lt;p&gt;From the Slides:&lt;/p&gt;&lt;blockquote class="quote"&gt;Names Matter–API is a Little Language &lt;ul&gt;&lt;li&gt;Names Should Be Largely Self-Explanatory         &lt;ul&gt;&lt;li&gt; Avoid cryptic abbreviations&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Be consistent–same word means same thing         &lt;ul&gt;&lt;li&gt;Throughout API, (Across APIs on the platform)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Be regular–strive for symmetry&lt;/li&gt;
&lt;li&gt;Code should read like prose&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;p&gt;I feel that this hits some essential concepts which really resonate with me, in fact I have follow on posts planned to further deconstruct and develop these ideas more generally.  From the framework perspective this also gets at some of the variety of the Framework code components, they can be the Paul Graham’s functional Lisp abstractions, they can be DSL’s, they can be Object Oriented like Spring, Hibernate and Java API, etc.   Any framework built for a domain will have their conceptual vocabularies or API languages that are a higher level abstraction of the problem domain, Domain Specific Abstractions, and they all benefit from concepts like consistency and symmetry as appropriate to the domain.&lt;/p&gt;&lt;a name="CostOfReuse"&gt;&lt;/a&gt; &lt;p&gt;The following is a very common and widespread problem that often inhibits reuse and leads to less efficient production of lower quality software:&lt;/p&gt;&lt;blockquote class="quote"&gt;&lt;p&gt;Reuse is something that is far easier to say than to do. Doing it requires both good design and very good documentation. Even when we see good design, which is still infrequently, we won’t see the components reused without good documentation.&lt;/p&gt;&lt;p&gt;- D. L. Parnas, Software Aging. Proceedings of the 16&lt;sup&gt;th&lt;/sup&gt; International Conference on Software Engineering, 1994.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;He adds:&lt;/p&gt;&lt;blockquote class="quote"&gt;Example Code should be Exemplary, one should spend ten times as much time on example code than production code.&lt;/blockquote&gt;&lt;p&gt;He references a paper called "&lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.94.2650"&gt;Design fragments&lt;/a&gt;" by George Fairbanks also &lt;a href="http://georgefairbanks.com/files/thesis.pdf"&gt;here&lt;/a&gt; which looks interesting but I have not had time to read it yet.&lt;/p&gt;&lt;p&gt;This is also, I believe, to be a critical point that is possibly symptomatic of problems with many software projects. I feel that projects never explicitly allow for capturing reuse in terms of planning, schedule and developer time.  Often reuse is a lucky artifact if you have proactive developers who make the extra effort to do it and it can often be at odds with the way I have seen projects run (mismanaged).  I have some follow up planned for this topic as well.&lt;/p&gt;&lt;a name="DesignLead"&gt;&lt;/a&gt; &lt;p&gt;In terms of design he adds this interesting point:&lt;/p&gt;&lt;blockquote class="quote"&gt;You need one strong design lead to that can ensure that the api that you are designing is cohesive and pretty and clearly the work of one single mind or at least a single minded body and that’s always a little bit of a trade off being able to satisfy the needs of many costumers and yet produce something that is beautiful and cohesive. &lt;/blockquote&gt;&lt;p&gt;I have to confess that I do not recall how I came across Todd Veldhuizen’s paper or Joshua Bloch’s talk, but I felt that they were really about similar ideas, in writing this and finding all of the references again I realized that my association of these two was not coincidental at all.  For they are both part of the &lt;a href="http://lcsd05.cs.tamu.edu/"&gt;Library-Centric Software Design LCSD'05&lt;/a&gt; workshop for &lt;a href="http://oopsla.org"&gt;Object-Oriented Programming, Systems, Languages and Applications (OOPSLA'05)&lt;/a&gt; with Joshua Bloch delivering the same talk as the &lt;a href="http://lcsd05.cs.tamu.edu/#keynote"&gt;Keynote Address&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;Now I admit that one goal of mine is to put these ideas, much of which was borrowed from the two referenced works, into a written form that I can reference back to, I hope this stands up by itself but is really written for my future entries. Also, for the record this is not the first time &lt;a href="http://www.elegantcoding.com/2011/05/combinatorial-and-other-math-of-java.html"&gt;I have "leached" off of Joshua Bloch’s work&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Ultimately my ideas will diverge from some of those in regards to API design, Joshua Bloch speaks from a position of greater responsibility in terms of APIs. I see them as part of a framework continuum used to construct software and I think many of his ideas apply directly and more generally to that.  Also I see framework and the system as interlocked and feel that frameworks can drive structure and consistency for example Object-Oriented API’s aka frameworks can in turn drive the structure of software, the Spring Framework is a good example of this, Spring is build heavily around IOC which is one of the SOLID principles.&lt;/p&gt;&lt;p&gt;There will always be arguments against frameworks, the classic one is it creates more code that is more complex and it requires more learning, my counter argument to this is twofold: First any code that is in production probably has the need to be known and understood which might require it to be learned regardless of how efficiently it is created.  Also if a framework creates reusability and consistency the initial learning curve will be higher but each subsequent encounter with a codebase that constructed this way should be easier. Also highly redundant inconsistent code is potentially (much) more difficult to learn and maintain because there is more of it.  The second is if your framework API is well defined and well documented it should make the resultant code much easier to understand and maintain aka "read like prose".  This will be due to the fact that much of the "generic" complexity is "abstracted" downwards into the framework level.  For example compare the code to implement a &lt;a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-controller"&gt;Spring Controller&lt;/a&gt; to the underlying classes that do the work such as &lt;a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.html"&gt;AnnotationMethodHandlerAdapter&lt;/a&gt; Now if you have defects and issues at that lower level they will be harder to fix and changing common code can have side effects to other dependant code, it’s not a perfect world.&lt;/p&gt;&lt;p&gt;I think the issue with reuse and the framework approach is asking the right question: How resistant (or favorable) is you domain and your SDLC to reuse?  I think most domains have some if not a fair amount of favorability to reuse and I see reuse as increased efficiency in software construction.  &lt;/p&gt;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt;Perhaps: "...certain cases for were not accounted." Dryden blows.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-1609531230628037429?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/0wPW39hfceA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/0wPW39hfceA/software-frameworks-resistance-isnt.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-wBVulAkw994/TjXkydzVppI/AAAAAAAAANs/VrbB1ZcB13E/s72-c/800px-Menger-Schwamm-farbig.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/07/software-frameworks-resistance-isnt.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-4656210416606979397</guid><pubDate>Sun, 24 Jul 2011 16:30:00 +0000</pubDate><atom:updated>2012-05-06T12:14:47.449-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Graph Theory</category><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Number Theory</category><category domain="http://www.blogger.com/atom/ns#">Combinatorics</category><title>Triangles, Triangular Numbers, and the Adjacency Matrix</title><description>&lt;!-- Triangles, Triangular Numbers, and the Adjacency Matrix --&gt; &lt;style&gt;
div.source-code {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px dashed #999999;
    line-height       : 14px;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
}


p.formula {
    font-family       : "Times New Roman",Georgia,Serif;
    color             : #000;
    font-size         : 12pt;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
}


&lt;/style&gt;  &lt;div class=Section1&gt; &lt;p&gt;One of the cool things about math is that there are many interconnections and interrelations between the various ideas and concepts and looking at things from a broader perspective can often be enlightening. &lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-d-oj4p2MrR0/Tiwwc7UTolI/AAAAAAAAAJs/2foem8FPFro/s1600/triangle.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="260" width="280" src="http://1.bp.blogspot.com/-d-oj4p2MrR0/Tiwwc7UTolI/AAAAAAAAAJs/2foem8FPFro/s400/triangle.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt;                                                     &lt;img src="image/triangle.jpg"&gt;  &lt;/p--&gt;&lt;p&gt;The area of a triangle is something that we learn in elementary school, its formula, often stated as one half the base times the height, is: &lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ULOyLrGkKtc/TiwwSa4bXcI/AAAAAAAAAJk/oFGgHOJQu10/s1600/tri-area.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="34" width="152" src="http://3.bp.blogspot.com/-ULOyLrGkKtc/TiwwSa4bXcI/AAAAAAAAAJk/oFGgHOJQu10/s400/tri-area.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt;                    &lt;img src="image/tri-area.png"&gt;  &lt;/p--&gt;&lt;p&gt;It’s pretty basic stuff, perhaps even boring.&lt;/p&gt;&lt;p&gt;In &lt;a href="http://en.wikipedia.org/wiki/Number_Theory"&gt;Number Theory&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Discrete_Math"&gt;Discrete Math&lt;/a&gt; there is a sequence of numbers known as the &lt;a href="http://en.wikipedia.org/wiki/Triangular_number"&gt;Triangular numbers&lt;/a&gt;, each triangular number (T&lt;sub&gt;n&lt;/sub&gt;) is the sum of all the integers up to an including itself. For example&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;T&lt;sub&gt;1&lt;/sub&gt; = 1 = 1&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;T&lt;sub&gt;2&lt;/sub&gt; = 1 + 2 = 3&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;T&lt;sub&gt;3&lt;/sub&gt; = 1 + 2 + 3 = 6&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;T&lt;sub&gt;4&lt;/sub&gt; = 1 + 2 + 3 + 4 = 10&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;…&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;T&lt;sub&gt;n&lt;/sub&gt; = 1 + 2 + 3 + ... + (n -1) + n&lt;/p&gt;&lt;p&gt;These can be generalized by the following formula: &lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-DRKh0zu240M/TiwxzOW_x4I/AAAAAAAAAKE/KYYtR5oF_QA/s1600/Tn.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="47" width="77" src="http://2.bp.blogspot.com/-DRKh0zu240M/TiwxzOW_x4I/AAAAAAAAAKE/KYYtR5oF_QA/s400/Tn.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt;                                                                      &lt;img src="image/Tn.png"&gt; &lt;/p--&gt;&lt;p&gt;The capital &lt;a href="http://en.wikipedia.org/wiki/Summation#Capital-sigma_notation"&gt;Sigma notation&lt;/a&gt; is &lt;a href="http://en.wikipedia.org/wiki/Summation"&gt;Summation&lt;/a&gt;, which is equivalent to the following simple Java code snippet:&lt;/p&gt;&lt;div class="source-code"&gt; &lt;p&gt;public int triangularNumber(int n)&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;int result = 0;&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;for(int k = 1; k &amp;lt;= n; k++) {&lt;/p&gt;&lt;p style="text-indent:1in"&gt;result += k;&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;}&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;return result;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Triangular_number"&gt;Triangular numbers&lt;/a&gt; are the additive analog to the &lt;a href="http://en.wikipedia.org/wiki/Factorial"&gt;factorial&lt;/a&gt; function, i.e. the addition of 1..n vs. the multiplication of 1..n to and can also computed &lt;a href="http://en.wikipedia.org/wiki/Recursion"&gt;recursively&lt;/a&gt;:&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;T&lt;sub&gt;n&lt;/sub&gt; = n + T&lt;sub&gt;n-1&lt;/sub&gt;&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;T&lt;sub&gt;n&lt;/sub&gt; = n + ((n - 1) + T&lt;sub&gt;n-2&lt;/sub&gt;)&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;. . .&lt;/p&gt;&lt;p style="margin-left:2in" class="formula"&gt;T&lt;sub&gt;n&lt;/sub&gt; = n + (n - 1) + ... + 2 + 1&lt;/p&gt;&lt;p&gt;Which can be implemented in Java as:&lt;/p&gt;&lt;div class="source-code"&gt; &lt;p&gt;public int triangularNumber(int n)&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;if(1 == n) &lt;/p&gt;&lt;p style="text-indent:1in"&gt;return n;&lt;/p&gt;&lt;p style="text-indent:.5in"&gt;else&lt;/p&gt;&lt;p style="text-indent:1in"&gt;return n + triangularNumber(n - 1);&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Triangular_number"&gt;Triangular numbers&lt;/a&gt; can be drawn visually as a triangle made up of dots, the first 5 triangular numbers are 1, 3, 6, 10 and 15:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-fm_J1FwpmZo/TizLvttJUcI/AAAAAAAAAMs/Bq8I47ZoNEo/s1600/trinum.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="250" width="280" src="http://2.bp.blogspot.com/-fm_J1FwpmZo/TizLvttJUcI/AAAAAAAAAMs/Bq8I47ZoNEo/s400/trinum.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/trinum.jpg"&gt;  &lt;/p--&gt;&lt;p&gt;There is another, better way, to compute triangular numbers, a &lt;a href="http://en.wikipedia.org/wiki/Closed-form_expression"&gt;closed formula&lt;/a&gt; that &lt;a href="http://en.wikipedia.org/wiki/Gauss"&gt;Gauss&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt; came up with when he was a child:&lt;/p&gt;&lt;!--p align="center"&gt; &lt;img src="image/Tn.long.png"&gt;  &lt;/p--&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-JWPBtHMjzDI/TiwxfjOWxpI/AAAAAAAAAJ8/kY-VxKlKgs4/s1600/Tn.long.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="36" width="268" src="http://3.bp.blogspot.com/-JWPBtHMjzDI/TiwxfjOWxpI/AAAAAAAAAJ8/kY-VxKlKgs4/s400/Tn.long.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;If you assign (n + 1) to be the base and (n) to the height, the formula bears a striking resemblance to the formula for the area of a triangle, seen visually as:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-NMomkSiWvSE/TizMpkOZVAI/AAAAAAAAAM0/Mvy28jDHOpM/s1600/trinum2.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="300" width="350" src="http://2.bp.blogspot.com/-NMomkSiWvSE/TizMpkOZVAI/AAAAAAAAAM0/Mvy28jDHOpM/s400/trinum2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/trinum2.jpg"&gt;  &lt;/p--&gt;&lt;p&gt;As you can see the base of the triangle ends being one larger than the actual size of the triangle and results in an "area" is larger than would be expected by the continuous area.  I think this might be doing the equivalent to what the &lt;a href="http://en.wikipedia.org/wiki/Floor_and_ceiling_functions"&gt;ceiling function&lt;/a&gt; does to round up and acquire the "extra bits" of the discrete case.  This triangle was referred to by &lt;a href="http://en.wikipedia.org/wiki/Fermat"&gt;Fermat&lt;/a&gt; as the Collateral Triangle, although I think the term "discrete triangle" is better, and this concept relates to the differences between discrete and continuous mathematics. This is explored in more detail by &lt;a href="http://sofia.nmsu.edu/~history/"&gt;David J. Pengelley&lt;/a&gt; specifically in the following the paper: "&lt;a href="http://sofia.nmsu.edu/~davidp/bridge.pdf"&gt;The bridge between the continuous and the discrete via original sources&lt;/a&gt;" and partial chapter: "&lt;a href="http://sofia.nmsu.edu/~history/mm-1-3-fermat-pascal.pdf"&gt;The Bridge Between Continuous and Discrete&lt;/a&gt;". Actually his work, especially in regards to the Collateral Triangle aka discrete triangle was something of a missing link for my ideas here.  The following graph was derived from a graph in one of his papers.  I refactored it to use the function y=x and pimped it out a bit to better demonstrate my triangle theme, visually shows the differences between the discrete and continuous "areas" in terms of &lt;a href="http://en.wikipedia.org/wiki/Summation"&gt;Summation&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Integral"&gt;Integration&lt;/a&gt;:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-DxapD9cPjqc/TiwyePs7WbI/AAAAAAAAAKU/lYaOEgtRDDM/s1600/discrete.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="400" width="400" src="http://2.bp.blogspot.com/-DxapD9cPjqc/TiwyePs7WbI/AAAAAAAAAKU/lYaOEgtRDDM/s400/discrete.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/discrete.jpg"&gt;  &lt;/p--&gt;&lt;p align="center"&gt; &lt;a href="http://3.bp.blogspot.com/-h3qIl8Frmiw/Tiwy_vcK9XI/AAAAAAAAAKc/H13joYFGa98/s1600/Discrete-area.png" imageanchor="1" style=""&gt;&lt;img border="0" height="46" width="113" src="http://3.bp.blogspot.com/-h3qIl8Frmiw/Tiwy_vcK9XI/AAAAAAAAAKc/H13joYFGa98/s400/Discrete-area.png" /&gt;&lt;/a&gt;   &lt;!--img src="image/Discrete-area.png"--&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;a href="http://4.bp.blogspot.com/-igmF8JPoRX0/TiwzH8VidJI/AAAAAAAAAKk/ENwILniYN4w/s1600/integral.png" imageanchor="1" style=""&gt;&lt;img border="0" height="41" width="100" src="http://4.bp.blogspot.com/-igmF8JPoRX0/TiwzH8VidJI/AAAAAAAAAKk/ENwILniYN4w/s400/integral.png" /&gt;&lt;/a&gt;   &lt;!--img src="image/integral.png"--&gt;    &lt;/p&gt;&lt;p align="center" style="text-align:center"&gt;          &lt;/p&gt;&lt;p align="center" style="text-align:center"&gt;The "area" of discrete vs. continuous triangles&lt;/p&gt;&lt;p&gt;The diagram shows how the discrete area picks up more in that jagged edge than the continuous area does and ends up being a larger quantity, n/2 to be exact as seen in the formulas, this is the type of graph that is usually used as an introduction to &lt;a href="http://en.wikipedia.org/wiki/Integral"&gt;integral calculus&lt;/a&gt; to show how integration works, where in the continuous world the rectangular sections are &lt;a href="http://en.wikipedia.org/wiki/Infinitesimal"&gt;infinitesimal&lt;/a&gt;.  In this example the function y = x creates an area under its curve that is a unique&lt;sup&gt;2&lt;/sup&gt; triangle, drawn in red, the famous &lt;a href="http://en.wikipedia.org/wiki/Special_right_triangles#45-45-90_triangle"&gt;45-45-90 triangle&lt;/a&gt; which is both &lt;a href="http://en.wikipedia.org/wiki/Right_triangle"&gt;right&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Isosceles_triangle#By_relative_lengths_of_sides"&gt;isosceles&lt;/a&gt; and in this case the height and base are equal, both the value of n so the area is (n*n)/2 which is the result of the above &lt;a href="http://en.wikipedia.org/wiki/Integral"&gt;integral&lt;/a&gt; which measures the area of the red triangle where height = n and  base = n.  The discrete triangle, Fermat’s Collateral Triangle, is superimposed into each 1 x 1 cell of the graph as light blue circles with its area represented by the summation below the diagram and to the left.  Also note that &lt;a href="http://en.wikipedia.org/wiki/Integral"&gt;integration&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Summation"&gt;Summation&lt;/a&gt; are &lt;a href="http://en.wikipedia.org/wiki/Continuous_function"&gt;continuous&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Discrete_Math"&gt;discrete&lt;/a&gt; analogs of each other.  I think there’s probably a lot more to this but that’s all I need for my purposes so I’m going to have to leave it there.&lt;/p&gt;&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Triangular_number"&gt;Triangular numbers&lt;/a&gt; have the property if you add two consecutive triangular numbers they add to a &lt;a href="http://en.wikipedia.org/wiki/Square_number"&gt;square&lt;/a&gt; which can be expressed as the following equation:&lt;/p&gt;&lt;p align="center" style="text-align:center"  class="formula"&gt;T&lt;sub&gt;n-1&lt;/sub&gt; + T&lt;sub&gt;n&lt;/sub&gt; = n&lt;sup&gt;2&lt;/sup&gt;&lt;/p&gt;&lt;p&gt;This addition can be seen visually as:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-YLZdVlrpPqQ/Tiwzq-ZbEDI/AAAAAAAAAKs/Tgi5vu3hz2Y/s1600/trinum-square.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="140" width="140" src="http://1.bp.blogspot.com/-YLZdVlrpPqQ/Tiwzq-ZbEDI/AAAAAAAAAKs/Tgi5vu3hz2Y/s400/trinum-square.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center" style="text-align:center"&gt; &lt;img src="image/trinum-square.jpg"&gt;  &lt;/p--&gt;&lt;p align="center" style="text-align:center" class="formula"&gt;&lt;span style="color:blue"&gt;T&lt;sub&gt;4&lt;/sub&gt;&lt;/span&gt; + T&lt;sub&gt;5&lt;/sub&gt; =  &lt;span style="color:blue"&gt;10&lt;/span&gt; + 15  =  5&lt;sup&gt;2&lt;/sup&gt;  =  25&lt;/p&gt;&lt;p&gt;Since, from our recursive definition, T&lt;sub&gt;n &lt;/sub&gt;= n + T&lt;sub&gt;n-1&lt;/sub&gt; we can rewrite (T&lt;sub&gt;n-1&lt;/sub&gt; + T&lt;sub&gt;n&lt;/sub&gt; = n&lt;sup&gt;2&lt;/sup&gt;) from above as:&lt;/p&gt;&lt;p align="center" style="text-align:center" class="formula"&gt;T&lt;sub&gt;n-1&lt;/sub&gt; + T&lt;sub&gt;n-1&lt;/sub&gt; + n  =  2 &amp;#8729; T&lt;sub&gt;n-1&lt;/sub&gt; + n  =  n&lt;sup&gt;2&lt;/sup&gt;&lt;/p&gt;&lt;p&gt;This can be seen visually as:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-m-Ud77igE7c/TiwzxFLGpjI/AAAAAAAAAK0/rbYtqVPQwmk/s1600/trinum-square-2.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="140" width="140" src="http://1.bp.blogspot.com/-m-Ud77igE7c/TiwzxFLGpjI/AAAAAAAAAK0/rbYtqVPQwmk/s400/trinum-square-2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/trinum-square-2.jpg"&gt;  &lt;/p--&gt;&lt;p align="center" style="text-align:center" class="formula"&gt;2 &amp;#8729; &lt;span style="color:blue"&gt;T&lt;sub&gt;4&lt;/sub&gt;&lt;/span&gt; + 5  =  2 &amp;#8729; &lt;span style="color:blue"&gt;10&lt;/span&gt; + 5  =  5&lt;sup&gt;2&lt;/sup&gt;  =  25&lt;/p&gt;&lt;p&gt;Another pattern in drawing triangular numbers is to replace the dots with ones (hold this thought for a moment): &lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-QEekBgOb1vo/Tiwz4ky3OUI/AAAAAAAAAK8/PLP1svXIDIA/s1600/trinum3.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="220" width="260" src="http://4.bp.blogspot.com/-QEekBgOb1vo/Tiwz4ky3OUI/AAAAAAAAAK8/PLP1svXIDIA/s400/trinum3.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/trinum3.jpg"&gt;  &lt;/p--&gt;&lt;p&gt;Triangular numbers show up in &lt;a href="http://en.wikipedia.org/wiki/Graph_theory"&gt;Graph Theory&lt;/a&gt;, the &lt;a href="http://en.wikipedia.org/wiki/Complete_graph"&gt;Complete Graph&lt;/a&gt;, the graph where all &lt;a href="http://en.wikipedia.org/wiki/Vertex_(graph_theory)"&gt;vertices&lt;/a&gt; are connected to every other vertex exactly once, will have T&lt;sub&gt;n -1&lt;/sub&gt; &lt;a href="http://en.wikipedia.org/wiki/Edge_(graph_theory)"&gt;edges&lt;/a&gt; for a graph with n vertices, the complete graph is denoted as K&lt;sub&gt;n&lt;/sub&gt;.  The first three examples are:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-h1HZyZAIkCw/Tiwz-QdBKGI/AAAAAAAAALE/QmNBCc1ooC8/s1600/graph.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="240" width="400" src="http://1.bp.blogspot.com/-h1HZyZAIkCw/Tiwz-QdBKGI/AAAAAAAAALE/QmNBCc1ooC8/s400/graph.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/graph.jpg"&gt;  &lt;/p--&gt;&lt;p&gt;T&lt;sub&gt;1&lt;/sub&gt;, T&lt;sub&gt;2&lt;/sub&gt;, and T&lt;sub&gt;3&lt;/sub&gt; are the count of edges for K&lt;sub&gt;2&lt;/sub&gt;, K&lt;sub&gt;3&lt;/sub&gt;, and K&lt;sub&gt;4&lt;/sub&gt;. So if we define the function E(G) where G is a graph and E(G) is the edge count, i.e. number of edges in the graph, then E(K&lt;sub&gt;n&lt;/sub&gt;)=T&lt;sub&gt;n-1&lt;/sub&gt;, this only applies to the &lt;a href="http://en.wikipedia.org/wiki/Complete_graph"&gt;Complete Graphs&lt;/a&gt; K&lt;sub&gt;n&lt;/sub&gt; not all graphs.  &lt;/p&gt;&lt;p&gt;The formula for the E(K&lt;sub&gt;n&lt;/sub&gt;) and T&lt;sub&gt;n-1&lt;/sub&gt; is:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-fK5Jq9QNjYk/Tiw0E9DnMOI/AAAAAAAAALM/Fk7ZMdu9mdc/s1600/Tn-1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="36" width="285" src="http://1.bp.blogspot.com/-fK5Jq9QNjYk/Tiw0E9DnMOI/AAAAAAAAALM/Fk7ZMdu9mdc/s400/Tn-1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center" style="text-align:center"&gt; &lt;img src="image/Tn-1.png"&gt;  &lt;/p--&gt;&lt;p&gt;Let’s consider the graph K&lt;sub&gt;6&lt;/sub&gt;:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-QmWyVe-3paU/Tiw0TVM_7lI/AAAAAAAAALU/1HJCivfVk4A/s1600/k6graph.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="320" width="380" src="http://3.bp.blogspot.com/-QmWyVe-3paU/Tiw0TVM_7lI/AAAAAAAAALU/1HJCivfVk4A/s400/k6graph.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/k6graph.jpg"&gt;  &lt;/p--&gt;&lt;p&gt;Now in looking at the fully constructed graph we don’t really get a true sense intuitively about the relation to triangular numbers so let’s look the construction from an &lt;a href="http://en.wikipedia.org/wiki/Mathematical_induction"&gt;inductive&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Combinatorics"&gt;combinatorial&lt;/a&gt; perspective:&lt;/p&gt;&lt;p&gt;So let’s build K&lt;sub&gt;6&lt;/sub&gt;. We’ll start with vertex 1 which is blue and draw an edge (a blue line) to each other vertex which results in 5 blue edges.&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-QRNZwOD1hKY/Tj6KKYGGRRI/AAAAAAAAAN8/8BMUpLml7t0/s1600/k6graph-comb-1.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="320" width="380" src="http://4.bp.blogspot.com/-QRNZwOD1hKY/Tj6KKYGGRRI/AAAAAAAAAN8/8BMUpLml7t0/s400/k6graph-comb-1.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/k6graph-comb-1.jpg"&gt;  &lt;/p--&gt;   &lt;p&gt;Now we move (clockwise and numerically increasing) to vertex 2 in green, since we already have a blue line back to vertex 1 we don’t draw another, remember: no repeated edges. So we will only draw edges to vertices   that we have not visited yet which leaves 4 remaining which are drawn in green. &lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-ApqsD7teuL8/Tj6KPS1vwuI/AAAAAAAAAOE/adFtQC0_SWk/s1600/k6graph-comb-2.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="320" width="380" src="http://1.bp.blogspot.com/-ApqsD7teuL8/Tj6KPS1vwuI/AAAAAAAAAOE/adFtQC0_SWk/s400/k6graph-comb-2.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/k6graph-comb-2.jpg"&gt;  &lt;/p--&gt;&lt;p&gt;As we continue this we add 3 red edges, 2 yellow, 1 black, and 0 purple since we have connected to all vertices upon reaching this last vertex. &lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-uwwc_zax36E/Tj6KVGtFcMI/AAAAAAAAAOM/C6sDtMlcc2o/s1600/k6graph-comb-3.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="320" width="380" src="http://2.bp.blogspot.com/-uwwc_zax36E/Tj6KVGtFcMI/AAAAAAAAAOM/C6sDtMlcc2o/s400/k6graph-comb-3.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/k6graph-comb-3.jpg"&gt;  &lt;/p--&gt;&lt;p&gt;As shown in the above diagram in the appropriate colors, the edges are added as &lt;span style="color:blue"&gt;5&lt;/span&gt; + &lt;span style="color:green"&gt;4&lt;/span&gt; + &lt;span style="color:red"&gt;3&lt;/span&gt; + &lt;span style="color:yellow"&gt;2&lt;/span&gt; + &lt;span style="color:#ff00ff"&gt;1&lt;/span&gt; which is the 5&lt;sup&gt;th&lt;/sup&gt; Triangular Number for K&lt;sub&gt;6&lt;/sub&gt; with 6 vertices.  Also this &lt;a href="http://en.wikipedia.org/wiki/Mathematical_induction"&gt;inductive&lt;/a&gt; construction is similar to the above &lt;a href="http://en.wikipedia.org/wiki/Recursion"&gt;recursive&lt;/a&gt; function; remember &lt;a href="http://en.wikipedia.org/wiki/Recursion"&gt;recursion&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Mathematical_induction"&gt;induction&lt;/a&gt; are related, except you would call it with (n - 1) e.g. triangularNumber(n -1).&lt;/p&gt;&lt;p&gt;The &lt;a href="http://en.wikipedia.org/wiki/Adjacency_matrix"&gt;Adjacency Matrix&lt;/a&gt; is a way to represent the edges between vertices in a &lt;a href="http://en.wikipedia.org/wiki/Matrix_(mathematics)"&gt;Matrix&lt;/a&gt;. For a graph of n vertices it has the form: &lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-JgbxWklpRlM/Tiw0r9WD96I/AAAAAAAAAL0/IYSOxPXDFqY/s1600/Matrix-template-empty.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="120" width="188" src="http://1.bp.blogspot.com/-JgbxWklpRlM/Tiw0r9WD96I/AAAAAAAAAL0/IYSOxPXDFqY/s400/Matrix-template-empty.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/Matrix-template-empty.png"&gt;  &lt;/p--&gt;&lt;p&gt;Each position a&lt;sub&gt;r,c&lt;/sub&gt; where r is the row and c is the column represents an edge, or possibly a count of edges, that connects vertex number r to vertex number c. The following gives the template structure for the matrix for K&lt;sub&gt;6&lt;/sub&gt;:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-6Xp7xO7n9CY/TjVjYL4U_0I/AAAAAAAAANU/eoLHKVHAb8A/s1600/k6adj-template.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="120" width="272" src="http://4.bp.blogspot.com/-6Xp7xO7n9CY/TjVjYL4U_0I/AAAAAAAAANU/eoLHKVHAb8A/s400/k6adj-template.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"&gt; &lt;img src="image/adjmatrix.png"&gt;  &lt;/p--&gt;&lt;p&gt;As you can see from the above matrix that each colored edge maps to the corresponding adjacency element, edge 1 –&gt; 2 is represented by the blue a&lt;sub&gt;1,2&lt;/sub&gt; and that all of the 1 -&gt; n and n -&gt; 1 edge elements appear in blue and this pattern repeats for all the colored edges. For this example we are only going to consider &lt;a href="http://en.wikipedia.org/wiki/Simple_graph#Simple_graph"&gt;Simple Graphs&lt;/a&gt;, usually just referred to as Graphs, which only have one edge between any two edges as opposed to &lt;a href="http://en.wikipedia.org/wiki/Multigraph"&gt;Multigraphs&lt;/a&gt; which allow edges to repeat between vertices so all elements of the matrix can only be either 0 or 1.  Also we are not considering graphs which have &lt;a href="http://en.wikipedia.org/wiki/Loop_(graph_theory)"&gt;Loops&lt;/a&gt; so the &lt;a href="http://en.wikipedia.org/wiki/Diagonal#Matrices"&gt;diagonal&lt;/a&gt; where each the row equals the column a&lt;sub&gt;i,i&lt;/sub&gt; will always be 0.  So our template will now take the (tr&amp;egrave;s triangular) form:&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-iqJgbNDeu2k/TjVjfCpcCUI/AAAAAAAAANc/VeE_LDAduXI/s1600/k6adj-template-diag.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="120" width="272" src="http://4.bp.blogspot.com/-iqJgbNDeu2k/TjVjfCpcCUI/AAAAAAAAANc/VeE_LDAduXI/s400/k6adj-template-diag.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center"" style="text-align:center"&gt; &lt;img src="image/adj-simple.png"&gt;  &lt;/p--&gt;&lt;p&gt;We are only considering the &lt;a href="http://en.wikipedia.org/wiki/Adjacency_matrix"&gt;Adjacency Matrix&lt;/a&gt; for the &lt;a href="http://en.wikipedia.org/wiki/Undirected_graph#Undirected_graph"&gt;Undirected Graph&lt;/a&gt; which will have the property that the upper right triangular portion will be symmetric to the lower left triangular portion, or in other words the terms a&lt;sub&gt;i,j&lt;/sub&gt; and a&lt;sub&gt;j,i&lt;/sub&gt; are equal: a&lt;sub&gt;i,j&lt;/sub&gt; = a&lt;sub&gt;j,i&lt;/sub&gt;, this is referred to as a &lt;a href="http://en.wikipedia.org/wiki/Symmetric_matrix"&gt;Symmetric Matrix&lt;/a&gt;.  From our colorful K&lt;sub&gt;6&lt;/sub&gt; example from above we have the following adjacency matrix.  The color which maps to the edges to their representation in the matrix also helps illuminate the symmetry, if you visualize &lt;a href="http://en.wikipedia.org/wiki/Rotation_(mathematics)"&gt;rotating&lt;/a&gt; the matrix around the &lt;a href="http://en.wikipedia.org/wiki/Diagonal#Matrices"&gt;diagonal&lt;/a&gt; of zeros you can see that they are the same.&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-WF8wRQZAsEM/TjVwAxHMn7I/AAAAAAAAANk/6r6Cf5giuYk/s1600/k6adj.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="120" width="161" src="http://3.bp.blogspot.com/-WF8wRQZAsEM/TjVwAxHMn7I/AAAAAAAAANk/6r6Cf5giuYk/s400/k6adj.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!--p align="center" style="text-align:center"&gt; &lt;img src="image/k6adj.png"&gt;  &lt;/p--&gt;&lt;p&gt;Also you may have noticed, and this is not a coincidence, that this structure is very similar to our square constructed from n and the two  T&lt;sub&gt;n-1&lt;/sub&gt; triangles (T&lt;sub&gt;n-1&lt;/sub&gt; + T&lt;sub&gt;n-1&lt;/sub&gt; + n). If you rotate the above square by 90 degrees either in a clockwise or counterclockwise direction and replace the black dots with zeros and the blue dots with ones you get the adjacency matrix for the K&lt;sub&gt;n&lt;/sub&gt; graph.&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-3B24K_wK-0w/Tiw1DNjXUqI/AAAAAAAAAMU/yXiksf3zuVo/s1600/trinum-square-3.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="140" width="140" src="http://2.bp.blogspot.com/-3B24K_wK-0w/Tiw1DNjXUqI/AAAAAAAAAMU/yXiksf3zuVo/s400/trinum-square-3.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;!-- p align="center" style="text-align:center"&gt; &lt;img src="image/trinum-square-3.jpg"&gt;  &lt;/p--&gt;&lt;p&gt;Well this is my first, but not last "pure" math post, except perhaps for the two code snippets.  I feel that these concepts are important and relevant to programmers and probably willso all positions of the graph can either be 0 or 1 only be more so in the future, the &lt;a href="http://en.wikipedia.org/wiki/Adjacency_matrix"&gt;Adjacency Matrix&lt;/a&gt; is pretty important regarding anything relating to graph Theory like the &lt;a href="http://en.wikipedia.org/wiki/PageRank"&gt;Page Rank Algorithm&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/Social_network_theory"&gt;Social Network Theory&lt;/a&gt;, there is a lot more to say about it and I have at least one follow on post planned in this area as well.  The goal here was to present the &lt;a href="http://en.wikipedia.org/wiki/Adjacency_matrix"&gt;Adjacency Matrix&lt;/a&gt; in a context that makes it more interesting and intuitive, and to convey some of the beauty of these structures, hopefully I succeeded in some small measure to do that.  I admit my approach here is somewhat unconventional and I may have taken some artistic license with some ideas such as the terms &lt;a href="http://en.wikipedia.org/wiki/Combinatorics"&gt;combinatorial&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Mathematical_induction"&gt;inductive&lt;/a&gt;, but I think they fit.  Also I am not sure I fully understand the concept of area in the discrete context.  I hope you found this as enjoyable to read as I found it to write.  When I first had the idea I realized that I needed to draw a number of images, &lt;a href="http://processing.org/"&gt;Processing&lt;/a&gt; really came in handy and was a blast to use for it, and it has given me a whole new perspective on &lt;a href="    http://en.wikipedia.org/wiki/Geometry"&gt;geometric&lt;/a&gt;/graphical programming and visualization, I hope to do more with it including writing about it.  Additionally &lt;a href="http://mathurl.com/"&gt;LaTex&lt;/a&gt; has been great for creating math expressions. &lt;/p&gt;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt;This was also known to ancient mathematicians.&lt;/p&gt;&lt;p&gt;&lt;sup&gt;2&lt;/sup&gt;Only one right-isosceles triangle exists in Euclidean Geometry.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-4656210416606979397?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/F9VkFA0SDxg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/F9VkFA0SDxg/triangles-triangular-numbers-and.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-d-oj4p2MrR0/Tiwwc7UTolI/AAAAAAAAAJs/2foem8FPFro/s72-c/triangle.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/07/triangles-triangular-numbers-and.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-1251267441658249123</guid><pubDate>Tue, 19 Jul 2011 01:13:00 +0000</pubDate><atom:updated>2012-05-06T12:15:26.779-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Rant</category><category domain="http://www.blogger.com/atom/ns#">Education</category><title>The Certificate Industry</title><description>&lt;div&gt; &lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-sZeAEwnWiLc/TiTVhVLMhbI/AAAAAAAAAG0/HKcJlbgtjVs/s1600/Graduates_of_Brunswick_High_in_2007.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="213" width="320" src="http://4.bp.blogspot.com/-sZeAEwnWiLc/TiTVhVLMhbI/AAAAAAAAAG0/HKcJlbgtjVs/s320/Graduates_of_Brunswick_High_in_2007.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;I have been thinking about writing this for a while now and as I write this there is something of an education debate in part spurred on by remarks made by &lt;a href="http://techcrunch.com/2011/04/10/peter-thiel-were-in-a-bubble-and-its-not-the-internet-its-higher-education/"&gt;Peter Thiel&lt;/a&gt;.  I have no interest in being part of that debate. Actually this is more of a rant that is on the periphery of that discussion.  My complaint is that there seems to be a whole industry that surrounds the idea of certifying people as knowledgeable or learned in certain areas whereas my experience is that many people who carry these certifications then think themselves knowledgeable and or qualified to do certain tasks yet they are often severely lacking in knowledge and ability.  I have met many people who look at education solely as a means to a job and then rest on the laurels of their prior educational accomplishments and see no need to further their education beyond college.  I cannot tell you how many people I have met who seem to have no interest in the very subject that they majored in college, it makes me feel as though the degree was the only goal not the knowledge gained to receive the degree and picking a major was a mandatory option to attain the degree.  It is this type of goal oriented education that seems to be the bane of our educational system which is nicely, albeit nervously, &lt;a href="http://www.youtube.com/watch?v=9M4tdMsg3ts"&gt;articulated&lt;/a&gt;&lt;a href="#1"&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt; by &lt;a href="http://americaviaerica.blogspot.com/2010/07/coxsackie-athens-valedictorian-speech.html"&gt;Erica Goldson&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
I am lumping college degrees including advanced degrees and corporate, often product related, certifications together, not to mention the mentality by corporations that these, &amp;nbsp;as Erica Goldson&amp;nbsp;puts it, "pieces of paper that tell us that we are smart enough to do so" seem to be seen as the end all in qualifications. Now obviously not all companies think this way, in fact determining actual skills and knowledge during interviews, especially of programmers, seems to be a subject of much protracted debate on the inter-tubes.  I am not saying that are not people who effectively avail themselves of their educational opportunities and are not passionate about their fields, I just feel these people are not in the majority.&lt;/p&gt;&lt;p&gt;The certificate that I find the most irksome is &lt;a href="http://en.wikipedia.org/wiki/Project_Management_Institute"&gt;PMI&lt;/a&gt;’s &lt;a href="http://en.wikipedia.org/wiki/Project_Management_Professional"&gt;PMP&lt;/a&gt;.  In my experience I have dealt with many managers who proudly append this suffix to their names and companies seem to regard this as a concrete qualification for managing a project, however, my experience is that it usually is not. The most egregious example of this in my experience was using twenty-something liberal arts majors with &lt;a href="http://en.wikipedia.org/wiki/Project_Management_Professional"&gt;PMP&lt;/a&gt; certifications to manage software projects as I have previously &lt;a href="http://www.elegantcoding.com/2011/05/driven-development.html"&gt;mentioned&lt;/a&gt;.  I know someone who is pretty involved in the PMI community and she points out that this deficiency is not the methodology itself but due to the fact that the processes are either not applied or improperly applied, so I am in no position to comment on the efficacy of their methodology.  Regardless of that fact it seems like PMI has a pretty lucrative business selling these certifications.&lt;/p&gt;&lt;p&gt;On the other end of the spectrum I have encountered people who hold masters degrees in Computer Science, who seem rather lacking in the fundamentals, I have met relatively recent graduates who strain to tell you the difference between an &lt;a href="http://en.wikipedia.org/wiki/Nondeterministic_finite_state_machine"&gt;NDFA&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Deterministic_finite_automaton"&gt;DFA&lt;/a&gt;. In one case a young recent graduate saw a document on by desk with the title &lt;a href="http://en.wikipedia.org/wiki/Lambda_calculus"&gt;"Lambda Calculus"&lt;/a&gt; and asked me why I was reading about &lt;a href="http://en.wikipedia.org/wiki/Calculus"&gt;Calculus&lt;/a&gt;, when I responded "it’s not Calculus it’s Lambda Calculus", he replied with "what’s that?"  I then said, "You know what a Turing Machine is" thinking I would explain it in terms Turing Equivalence, and he replies "No."  At that point I was dumbfounded and retorted with "How the hell can you have a Masters in Computer Science and not know what a Turing Machine is?"  I then pulled it up on Wikipedia and he claimed to know it, he probably did, it turned out he was pretty bright with a fair amount of potential but kind of an airhead, still it struck me as pretty lame, plus shouldn’t someone with a Masters in CS at least have heard of Lambda Calculus and know about Turing Machines off of the top of their head?  Now this doesn’t only apply to theoretical knowledge, I have worked with some Masters degree holders who were terrible programmers.  Once again this not to say that there aren’t bright knowledgeable Masters Degree holders who are knowledgable and good programmers, but clearly having that piece of paper does not make it so.&lt;/p&gt;&lt;p&gt;Now these are just my experiences but you will find other mention of these types of experiences also related to Microsoft, Sun and other corporate certifications, remember selling certifications are businesses which can be fairly profitable.&lt;/p&gt;&lt;p&gt;I recently came across this &lt;a href="http://www.nytimes.com/2011/06/11/technology/11computing.html?_r=2&amp;amp;pagewanted=all"&gt;article&lt;/a&gt; on the New York Times website about how the movie "The Social Network" has renewed interest in Computer Science Curriculums because many starry eyed college students are seeing themselves as possibly being the next Mark Zuckerberg.  This reminds me of a previous coworker who had graduated around the time of the last tech bubble, this guy was actually pretty sharp but he had sporadic interest in the day to day work and would often gripe that he really didn’t like the field, and he was only in it because it was a well paying career.  I admit as someone who is passionate about my career and my field of study I find this mentality extremely frustrating, I feel that these are the exact people that you do not want to hire, now obviously not all of these new enthusiasts will be like that, but as a word of advice, most people working in startups tend to make less money than salaried employees, because even if your company is successful that doesn’t mean that it will have some huge market valuation and if it fails you are out of the street to start anew or find a job, of course if you want try it go for it.  Now there are diverse areas that you can go into in IT but be prepared to find something that you like to do every day, don’t just do it because it pays well or you might get rich, both may happen especially the  former which is a lot less glamorous.  I’m just saying for every Mark Zuckerberg there thousands of us workaday developers who are just out there making a living at our "craft". And you may find that your life in this field ends up being more like the movie "Office Space" than the "Social Network".&lt;/p&gt;&lt;p&gt;Just to be clear here, I really enjoy and admire academia and academic work, but unfortunately I think, perhaps unjustly, that many CS curriculums are broken in terms of practicality and how and what math they teach you. So if you want to learn programming and start a company, you might want to: just do it, but if you are serious about the field and the discipline of software then you might want to go the education route and avail yourself of the possible opportunities that it offers. &lt;/p&gt;&lt;p&gt;Maybe it’s just because I’ve become jaded over the years but I am really skeptical about this Hollywood/Rockstar mentality that seems to now taint our industry and I think that in some ways this is indicative of the real problem with education in our society in that we view education solely as a means to a better job and we do not truly respect knowledge and learning. It’s all about the Benjamins baby.  &lt;/p&gt;&lt;p&gt;&lt;a name="1"&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt;I admire her Courage for speaking out like that.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-1251267441658249123?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/stxreHo90yo" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/stxreHo90yo/certificate-industry.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-sZeAEwnWiLc/TiTVhVLMhbI/AAAAAAAAAG0/HKcJlbgtjVs/s72-c/Graduates_of_Brunswick_High_in_2007.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/07/certificate-industry.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-3917347612606009524</guid><pubDate>Sun, 19 Jun 2011 14:04:00 +0000</pubDate><atom:updated>2012-05-06T12:18:29.898-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Graph Theory</category><category domain="http://www.blogger.com/atom/ns#">Topology</category><category domain="http://www.blogger.com/atom/ns#">Combinatorics</category><category domain="http://www.blogger.com/atom/ns#">Abstract Algebra</category><category domain="http://www.blogger.com/atom/ns#">Education</category><category domain="http://www.blogger.com/atom/ns#">Linear Algebra</category><category domain="http://www.blogger.com/atom/ns#">Math</category><category domain="http://www.blogger.com/atom/ns#">Set Theory</category><category domain="http://www.blogger.com/atom/ns#">Logic</category><category domain="http://www.blogger.com/atom/ns#">Group Theory</category><category domain="http://www.blogger.com/atom/ns#">Category Theory</category><category domain="http://www.blogger.com/atom/ns#">Computer Science</category><category domain="http://www.blogger.com/atom/ns#">Probability Theory</category><title>Free Math Resources You Can Use</title><description>&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-9hGUQVcHz30/TgYBrp0aegI/AAAAAAAAAGk/GJ1zmTL1h3o/s1600/Universum.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="250" width="320" src="http://1.bp.blogspot.com/-9hGUQVcHz30/TgYBrp0aegI/AAAAAAAAAGk/GJ1zmTL1h3o/s320/Universum.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;style&gt;

p.searchtext {
    font-family       : Andale Mono, Lucida Console, Monaco, fixed, monospace;
    color             : #000;
    background-color  : #eee;
    font-size         : 12px;
    border            : 1px #999999;
    line-height       : 14px;
    padding           : 5px;
    overflow          : auto;
    width             : 100%;
    text-indent       : 0px;
}

p.fauxlink, span.fauxlink {
    color:blue;
    text-decoration:underline


}

h3 {

    font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;
    font-size: 12px;
    font-style: normal;
    font-variant: normal;
    font-weight: bold;
}

h2 {

    font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;
    font-size: 14px;
    font-style: normal;
    font-variant: normal;
    font-weight: bold;
    height: 22px;
}

&lt;/style&gt;&lt;br /&gt;
&lt;p&gt;In my opinion, this actually may be the best time in human history to learn math, or just about anything for that matter.  If you are of sufficient means to have access to the internet, which unfortunately not all people are, you have access to an unprecedented amount of information.  The problem is the overwhelming amount of information that is out there and how to find it. So I wanted to share some of my tricks to finding good math information, which I call &amp;quot;Math Mining&amp;quot;, of course these can be used for any academic information, so maybe &amp;quot;Academic Mining&amp;quot; may be more apropos.&lt;/p&gt;&lt;p&gt;One of the reasons that the present time is a good time to learn math is due to the diversity of sources for information, Wikipedia is one of those sources, &lt;a href="http://www.elegantcoding.com/2011/06/math-for-programmers-tng.html"&gt;Wiki Surfing&lt;/a&gt;, as has been previously discussed, but that is just the tip of the math iceberg and the really cool thing is that there are many resources that can give you entirely new and fresh perspectives on things that may sometimes seem dull and obfuscated by more traditional approaches found in books, not that there aren't a lot of great books too. It really is an exciting time.&lt;/p&gt;&lt;p&gt;Many professors have their publications, notes and course resources freely available on the internet and some of these include full books in pdf or ps or html format. In fact that leads me to my little google trick, let's assume you want to find some information about a math subject, we'll use Linear Algebra as an example.  Then if you use the Google search:&lt;/p&gt;&lt;p class="searchtext"&gt;&amp;quot;Linear Algebra&amp;quot; inurl:pdf&lt;/p&gt;&lt;p&gt;You will get a lot of hits that are academic pages, these will be a mix of publications and course related material.  Once you find a document, you can use that url to find more information.  For example let's say that our above search leads us to the following (fictitious) url:&lt;/p&gt;&lt;p class="fauxlink"&gt;www.math.umars.edu/~hjfarnsworth/math420/fall2010/chapter10.pdf&lt;/p&gt;&lt;p&gt;After you click the link and get your reward, you should realize that this is a potential gateway to much more information.  Now admittedly this might be seen as a moral gray area, because sometimes I get the feeling that some of these resources are not as openly exposed as they could be so it may be that the instructors do not want to openly share their work and they are practicing security through obscurity, but in my opinion if directory browsing is enabled and/or your documents are indexed by Google, then they're fair game, so if you are someone who this applies to, I suggest that you either share it openly it or lock it down.  I encourage anyone who is sharing their work to do it freely and openly regardless of whether people are taking your classes. After all it's for the greater good. &amp;quot;The greater good.&amp;quot; And if you openly share it then people like me can read it, learn it, know it and talk about how awesome you and your work are. It's a win-win.&lt;/p&gt;&lt;h2&gt;Hack the Site&lt;/h2&gt;&lt;h3&gt;Hack #1 Url Suffix Removal&lt;/h3&gt;&lt;p&gt;By removing &amp;quot;chapter10.pdf&amp;quot; yielding &lt;span class="fauxlink"&gt;www.math.umars.edu/~hjfarnsworth/math420/fall2010/&lt;/span&gt; will expose more resources if this directory has browsing enabled or if it has a default page.  You can progressively remove directories to find one that is useful, and actually sometimes it is worth it to jump directly to &lt;span class="fauxlink"&gt;www.math.umars.edu/~hjfarnsworth/&lt;/span&gt; which will often be a professor home page which can yield links to publications, course pages with documents, and other potentially interesting information. &lt;/p&gt;&lt;h3&gt;Hack #2 File Name Enumeration&lt;/h3&gt;&lt;p&gt;So you looked at chapter10.pdf and it's awesome but Hack #1 did not yield it or the related chapters. Due to the naming convention try: &lt;span class="fauxlink"&gt;www.math.umars.edu/~hjfarnsworth/math420/fall2010/chapter09.pdf&lt;/span&gt; or &lt;span class="fauxlink"&gt;www.math.umars.edu/~hjfarnsworth/math420/fall2010/chapter9.pdf&lt;/span&gt;, often this approach will yield other related documents.&lt;/p&gt;&lt;h3&gt;Hack #3 Invoke the Power of Google&lt;/h3&gt;&lt;p&gt;Let's say the hack #1 didn't work and the resultant url had a random characteristic like:&lt;/p&gt;&lt;p class="fauxlink"&gt;www.math.umars.edu/~hjfarnsworth/math420/fall2010/larnd42-chap10.pdf&lt;/p&gt;&lt;p&gt;The following Google search will ferret out those pesky hard to find pdf's:&lt;/p&gt;&lt;p class="searchtext"&gt;site:www.math.umars.edu/~hjfarnsworth/ inurl:pdf&lt;/p&gt;&lt;p&gt;Also you can use .ps and .ps.gz in place of .pdf for file type searches.  If you feel that this is crossing some kind of moral line then don't do it, but I like to say all is fair in Love and Math.&lt;/p&gt;&lt;p&gt;I would like to give another example of this technique, I recently came across &lt;a href="http://atbrox.com/2011/05/16/mapreduce-hadoop-algorithms-in-academic-papers-4th-update-may-2011/"&gt;&amp;quot;Mapreduce &amp;amp; Hadoop Algorithms in Academic Papers (4th update - May 2011)&amp;quot;&lt;/a&gt; which linked to &lt;a href="http://portal.acm.org/citation.cfm?id=1772715"&gt;&amp;quot;Max-cover algorithm in map-reduce&amp;quot;&lt;/a&gt; which caught my interest, and of course the ACM is charging for it, but no worries, there is usually no need to pay them, actually I recommend boycotting them.  I employed the above tricks but they didn't work, simply Googling one of the authors did (always pick the most unique name(s)):&lt;/p&gt;&lt;p class="searchtext"&gt;&amp;quot;Flavio Chierichetti&amp;quot;&lt;/p&gt;&lt;p&gt;Pulled up his web &lt;a href="http://lightless.org/papers"&gt;site&lt;/a&gt; which had a free copy of the paper, now all I have to do is find the time to read it.  Also the above techniques yielded the paper's &lt;a href="http://www.mpi-inf.mpg.de/departments/d5/teaching/ws10_11/cc/presentations/20110208-isha-khosla.pdf"&gt;&amp;quot;cliff notes&amp;quot;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Of course you can just look up someone by name, for example, you can find some of &lt;a href="http://www-cs-faculty.stanford.edu/~uno/"&gt;Donald Knuth's&lt;/a&gt; publications &lt;a href="http://www-cs-faculty.stanford.edu/~uno/preprints.html"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;In regards to academic publications there are two excellent repositories with a wealth of information these are &lt;a href="http://citeseer.ist.psu.edu/"&gt;Citeseer&lt;/a&gt; out of Penn State, this site can be a little flaky in terms of availability, at least that's been my experience in the past and the other is &lt;a href="http://arxiv.org/"&gt;arXiv&lt;/a&gt; run by Cornell University.  These mostly contain research oriented work but you can often find relevant information even for neophytes, actually a lot of advanced papers and books for that matter start out with introductory sections that can be worth looking at.&lt;/p&gt;&lt;h2&gt;Encyclopedic and other Miscellaneous Resources&lt;/h2&gt;&lt;p&gt;&lt;a href="http://www.wikipedia.org/"&gt;Wikipedia&lt;/a&gt;, obviously, as previously mentioned. Also the oft controversial Stephen Wolfram provides an excellent resource called &lt;a href="http://mathworld.wolfram.com/"&gt;Wolfram Mathworld&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://projecteuler.net/"&gt;Project Euler&lt;/a&gt; is a site dedicated to collaboratively solving math oriented problems programmatically more about it can be found &lt;a href="http://math-blog.com/2009/08/19/improve-your-math-and-programming-skills-with-project-euler/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.mathontheweb.org/mathweb/index.html"&gt;Math on the Web&lt;/a&gt; by category &lt;a href="http://www.mathontheweb.org/mathweb/mi-mathbyclass.html"&gt;here&lt;/a&gt; provides some interesting links, I believe this is run by the &lt;a href="http://ams.org/"&gt;American Mathematical Society&lt;/a&gt; but I am not sure.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The &lt;a href="http://www.nist.gov/index.html"&gt;National Institute of Standards and Technology&lt;/a&gt; site: &lt;a href="http://dlmf.nist.gov/"&gt;NIST Digital Library of Mathematical Functions&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Also there is &lt;a href="http://mathoverflow.net/"&gt;Mathoverflow&lt;/a&gt; which is a &lt;a href="http://stackoverflow.com/"&gt;Stackoverflow&lt;/a&gt; type of question and answer community devoted to Math.&lt;/p&gt;&lt;h2&gt;Blogs&lt;/h2&gt;&lt;p&gt;There are a number of blogs that blog about both math and programming related math. Actually if your primary interest is machine learning, I recommend Bradford Cross's &lt;a href="http://measuringmeasures.com/"&gt;Measuring Measures&lt;/a&gt; blog, it is hard to find things on his site and it was recently restyled with a magenta/maroon background which I now find a little bit harder to read. The relevant links here are: &lt;a href="http://measuringmeasures.com/blog/2010/6/9/learning-about-network-theory.html"&gt;Learning About Network Theory&lt;/a&gt;, &lt;a href="http://measuringmeasures.com/blog/2010/3/12/learning-about-machine-learning-2nd-ed.html"&gt;Learning About Statistical Learning&lt;/a&gt;, and &lt;a href="http://measuringmeasures.com/blog/2010/1/15/learning-about-statistical-learning.html"&gt;Learning About Machine Learning, 2nd ed&lt;/a&gt;. Additionally Ravi Mohan did a follow-up: &lt;a href="http://pindancing.blogspot.com/2010/01/learning-about-machine-learniing.html"&gt;Learning about Machine Learning&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://scientopia.org/blogs/goodmath/"&gt;Good Math Bad Math&lt;/a&gt; by Mark Chu-Carroll has lots of good articles about math including some for beginners in various areas.  &lt;a href="http://www.catonmat.net/sitemap/"&gt;Catonmat&lt;/a&gt; by Peteris Krumins has some nice entries with notes about the online MIT courses that he has worked through which currently covers Algorithms and Linear Algebra also mentioned above.  The &lt;a href="http://unapologetic.wordpress.com/"&gt;Unapologetic Mathematician&lt;/a&gt; has a lot of nice articles, this is a bit more advanced though.  &lt;a href="http://math-blog.com/"&gt;Math-Blog&lt;/a&gt; has a lot of articles as well. They tend to focus on more traditional areas of math.  Math blog's abound and there are too many to mention, here's a few: &lt;ul&gt;&lt;li&gt;&lt;a href="http://golem.ph.utexas.edu/category/"&gt;The n-Category Caf&amp;eacute;&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.mikael.johanssons.org/"&gt;Michi's blog&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.sigfpe.com/"&gt;A Neighborhood of Infinity&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://xorshammer.com/"&gt;XOR's Hammer&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://rjlipton.wordpress.com/"&gt;G&amp;ouml;del's Lost Letter and P=NP&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://terrytao.wordpress.com/"&gt;Terrance Tao's Blog&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.arsmathematica.net/"&gt;Arsmathematica&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://opinionator.blogs.nytimes.com/category/steven-strogatz/"&gt;Steven Strogatz&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.maa.org/devlin/"&gt;Devlin's Angle&lt;/a&gt; by Keith Devlin &lt;/li&gt;
&lt;li&gt;The programming/CS Theoretical &lt;a href="http://lambda-the-ultimate.org/"&gt;Lambda The Ultimate&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;Lastly I will mention a blog by Jeff Moser, actually he only has a few math related posts, but his &lt;a href="http://www.moserware.com/2010/03/computing-your-skill.html"&gt;Computing your Skill&lt;/a&gt; on Probability and Statistics is a beautiful work of art well worth looking at. &lt;/p&gt;&lt;h2&gt;Online Courses&lt;/h2&gt;&lt;p&gt;The well known &lt;a href="http://www.khanacademy.org/"&gt;Khan Academy&lt;/a&gt; offers a number of courses including several math courses.&lt;/p&gt;&lt;p&gt;&lt;a href="http://ocw.mit.edu/index.htm"&gt;MIT  Open Courseware&lt;/a&gt; has many online courses most notably for CS majors &lt;a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005"&gt;Introduction to Algorithms&lt;/a&gt; by the venerable Charles Leiserson and Erik Demaine videos &lt;a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/video-lectures/"&gt;here&lt;/a&gt; and &lt;a href="http://ocw.mit.edu/courses/mathematics/18-06-linear-algebra-spring-2010/video-lectures/"&gt;Linear Algebra&lt;/a&gt; by Gilbert Strang.&lt;/p&gt;&lt;p&gt;On &lt;a href="http://see.stanford.edu/see/courses.aspx"&gt;Stanford Engineering Everywhere&lt;/a&gt;  the following might be of interest:&lt;/p&gt;&lt;p&gt;&lt;a href="http://see.stanford.edu/see/courseinfo.aspx?coll=348ca38a-3a6d-4052-937d-cb017338d7b1"&gt;Artificial Intelligence | Machine Learning&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://see.stanford.edu/see/courseinfo.aspx?coll=63480b48-8819-4efd-8412-263f1a472f5a"&gt;Artificial Intelligence | Natural Language Processing&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://see.stanford.edu/see/courseinfo.aspx?coll=84d174c2-d74f-493d-92ae-c3f45c0ee091"&gt;Linear Systems and Optimization | The Fourier Transform and its Applications&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://video.google.com/videoplay?docid=6939278368247493737#docid=-6774539130229106025"&gt;The Mechanical Universe&lt;/a&gt; is primarily dedicated to physics, but several math topics such as Calculus and Vectors are covered explicitly.  It's also a nice series of lectures on the topic in spite of being a little dated in productions values. &lt;/p&gt;&lt;h2&gt;Other Online Videos&lt;/h2&gt;&lt;p&gt;Two math documentaries are covered &lt;a href="http://math-blog.com/2009/07/27/two-beautiful-mathematical-documentaries/"&gt;here&lt;/a&gt;  are &lt;a href="http://video.google.com/videoplay?docid=8269328330690408516&amp;amp;hl=en#"&gt;Fermat’s Enigma: The Epic Quest to Solve the World’s Greatest Mathematical Problem&lt;/a&gt;  and the overly dramatic but still interesting &lt;a href="http://video.google.com/videoplay?docid=-5122859998068380459&amp;amp;hl=en#"&gt;Dangerous Knowledge&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://topdocumentaryfilms.com/the-story-of-maths/"&gt;The story of Maths&lt;/a&gt; by Marcus du Sautoy.&lt;/p&gt;&lt;p&gt;Keith Devlin talks about Pascal and Fermat's coorespondance while working out probability in this intersting talk: &lt;a href="http://www.youtube.com/watch?v=3pRM4v0O29o#t=5m00s"&gt;Authors@Google: Keith Devlin&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.youtube.com/watch?v=zsN_guq__Ac"&gt;Bob Franzosa - Introduction to Topology&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.youtube.com/user/TheCatsters"&gt;The Catsters videos&lt;/a&gt; on youtube cover various Category Theory related topics.&lt;/p&gt;&lt;p&gt;N J Wildberger's   &lt;a href="http://freevideolectures.com/Course/2721/Algebraic-Topology"&gt;Algebraic Topology&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Dan Spielman has a video discussing &lt;a href="http://player.bitgravity.com/debug/embedcode.php?ap=true&amp;video=http%3A//bitcast-a.bitgravity.com/highbrow/livearchive40009/21aug-13.45to14.45.flv"&gt;Expander Graphs&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://academicearth.org/lectures/introduction-to-game-theory"&gt;Introduction to Game Theory&lt;/a&gt; by &lt;a href="http://academicearth.org/speakers/benjamin-polak"&gt;Benjamin Polak&lt;/a&gt; at Yale.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;The site &lt;a href="http://videolectures.net/"&gt;videolectures&lt;/a&gt; has many lectures in &lt;a href="http://videolectures.net/Top/Computer_Science/"&gt;Computer Science&lt;/a&gt; and &lt;a href="http://videolectures.net/Top/Mathematics/"&gt;Math&lt;/a&gt; including:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://videolectures.net/bootcamp07_keller_bss/"&gt;Basics of probability and statistics&lt;/a&gt; by Mikaela Keller.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://videolectures.net/bootcamp07_quinonero_ptb/"&gt;Probability, Information Theory and Bayesian Inference&lt;/a&gt; by Joaquin Quiñonero Candela.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://videolectures.net/mlss09uk_bishop_ibi/"&gt;Introduction To Bayesian Inference&lt;/a&gt; by Christopher Bishop&lt;/li&gt;
&lt;li&gt;&lt;a href="http://videolectures.net/mlss09uk_mackay_it/"&gt;Information Theory&lt;/a&gt; by David MacKay&lt;/li&gt;
&lt;li&gt;&lt;a href="http://videolectures.net/gpip06_mackay_gpb/"&gt;Gaussian Process Basics&lt;/a&gt; by David MacKay,&lt;/li&gt;
&lt;li&gt;&lt;a href="http://videolectures.net/mlss04_taylor_slt/"&gt;Statistical Learning Theory&lt;/a&gt; by John Shawe-Taylor&lt;/li&gt;
&lt;li&gt;&lt;a href="http://videolectures.net/mlss05us_ghahramani_bl/"&gt;Bayesian Learning&lt;/a&gt; by Zoubin Ghahramani.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;If you find these videos too slow &lt;a href="http://sites.google.com/site/variablespeedlectures/"&gt;this&lt;/a&gt; might interest you.&lt;/p&gt;&lt;h2&gt;Math Software&lt;/h2&gt;&lt;p&gt;There are many math related software packages and libraries three of which are covered in more detail &lt;a href="http://math-blog.com/2007/06/02/3-awesome-free-math-programs/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Math library &lt;a href="http://www.sagemath.org/"&gt;Sage&lt;/a&gt; written in Python&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.gnu.org/software/octave/"&gt;GNU Octave&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.r-project.org/"&gt;The R project for Statistical Computing&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.scilab.org/"&gt;Scilab&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://maxima.sourceforge.net/"&gt;Maxima, a Computer Algebra System&lt;/a&gt;&lt;/p&gt;&lt;h2&gt;Various Books and Academic Stuff&lt;/h2&gt;&lt;br /&gt;
&lt;p&gt;Here are a bunch of interesting courses and books that I have encountered during my searching which you might find interesting as well. These are presented in no particular order:  &lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name="Algorithims" /&gt;&lt;br /&gt;
&lt;h3&gt;Algorithims&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.cs.berkeley.edu/~vazirani/algorithms.html"&gt;Algorithms&lt;/a&gt; by S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani. &lt;/p&gt;&lt;p&gt;&lt;a href="http://theory.cs.uiuc.edu/~jeffe/"&gt;Jeff Erickson&lt;/a&gt; has some &lt;a href="http://theory.cs.uiuc.edu/~jeffe/teaching/algorithms/"&gt;Algorithms Course Materials&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.cs.sunysb.edu/~skiena/"&gt;Steven Skiena&lt;/a&gt; author of the The Algorithm Design Manual offers some pretty comprehensive course notes for his &lt;a href="http://www.cs.sunysb.edu/~cse541/"&gt;cse541 LOGIC for COMPUTER SCIENCE&lt;/a&gt; not to mention the opportunity to learn how to &lt;a href="http://www.cs.sunysb.edu/~skiena/jaialai/index.html"&gt;bet on Jai-alai&lt;/a&gt; in the Cayman Islands.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.umcs.maine.edu/~chaitin/"&gt;Gregory Chaitin's&lt;/a&gt; &lt;a href="http://www.umcs.maine.edu/~chaitin/cup.pdf"&gt;Algorithmic Information Theory&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Computer Science" /&gt;&lt;br /&gt;
&lt;h3&gt;Computer Science&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://infolab.stanford.edu/~ullman/focs.html"&gt;Foundations of Computer Science&lt;/a&gt; by &lt;a href="http://infolab.stanford.edu/~ullman/"&gt;Jeffrey Ullman and Al Aho&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://fldit-www.cs.uni-dortmund.de/~peter/PS07/HR.pdf"&gt;The Haskell Road to Logic, Math and Programming&lt;/a&gt; by Kees Doets and Jan van Eijck&lt;/p&gt;&lt;br /&gt;
&lt;a name="Discrete Math" /&gt;&lt;br /&gt;
&lt;h3&gt;Discrete Math&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.macalester.edu/~hutchinson/book/book.html"&gt;Discrete Mathematics with Algorithms&lt;/a&gt; by M. O. Albertson and &lt;a href="http://www.macalester.edu/~hutchinson/"&gt;J. P. Hutchinson&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name="Analysis" /&gt;&lt;br /&gt;
&lt;h3&gt;Analysis&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.webskate101.com/webnotes/home.htmld/home.html"&gt;Analysis WebNotes&lt;/a&gt; is a self-contained course in Mathematical Analysis for undergraduates or beginning graduate students.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www-maths.swan.ac.uk/staff/vl/an1.pdf"&gt;Introduction to Analysis Lecture Notes&lt;/a&gt; by &lt;a href="http://www-maths.swan.ac.uk/staff/vl/"&gt;Vitali Liskevich&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.math.ucdavis.edu/~hunter/book/pdfbook.html"&gt;Applied Analysis&lt;/a&gt; by John Hunter and Bruno Nachtergaele.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.math.ksu.edu/~nagy/real-an/"&gt;REAL ANALYSIS&lt;/a&gt; by &lt;a href="http://www.math.ksu.edu/~nagy/real-an/"&gt;Gabriel Nagy&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Probability_Theory" /&gt;&lt;br /&gt;
&lt;h3&gt;Probability Theory&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.sics.se/~ali/prob/"&gt;Introduction to Probability Theory&lt;/a&gt; by Ali Ghodsi.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.dartmouth.edu/~chance/teaching_aids/books_articles/probability_book/book.html"&gt;Introduction to Probability&lt;/a&gt; by Charles M. Grinstead.&lt;/p&gt;&lt;p&gt;The first three chapters of &lt;a href="http://bayes.wustl.edu/"&gt;Probability Theory: The Logic of Science&lt;/a&gt; by E. T. Jaynes. Can be found &lt;a href="http://bayes.wustl.edu/etj/prob/book.pdf"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.greenteapress.com/thinkstats/"&gt;Think Stats: Probability and Statistics for Programmers&lt;/a&gt; by Allen B. Downey.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.math.purdue.edu/~banuelos/probability.pdf"&gt;LECTURE NOTES MEASURE THEORY and PROBABILITY&lt;/a&gt; by &lt;a href="http://www.math.purdue.edu/~banuelos/site//Lectures"&gt;Rodrigo Ba&amp;ntilde;uelos.&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://uncertainty.stat.cmu.edu/"&gt;Principles of Uncertainty &lt;/a&gt; by by Chapman and Hall.&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.inference.phy.cam.ac.uk/mackay/itila/"&gt;Information Theory, Inference, and Learning Algorithms&lt;/a&gt; by David MacKay.&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name="Machine_Learning_Date_Mining" /&gt;&lt;br /&gt;
&lt;h3&gt;Machine Learning/Date Mining&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.dcs.gla.ac.uk/~girolami/Machine_Learning_Module_2006/"&gt;Machine Learning Module ML(M)&lt;/a&gt; by M. A .Girolami.&lt;/p&gt;&lt;p&gt;&lt;a href="http://alex.smola.org/"&gt;Alexander J. Smola's&lt;/a&gt; and and S.V.N. Vishwanathan's draft of  &lt;a href="http://alex.smola.org/drafts/thebook.pdf"&gt;Introduction to Machine Learning.&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://www-stat.stanford.edu/~tibs/ElemStatLearn/"&gt;The Elements of Statistical Learning: Data Mining, Inference, and Prediction (Second Edition)&lt;/a&gt; by &lt;a href="http://www.stanford.edu/~hastie/"&gt;Trevor Hastie&lt;/a&gt;, Robert Tibshirani and Jerome Friedman. &lt;/p&gt;&lt;p&gt;&lt;a href="http://nlp.stanford.edu/IR-book/information-retrieval-book.html"&gt;Introduction to Information Retrieval&lt;/a&gt; by Christopher D. Manning, Prabhakar Raghavan and Hinrich Sch&amp;uuml;tze. &lt;/p&gt;&lt;p&gt;&lt;a href="http://infolab.stanford.edu/~ullman/mmds.html"&gt;Mining of Massive Datasets&lt;/a&gt; by &lt;a href="http://infolab.stanford.edu/~ullman/"&gt;Jeffrey Ullman&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;a name="Fourier_Theory" /&gt;&lt;br /&gt;
&lt;h3&gt;Fourier Theory&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://see.stanford.edu/see/materials/lsoftaee261/handouts.aspx"&gt;Lecture Notes for EE 261 The Fourier Transform and its Applications&lt;/a&gt; &lt;a href="http://see.stanford.edu/materials/lsoftaee261/book-fall-07.pdf"&gt;pdf&lt;/a&gt; By Brad Osgood.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Abstract_Algebra" /&gt;&lt;br /&gt;
&lt;h3&gt;Abstract Algebra&lt;/h3&gt;&lt;p&gt;&lt;a href="http://abstract.ups.edu/"&gt;Abstract Algebra&lt;/a&gt; by Thomas W. Judson.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.jmilne.org/"&gt;James Milne&lt;/a&gt; has a number of sets of extensive notes on Algebraic topics like goup theory &lt;a href="http://www.jmilne.org/math/CourseNotes/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.math.niu.edu/~beachy/abstract_algebra/guide/contents.html"&gt;ABSTRACT ALGEBRA: A STUDY GUIDE FOR BEGINNERS&lt;/a&gt; by &lt;a href="http://www.math.niu.edu/~beachy/"&gt;John A. Beachy&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.math.miami.edu/~ec/book/"&gt;Elements of Abstract and Linear Algebra&lt;/a&gt; Edwin H. Connell.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="sofia.nmsu.edu/~elbert/AbstractAlgebraBook.pdf"&gt;Abstract Algebra&lt;/a&gt; by &lt;a href="sofia.nmsu.edu/~elbert/"&gt;Elbert A. Walker&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;A series of chapters on &lt;a href="http://web.science.mq.edu.au/~chris/groups/"&gt;groups&lt;/a&gt; by &lt;a href="http://www.maths.mq.edu.au/~chris/"&gt;Christopher Cooper&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Linear_Algebra" /&gt;&lt;br /&gt;
&lt;h3&gt;Linear Algebra&lt;/h3&gt;&lt;p&gt;&lt;a href="http://linear.pugetsound.edu/"&gt;Linear Algebra&lt;/a&gt; by Robert A. Beezer.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;A course on &lt;a href="http://www.math.tamu.edu/~dallen/m640_03c/"&gt;Linear Algebra&lt;/a&gt; with book &lt;a href="http://www.math.tamu.edu/~dallen/m640_03c/perry.htm"&gt;chapters&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Really cool interactive tutorial on &lt;a href="http://www.uwlax.edu/faculty/will/svd/index.html"&gt;Singular Value Decomposition&lt;/a&gt; by Todd Will.&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name="Model_Theory" /&gt;&lt;br /&gt;
&lt;h3&gt;Model Theory&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.math.toronto.edu/weiss/model_theory.html"&gt;Fundamentals of Model Theory&lt;/a&gt; &lt;a href="http://www.math.toronto.edu/weiss/model_theory.pdf"&gt;pdf&lt;/a&gt; by William Weiss and Cherie D'Mello.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Set_Theory" /&gt;&lt;br /&gt;
&lt;h3&gt;Set Theory&lt;/h3&gt;&lt;p&gt;A book on &lt;a href="http://www.math.toronto.edu/weiss/set_theory.html"&gt;Set Theory&lt;/a&gt; &lt;a href="http://www.math.toronto.edu/weiss/set_theory.pdf"&gt;pdf&lt;/a&gt; by William Weiss.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Graph_Theory" /&gt;&lt;br /&gt;
&lt;h3&gt;Graph Theory&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.math.uni-hamburg.de/home/diestel/"&gt;Reinhard Diestel&lt;/a&gt; makes his excellent and comprehensive book &lt;a href="http://diestel-graph-theory.com/"&gt;Graph Theory&lt;/a&gt; available, &lt;a href="http://diestel-graph-theory.com/basic.html"&gt;pdf here&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Logic" /&gt;&lt;br /&gt;
&lt;h3&gt;Logic&lt;/h3&gt;&lt;p&gt;You can find &lt;a href="http://www.algebraworkbench.net/download/n41main.pdf"&gt;Introduction to Mathematical Logic&lt;/a&gt; by J. Adler, J. Schmid, &lt;a href="http://www.algebraworkbench.net/download/n42main.pdf"&gt;Model Theory, Universal Algebra and Order&lt;/a&gt; by J. Adler, J. Schmid, M. Sprenger and other goodies &lt;a href="http://www.algebraworkbench.net/en/index.html"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.79.3317&amp;amp;rep=rep1&amp;amp;type=pdf"&gt;Introduction to Logic&lt;/a&gt; by Michal Walicki.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.cis.upenn.edu/~jean/gbooks/logic.html"&gt;Logic for Computer Science: Foundations of Automatic Theorem Proving&lt;/a&gt; by Jean Gallier.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.novelresearchinstitute.org/library/"&gt;The Novel Research Institute&lt;/a&gt; has a number of free academic books including: &lt;a href="http://www.novelresearchinstitute.org/library/LogicMetaQL2p125.pdf"&gt;Logic and Metalogic:Logic, Metalogic, Fuzzy and Quantum Logics&lt;/a&gt; and &lt;a href="http://www.novelresearchinstitute.org/library/AlgebraicTopology648p19Mb.pdf"&gt;Algebraic Topology, Category Theory and Higher Dimensional Algebra-Results and Applications to Quantum Physics&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;
&lt;a name="Category_Theory" /&gt;&lt;br /&gt;
&lt;h3&gt;Category Theory&lt;/h3&gt;&lt;p&gt;Some course notes on &lt;a href="http://www.maths.gla.ac.uk/~tl/ct/"&gt;Category Theory&lt;/a&gt; by &lt;a href="http://www.maths.gla.ac.uk/~tl/"&gt;Tom Leinster&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.staff.science.uu.nl/~ooste110/onderwijs.html"&gt;Basic Category Theory&lt;/a&gt; &lt;a href="http://www.staff.science.uu.nl/~ooste110/syllabi/catsmoeder.pdf"&gt;pdf&lt;/a&gt; by &lt;a href="http://www.staff.science.uu.nl/~ooste110/"&gt;Jaap van Oosten&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://katmat.math.uni-bremen.de/acc/"&gt;Abstract and Concrete Categories The Joy of Cats&lt;/a&gt; by Jiri Adámek, Horst Herrlich, George E. Strecker.&lt;/p&gt;&lt;p&gt;&lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.78.7317&amp;amp;rank=1"&gt;A gentle introduction to category theory --- the calculational approach&lt;/a&gt; &lt;a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.78.7317&amp;amp;rep=rep1&amp;amp;type=pdf"&gt;pdf&lt;/a&gt; by Maarten M. Fokkinga.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.cs.toronto.edu/~sme/"&gt;Steve Easterbrook's&lt;/a&gt; &lt;a href="http://www.cs.toronto.edu/~sme/presentations/cat101.pdf"&gt;An introduction to Category Theory for Software Engineers&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Algebraic_Topology_Topos_Theory" /&gt;&lt;br /&gt;
&lt;h3&gt;Algebraic Topology/Topos Theory&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.cheng.staff.shef.ac.uk/"&gt;Eugenia Cheng&lt;/a&gt; of Catsters fame has a course in &lt;a href="http://cheng.staff.shef.ac.uk/mas435/"&gt;Algebraic Topology&lt;/a&gt; with some substantial &lt;a href="http://cheng.staff.shef.ac.uk/mas435/algtop-partA.pdf"&gt;notes&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;The above links of Eugenia Cheng refer to &lt;a href="http://www.math.cornell.edu/~hatcher/AT/ATpage.html"&gt;Algebraic Topology&lt;/a&gt; by &lt;a href="http://www.math.cornell.edu/~hatcher/"&gt;Allen Hatcher&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://arxiv.org/abs/1012.5647"&gt;An informal introduction to topos theory&lt;/a&gt; &lt;a href="http://arxiv.org/PS_cache/arxiv/pdf/1012/1012.5647v2.pdf"&gt;pdf&lt;/a&gt; by Tom Leinster.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Topology" /&gt;&lt;br /&gt;
&lt;h3&gt;Topology&lt;/h3&gt;&lt;p&gt;A free, protected, password available by request, e-book on topology: &lt;a href="http://uob-community.ballarat.edu.au/~smorris/topology.htm"&gt;Topology without Tears&lt;/a&gt; by Sidney A. Morris.&lt;/p&gt;&lt;p&gt;Chapters for a topology course by &lt;a href="http://www.math.psu.edu/katok_a/"&gt;Anatole Katok&lt;/a&gt; can be found &lt;a href="http://www.math.psu.edu/katok_a/GT-06.html"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;a name="Computational_Topology" /&gt;&lt;br /&gt;
&lt;h3&gt;Computational Topology&lt;/h3&gt;&lt;p&gt;Jeff Erickson has some nice notes on &lt;a href="http://theory.cs.uiuc.edu/~jeffe/teaching/comptop/"&gt;Computational Topology&lt;/a&gt;, pdf's can be found on the &lt;a href="http://theory.cs.uiuc.edu/~jeffe/teaching/comptop/schedule.html"&gt;schedule page&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.cs.dartmouth.edu/~afra/"&gt;Afra Zomorodian&lt;/a&gt; has some nice resources on &lt;a href="http://www.cs.dartmouth.edu/~afra/papers.html"&gt;Computational Topology&lt;/a&gt; including a nice introductory &lt;a href="http://www.cs.dartmouth.edu/~afra/handbook/ct.pdf"&gt;paper&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;a name="Spectral_Graph_Theory" /&gt;&lt;br /&gt;
&lt;h3&gt;Spectral Graph Theory&lt;/h3&gt;&lt;p&gt;&lt;a href="http://math.ucsd.edu/~fan/"&gt;Fan Chung Graham&lt;/a&gt; has a lot interesting stuff, some pretty advanced, relating to graph theory including social graph theory and spectral graph theory. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.cs.yale.edu/homes/spielman/"&gt;Dan Spielman&lt;/a&gt; has some course notes on &lt;a href="http://www.cs.yale.edu/homes/spielman/561/"&gt;Spectral Graph Theory&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;a name="Expander_Graphs" /&gt;&lt;br /&gt;
&lt;h3&gt;Expander Graphs&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.math.ias.edu/~avi/"&gt;Avi Wigderson's&lt;/a&gt; &lt;a href="http://www.math.ias.edu/~avi/PUBLICATIONS/MYPAPERS/HLW06/hlw06.pdf"&gt;Expander Graphs and their Applications&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;a name="Fractal_Geometry" /&gt;&lt;br /&gt;
&lt;h3&gt;Fractal Geometry&lt;/h3&gt;&lt;p&gt;&lt;a href="http://algorithmicbotany.org/papers/#abop"&gt;The Algorithmic Beauty of Plants&lt;/a&gt; &lt;a href="http://algorithmicbotany.org/papers/abop/abop.pdf"&gt;pdf&lt;/a&gt; by &lt;a href="http://pages.cpsc.ucalgary.ca/~pwp/"&gt;Przemyslaw Prusinkiewicz&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Aristid_Lindenmayer"&gt;Aristid Lindenmayer&lt;/a&gt; is available on the &lt;a href="http://algorithmicbotany.org/"&gt;Algorithmic Botany site&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;a name="Game_Theory" /&gt;&lt;br /&gt;
&lt;h3&gt;Game Theory&lt;/h3&gt;&lt;p&gt;&lt;a href="http://www.math.ucla.edu/~tom/"&gt;Thomas S. Ferguson's&lt;/a&gt; course at UCLA on &lt;a href="http://www.math.ucla.edu/~tom/math167.html"&gt;Game Theory&lt;/a&gt; also &lt;a href="http://www.math.ucla.edu/~tom/stat596.html"&gt;Game Theory for Statisticians&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.economics.utoronto.ca/osborne/cgt/index.html"&gt;A course in game theory&lt;/a&gt; by Martin J. Osborne and Ariel Rubinstein, requires registration.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name="Enumerative_Combinatorics" /&gt;&lt;br /&gt;
&lt;h3&gt;Algebraic/Enumerative Combinatorics&lt;/h3&gt;&lt;p&gt;&lt;a href="http://ocw.mit.edu/courses/mathematics/18-312-algebraic-combinatorics-spring-2009/readings-and-lecture-notes/"&gt;MIT Open Courseware in Algebraic Combinatorics&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;An uncompleted book and notes on &lt;a href="http://www.math.dartmouth.edu/news-resources/electronic/kpbogart/ComboNoteswHints11-06-04.pdf"&gt;Enumerative Combinatorics&lt;/a&gt; by the Late &lt;a href="http://www.math.dartmouth.edu/news-resources/electronic/kpbogart/"&gt;Kenneth P. Bogart&lt;/a&gt; also &lt;a href="http://www.math.dartmouth.edu/archive/kpbogart/public_html/ComboNotes3-20-05.pdf"&gt;here&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.math.cornell.edu/~levine/"&gt;Lionel Levine's&lt;/a&gt; notes on &lt;a href="http://math.mit.edu/~levine/18.312/"&gt;Algebraic Combinatorics&lt;/a&gt; &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www-math.mit.edu/~rstan/"&gt;Richard P. Stanley&lt;/a&gt; new edition of &lt;a href="http://www-math.mit.edu/~rstan/ec/"&gt;Enumerative Combinatorics&lt;/a&gt; &lt;a href="http://www-math.mit.edu/~rstan/ec/ec1.pdf"&gt;Volume one&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.math.uwaterloo.ca/~snburris/htdocs/ualg.html"&gt;A Course in Universal Algebra&lt;/a&gt;  by &lt;a href="http://www.math.uwaterloo.ca/~snburris/"&gt;Stanley N. Burris&lt;/a&gt; and H.P. Sankappanavar &lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;Misc&lt;/h3&gt;&lt;p&gt;Pat Hanrahan's &lt;a href="http://graphics.stanford.edu/courses/cs448b-02-winter/"&gt;CS448B: Visualization&lt;/a&gt;. &lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.cs.gmu.edu/~sean/"&gt;Sean Luke's&lt;/a&gt; "&lt;a href="http://www.cs.gmu.edu/~sean/book/metaheuristics/Essentials.pdf"&gt;Essentials of Metaheuristics&lt;/a&gt;". &lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;It's all a click away&lt;/h3&gt;&lt;p&gt;The links in this entry, especially the academic links are susceptible to link rot, people move from institution to institution or leave academia for jobs in the private sector. I will endeavor to revisit this entry and try to keep these up to date and perhaps even add to them, however, if you encounter this page and have any interest in any or all of these resources I recommend downloading them now so that you have them. &lt;/p&gt;&lt;p&gt;Using the resources of this blog you should be able to get your hands on a huge amount of free resources on a wide range of topics.  This can be helpful if you are on a budget or just want to try before you buy an expensive book on a topic.  I hope you avail yourself of some of these, there's lots of great stuff and if you know of some that I do not please add them in the comments. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-3917347612606009524?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/vHRtsQd-fGM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/vHRtsQd-fGM/free-math-resources-you-can-use.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-9hGUQVcHz30/TgYBrp0aegI/AAAAAAAAAGk/GJ1zmTL1h3o/s72-c/Universum.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/06/free-math-resources-you-can-use.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6918427997759942244.post-597451143496151439</guid><pubDate>Mon, 13 Jun 2011 22:52:00 +0000</pubDate><atom:updated>2012-05-06T12:19:02.147-04:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">Rant</category><category domain="http://www.blogger.com/atom/ns#">Software Development Teams</category><title>RTFC</title><description>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-UzSpy2opSzk/TfVt-g7ta_I/AAAAAAAAAFs/FLGvSmidv-w/s1600/VFag1eaVdn7rmb1a5j45ZiFZo1_500.jpg" imageanchor="1" style=""&gt;&lt;img border="0" height="251" width="320" src="http://3.bp.blogspot.com/-UzSpy2opSzk/TfVt-g7ta_I/AAAAAAAAAFs/FLGvSmidv-w/s320/VFag1eaVdn7rmb1a5j45ZiFZo1_500.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;Often in our industry the M in RTFM is the code itself.  Yes, there should be more documentation but ultimately if you are a developer the code is all too often either the sole documentation or the most up to date documentation or the only worthwhile documentation.&lt;/p&gt;&lt;p&gt;For me it is no longer just a matter of necessity, admittedly over the years I feel I have developed pretty efficient code grokking skills, but ultimately it has become more of a way of life for me.  If I work with you or for that matter if you publish your code on the internet I will look at it.  If you claim, or are claimed by a third party, to be a good developer and I can look at your code to verify that claim I will do it in a heartbeat, if you have solved a problem that I am trying to solve or you potentially have a better solution or are using a technique that I am unfamiliar with, or are a better coder, I am all over your code.&lt;/p&gt;&lt;p&gt;The best developers are developers those who read code and those who read in general. The great thing about the industry today is there is no shortage of code to look at or general reading material.  As I have previously mentioned I currently work a fair amount with the Spring Framework, looking at the Spring Source code has helped me become a much better programmer and has exposed me to many new concepts.  Also reading the code allowed me to access many useful classes and functionality that are used internally by Spring but are not well documented.&lt;/p&gt;&lt;p&gt;I am frequently amazed (disappointed) by the lack of intellectual curiosity that many developers have for reading code.  I recall on one previous project we had to create some custom Servlet Filters, another developer had created the initial prototype and I refactored it, one thing I changed was I added Spring’s Ant pattern support for the configuration which was needed to exclude some paths, this feature was not well documented at the time and you had to read the code to figure out how to do it.  When the initial developer saw my changes he remarked with surprise that I figured out how to make it work like Spring Security.  I responded that all I had done was dug into the Spring source code to find out how they did it.  Perhaps my most irritating example of this is a project where we were in the process of making some refactoring changes which had a number of deprecated classes and in some cases entire packages of deprecated classes, and this one Cargo Cult Coder rolls in talking about how he was going to fix our architecture, of course he doesn’t bother to look at the existing code base and then he proceeds to add a class, which was also redundant, to a package where every other class was deprecated! Really!?! When a developer, especially a senior level developer works on a project with an existing code base it is their responsibility to learn the existing code base.&lt;/p&gt;&lt;p&gt;If you don’t read code you’re not a real developer! &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6918427997759942244-597451143496151439?l=www.elegantcoding.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/ElegantCoding/~4/Lnt-IvNroSQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/ElegantCoding/~3/Lnt-IvNroSQ/rtfc.html</link><author>noreply@blogger.com (Geoff Moes)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-UzSpy2opSzk/TfVt-g7ta_I/AAAAAAAAAFs/FLGvSmidv-w/s72-c/VFag1eaVdn7rmb1a5j45ZiFZo1_500.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.elegantcoding.com/2011/06/rtfc.html</feedburner:origLink></item></channel></rss>

