Chapter 4
Façade
Summary prepared by Kirk Scott
1
Emmer
From Wikipedia, the free encyclopedia
• Emmer wheat (Triticum dicoccum), also
known as farro especially in Italy, or hulled
wheat,[1] is a type of awned wheat. It was one
of the first crops domesticated in the Near
East. It was widely cultivated in the ancient
world, but is now a relict crop in mountainous
regions of Europe and Asia.
2
3
Spelt
From Wikipedia, the free encyclopedia
• This article is about the wheat species.
• For the alternative version of the word "spelled", see
Spelling.Spelt, also known as dinkel wheat,[2] or hulled
wheat,[2] is a hexaploid species of wheat. Spelt was an
important staple in parts of Europe from the Bronze
Age to medieval times; it now survives as a relict crop
in Central Europe and northern Spain and has found a
new market as a health food. Spelt is sometimes
considered a subspecies of the closely related species
common wheat (T. aestivum), in which case its
botanical name is considered to be Triticum aestivum
subsp. spelta.
4
5
Einkorn wheat
From Wikipedia, the free encyclopedia
(Redirected from Einkorn)
• Einkorn wheat (from German Einkorn, literally
"single grain") can refer either to the wild species
of wheat, Triticum boeoticum , or to the
domesticated form, Triticum monococcum. The
wild and domesticated forms are either
considered separate species, as here, or as
subspecies of T. monococcum. Einkorn is a diploid
species of hulled wheat, with tough glumes
('husks') that tightly enclose the grains. The
cultivated form is similar to the wild, except that
the ear stays intact when ripe and the seeds are
larger.
6
• Einkorn wheat was one of the earliest cultivated forms of wheat,
alongside emmer wheat (T. dicoccum). Grains of wild einkorn have
been found in Epi-Paleolithic sites of the Fertile Crescent. It was first
domesticated approximately 7500 BC (7050 BC ≈ 9000 BP), in the
Pre-Pottery Neolithic A (PPNA) or B (PPNB) periods.[1] Evidence
from DNA finger-printing suggests einkorn was domesticated near
Karaca Dağ in southeast Turkey, an area in which a number of PPNB
farming villages have been found.[2] Its cultivation decreased in the
Bronze Age, and today it is a relict crop that is rarely planted,
though it has found a new market as a health food. It remains as a
local crop, often for bulgur (cracked wheat) or as animal feed, in
mountainous areas of France, Morocco, the former Yugoslavia,
Turkey and other countries. It often survives on poor soils where
other species of wheat fail.[3]
7
8
Design Patterns in Java
Chapter 4
Façade
Summary prepared by Kirk Scott
9
Façade
• The book starts with a review of some of the
benefits of object-oriented code development
• The idea is that families/hierarchies of classes
are developed which are known as toolkits
• Then application programs can be written
which make use of the functionality
implemented in the toolkits
10
• In the broadest sense, you might think of the
Java API as a toolkit
• This would be an example of a toolkit that has
too much in it to fully understand
• How do you know what features to use or
where to start when trying to use it to
implement an application?
11
• The façade design pattern is an approach to
managing the complexity of a toolkit
• The book describes a façade as a “small
amount” of code which provides a typical, nofrills usage of the classes in a class library
• It expands this description by saying that a
façade is a class with a level of functionality
between a toolkit and an application
12
• This class offers simplified usage of the classes
in a package or subsystem (the toolkit)
• It can do this by providing an interface with
fewer methods
• It can also do this by providing an interface
containing methods with fewer parameters
• In short, a façade is a class that provides a
smaller or simplified interface to an
underlying class or set of classes
13
Book Definition of the Design Pattern
• Book definition:
• The intent of the Façade pattern is to provide
an interface that makes a subsystem easy to
use
14
• The book takes two approaches to illustrating
what a façade is
• The first approach is to point out a class in the
Java API which it says meets the definition of a
façade
• Because the class they choose is a Java swing
class, this is not part of this course
15
• The second approach is to give a concrete
example of a design, including code, and refactor
it to reflect the façade pattern
• The refactoring involves adding new classes to
the design and dividing methods among them.
• A basic design question is always, what are the
classes and what functionality do they contain?
• You may get this right in an initial design or you
may have to rethink it on a redesign
16
• The façade pattern can be used as a model for
abstracting out certain functionalities into one
class, the façade
• The remaining functionalities are then
reorganized in a set of classes that is more
logical or convenient
17
• This second example in the book is also
heavily dependent on Java swing
• This set of overheads will simply go over the
terminology and description of what a façade
is (and what it isn’t)
• No specific example will be given (and the
assignment may not include a problem where
you have to implement a façade)
18
What’s a Utility?
• If a class fits the intent of the Façade design
pattern and consists entirely of static
methods, then it is called a utility
• In other words, a utility is a class that provides
a smaller or simplified interface to another
class or set of classes
• But all of the methods are static
• A utility can be a handy construct
19
• Incidentally, keep this in mind regarding a utility
and its methods:
• It is not possible to override a static method
• Therefore, with a utility, it’s not possible to
provide more refined or specific versions of the
static methods of the utility in subclasses of the
utility
• This may not be of great practical consequence—
but it may be worthwhile to consider aspects of
inheritance and static classes (possibly for the
first time)
20
So, Facades Could Have Subclasses…
• Facades don’t have to consist entirely of static
methods
• If you develop a façade, in theory it would be
possible to give it subclasses
• In a subclass you could override methods as
necessary
• Again, this may just be worth considering in
passing
• But it’s not necessary to consider this in detail in
order to understand the Facade design pattern
21
What is a Demo?
• A demo is an example that shows how to use
a class or subsystem
• Demos provide much of the same information
or value to the programmer as a façade, but
they are not exactly the same thing
• The book lists several ways in which they differ
22
• “A demo is usually a stand-alone application; a
façade is usually not.
• A demo usually includes sample data; a façade
does not.
• A façade is usually configurable; a demo is not
• A façade is intended for reuse; a demo is not
• A façade is intended for use in production; a
demo is not”
23
The Presence or Absence of Facades,
Utilities, or Demos in a Given API
• In general, when using the Java, or Android, or
some other API, you may recognize a class
which has the characteristics of a façade
• You may also recognize a utility
• Or you may recognize a demo in the online
tutorials, for example
24
An Example of a Façade in the Java API
• The book gives the JOptionPane class from the
Java API as an example of a façade
• This is in the javax.swing package
• You can take a look at the authors’ commentary
when reading the book, but this won’t be
presented here because the world is moving
beyond swing
• The example segues into a discussion of the
presence or absence of façade classes in the Java
API
25
• Challenge 4.3
• “Few facades appear in the Java class libraries.
Why is that?”
26
• Solution 4.3:
• “Here are a few reasonable but opposing
views regarding the paucity of facades in the
Java class libraries.
• [given on the following overheads]
27
• [1] As a Java developer, you are well advised
to develop a thorough knowledge of the tools
in the library.
• Facades necessarily limit the way you might
apply any system.
• They would be a distracting and potentially
misleading element of the class libraries in
which they might appear.
28
• [2] A façade lies somewhere between the
richness of a toolkit and the specificity of a
particular application.
• To create a façade requires some notion of the
type of applications it will support.
• This predictability is impossible given the huge
and diverse audience of the Java class
libraries.
29
• [3] The scarcity of facades in the class libraries
is a weakness.
• Adding more facades would be a big help.”
30
Considering the UML for the Pattern
Again
• The discussion of the façade design pattern
will conclude with a comparison of its UML
diagram with the UML diagram of the
preceding pattern, the mediator
• Literally, the mediator is the class “in
between”
• Literally, the façade is the class “in front of”
31
• In practice, both a mediator and a façade will
be in between two other classes in a UML
diagram
• What’s the difference?
• The following overhead shows a possible
diagram for each pattern:
32
33
• The mediator stands between two base classes
• The base classes are “partners” in some sort of
relationship
• You read the mediator UML diagram as follows:
• The mediator has references to instances of the
base classes
• The mediator manages the relationships between
the base class objects that it has references to
34
• In contrast, the diagram for the façade uses
dashed arrows
• These signify “makes use of”
• For the façade, the arrows, the references form a
path in one direction
• A client class makes use of the façade
• The façade makes use of the underlying toolkit
• The end result is that the client makes (simplified)
use of the toolkit
35
• Thus, both a mediator and a façade class
stand between other classes
• However, the kinds of classes they stand
between play different roles
• And therefore, the roles the mediator and
façade play for the classes they stand between
are also different
36
The End
37
© Copyright 2026 Paperzz