Supplementary materials for "Elegant Objects" book
Java C++ Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
vol-1 java sampe Feb 10, 2017 fixed from Janez Kuhar Aug 13, 2017
cactus.svg cactus Feb 17, 2017


This repository contains all code samples from Elegant Objects book, both vol.1 and vol.2.


8/13 e54ef498a (thanks to Janez Kuhar)

  • typo in Section 2.3: multiplicand replaced with factor
  • typo in Section 2.3: "objects of classes" instead of "classes"
  • Assembly code in Section 3.2.1 is fixed, it was not correct before
  • 32db197 reverted, we do need return there!

7/9 af90e7f01 (thanks to Mauricio Togneri)

  • new champion: android.view.View into Vol.2

7/2 7df68b002 (thanks to Christian Köstlin)

  • "a Factory Pattern" replaced with "the Factory Pattern"
  • "CRLF" renamed to "EOL" in Section 2.5
  • "synchronized(this.dollars)" replaced with "synchronized(this)" in Section 2.6.6

5/7 4c94462b3 (thanks to Krzysztof Szafrański)

  • Foot note about inevitable recursion in Fibo example

4/21 (thanks to John Page): multiple small typos

4/18/2017 v1.4 published (with Vol.2).

2/10 20cfbf9 (thanks to Andrey Valyaev)

  • The entire C++ example in Section 3.4 to the one you can find in this file.
  • Inaccurate C++ attribute definition fixed in Section 3.5.1: const std::string& print(); replaced with std::string print() const;.

2/8 9d84f5f (thanks to Andrey Valyaev):

  • Typo fixed in Section 2.5: "{ %s }" replaced with "{ %s }%s".
  • Typo fixed in Section 3.2.2: def events replaced with def evens.

1/31 6a57308 (thanks to Artem Gapchenko):

  • Object Oriented Software Construction by Bertrand Meyer was mentioned in a footnote, in Section 2.4.

1/7/2017 v1.3 published.

1/5 6f69b54 (thanks to Ilya Vassilevsky):

  • Semi-colon removed from Ruby code in Section 1.1.
  • Type in Section 1.3, Code replaced with Cash.

1/1 29f0ae9:

  • Java code in Section 2.6.6 was replaced with the code from this file.

12/25 8126324:

  • Right after the long Java script in Section 2.6.6 I added this text: "Of course, the script must shutdown() the svc at the end. I skipped that part for the sake of brevity."

12/14 32db197 (thanks to Andrey Valyaev):

  • Typo in Java script in Section 4.1, after print("Can't print; it's not a title.") goes return;.
  • Typo in Java script in Section 3.2.6: fee = 2.5 replaced with rate = 2.5 and fee = 3.0 replaced with rate = 3.0.
  • Typo in Java declaration of interface Exchange in Section 2.9: toUsd(String target) replaced with toUsd(String source) and return this.origin.rate("USD", target) replaced with return this.origin.rate(source, "USD").

9/12 9e3e7ff:

  • Typo in preface: thew replaced with threw.

8/20 v1.2 published.

8/3 71eeb7d:

  • A new footnote added to the paragraph talking about @RetryOnFailure Java annotation in Section 4.2.4 with a link to

7/15 13409df (thanks to Nicole Cordes):

  • Typo in Section 1.1: a extension replaced with an extension.
  • Class renamed in Section 1.3: IntegerAsString to StringAsInteger.

6/28 44420be:

  • C++ code fix in Section 4.4: Text t = new Text("/tmp/test.txt") replaced with Text t("/tmp/test.txt").

5/25 v1.1 published.

5/17 38f1ca8:

  • Broken section reference in Section 1.2 fixed.

4/20 9b245d0:

  • Spelling mistakes fixed and introduced automated spell checking.

2/22/2016 v1.0 published.