Tải bản đầy đủ (.pdf) (360 trang)

Metaprogramming in .NET pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (13.28 MB, 360 trang )

MANNING
Kevin Hazzard
Jason Bock
F
OREWORD

BY
Rockford Lhotka
in .NET
www.it-ebooks.info
Metaprogramming in .NET
www.it-ebooks.info

www.it-ebooks.info
Metaprogramming
in .NET
KEVIN HAZZARD
JASON BOCK
MANNING
SHELTER ISLAND
www.it-ebooks.info
For online information and ordering of this and other Manning books, please visit
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 261
Shelter Island, NY 11964
Email:
©2013 by Manning Publications Co. All rights reserved.


No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by means electronic, mechanical, photocopying, or otherwise, without prior written
permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial caps
or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy to have
the books we publish printed on acid-free paper, and we exert our best efforts to that end.
Recognizing also our responsibility to conserve the resources of our planet, Manning books
are printed on paper that is at least 15 percent recycled and processed without the use of
elemental chlorine.
Manning Publications Co. Development editor: Cynthia Kane
20 Baldwin Road Copyeditor: Corbin Collins
PO Box 261 Technical proofreader: Justin Chase
Shelter Island, NY 11964 Proofreader: Elizabeth Martin
Typesetter: Dennis Dalinnik
Cover designer: Marija Tudor
ISBN: 9781617290268
Printed in the United States of America
12345678910–MAL–18171615141312
www.it-ebooks.info
v
brief contents
PART 1DEMYSTIFYING METAPROGRAMMING 1
1

Metaprogramming concepts 3
2


Exploring code and metadata with reflection 41
P
ART 2TECHNIQUES FOR GENERATING CODE 63
3

The Text Template Transformation Toolkit (T4) 65
4

Generating code with the CodeDOM 101
5

Generating code with Reflection.Emit 139
6

Generating code with expressions 171
7

Generating code with IL rewriting 199
P
ART 3LANGUAGES AND TOOLS 221
8

The Dynamic Language Runtime 223
9

Languages and tools 267
10

Managing the .NET Compiler 287
www.it-ebooks.info

www.it-ebooks.info
vii
contents
foreword xiii
preface xv
acknowledgments xvii
about this book xix
about the cover illustration xxiii
PART 1DEMYSTIFYING METAPROGRAMMING 1
1
Metaprogramming concepts 3
1.1 Definitions of metaprogramming 6
1.2 Examples of metaprogramming 8
Metaprogramming via scripting 8

Metaprogramming
via reflection 11

Metaprogramming via code generation 14
Metaprogramming via dynamic objects 29
1.3 Summary 39
2
Exploring code and metadata with reflection 41
2.1 The need for reflection 42
Creating extensible applications 42

Manipulating code
members at runtime 42
www.it-ebooks.info
CONTENTS

viii
2.2 Reading metadata and executing code 43
Obtaining the starting point 44

Finding member
information 46

Gathering attribute data 47
Executing code 48
2.3 Impractical uses of reflection 49
Performance concerns with reflection 49
Brittleness and reflection 50
2.4 Practical uses of reflection 51
Automatically registering known types in WCF 52
Dynamic implementation of ToString 55
Invoking arbitrary methods on objects 58
Quick summary of reflection examples 61
2.5 Summary 62
PART 2TECHNIQUES FOR GENERATING CODE 63
3
The Text Template Transformation Toolkit (T4) 65
3.1 Thinking of generics as templates 66
3.2 Introducing T4 69
T4 syntax basics 71

Understanding T4’s block types 73
How T4 stitches together template blocks 74

T4’s expression
control block 75


A brief history of T4 75
3.3 More useful T4 examples 77
Templates should be beautiful 83
3.4 T4 fundamentals 84
Directives and text blocks 84

Control blocks 85
Handling indentation 88
3.5 Using T4 inside Visual Studio 93
How T4 uses the single file generator extension point 93
Creating a T4 template from Visual Studio 95

More on the
template directive 96

Using the output directive 97
Using T4 to generate Visual Basic dynamically 98
3.6 Summary 100
4
Generating code with the CodeDOM 101
4.1 Understanding the CodeDOM 102
CodeDOM organization and types 103

How statements and
expressions fit together 105
www.it-ebooks.info
CONTENTS
ix
4.2 The code provider classes 106

Code provider instantiation 106

Code generator supportable
options 110

Code provider services 112
4.3 Adding objects to a code graph 113
Creating a namespace with imports 113

Adding a class
to a namespace 115

Adding a constructor to a class 116
Adding statements to a member 117

Adding a property
to a class 120
4.4 Metaprogramming with the CodeDOM 121
Using branching logic 121

Referencing a member 124
Invoking methods 126

Compiling assemblies 133
Dynamic invocation 135
4.5 Summary 137
5
Generating code with Reflection.Emit 139
5.1 Why Emitter classes? 140
Support for DSLs 140


Moving reflection code into IL 141
Using .NET functionality not supported in your language 142
5.2 An overview of assembly internals 144
Transforming high-level languages 144

Member layouts in
assemblies and keywords 147
5.3 A lightning tour of opcodes 148
The mnemonic patterns for opcodes 148

Using local
variables 150

Accessing fields 151

Creating objects 152
Calling methods 152

Controlling code flow 153
Exception handling 154
5.4 Creating dynamic assemblies 155
Building a dynamic version of ToString() 155
Adding debugging support 160

Verifying results
with peverify 162

Using ILDasm to cheat 164
5.5 Lightweight code generation with dynamic methods 165

When creating an assembly is too much 165

Creating shim
methods 166

Using caching for performance 167
Disadvantages of DynamicMethod 168
5.6 Summary 170
6
Generating code with expressions 171
6.1 Expression-oriented programming 172
Understanding code as data 172

Expressions take
metaprogramming mainstream 174
www.it-ebooks.info
CONTENTS
x
6.2 Making dynamic methods with LINQ Expressions 176
Understanding LINQ Expressions 176

Generating expressions
at runtime 178

Comparison with dynamic methods 182
6.3 Using expressions effectively 184
Debugging expressions 184

Mutating expression trees 187
6.4 Evolving expression trees 189

The essence of genetic programming 189

Applying GAs
to expressions 191
6.5 Summary 198
7
Generating code with IL rewriting 199
7.1 The case for code injection 200
Repeated implementations of coding patterns 200
Code restructuring (Code Contracts) 201
7.2 Creating an injection framework 203
What’s Cecil? 203

Weaving code with Cecil 203
Creating an MSBuild task 210
7.3 Debugging injected code 212
Clearing up debugging confusion 212

Loading and saving
debug information 212

Issues with adding debugging
information 213

Adding debugging information
for injected code 214
7.4 Summary 218
PART 3LANGUAGES AND TOOLS 221
8
The Dynamic Language Runtime 223

8.1 The simplest dynamic classes 224
The ExpandoObject class 224

The DynamicObject class 227
Parsing the Open Data Protocol dynamically 231
8.2 The DLR hosting model 239
Runtimes, engines, and scopes 241

Adding a rules engine
to your application 252
8.3 Summary 264
www.it-ebooks.info
CONTENTS
xi
9
Languages and tools 267
9.1 A survey of languages 268
C# and expression limitations 268

Boo and
metaprogramming 269

Nemerle and metaprogrammg 275
9.2 A survey of tools 277
What is Spring.NET? 277

Intercepting property usage
with Spring.NET 278

What is PostSharp? 280

Intercepting object creation with PostSharp 280
Implementing Equals() and GetHashCode() 282
A quick dive into the internals of PostSharp 285
9.3 Summary 286
10
Managing the .NET Compiler 287
10.1 Opening up the compiler 288
The current state of affairs: a black box 288

Limitations for
metaprogramming 288

What Roslyn provides:
a white box 289

What’s in (and not in) the CTP 290
10.2 Understanding the basics of Roslyn 291
Running code snippets with the script engine 291
Creating dynamic assemblies with Roslyn 294

What is
a mock? 294

Generating the mock code 295

Compiling the
mock code 300

Understanding trees 302
10.3 Interacting with code in Visual Studio 303

Creating a IsOneWay warning 303

Defining the
Code Issue 303

Defining the OneWayOperation
code actions 306

Viewing the results 307
Autoarrange code 309

Specifying the algorithm
to reformat the code 309

Defining the core parts of the
refactoring project 310

Creating a code action 311
Viewing the results 314
10.4 Summary 315
appendix A Metaprogramming in Windows 8 316
appendix B Usage guide 319
index 321
www.it-ebooks.info
www.it-ebooks.info
xiii
foreword
When I think about metaprogramming I view it through three sets of experience: as a
computer scientist, a business developer, and a .
NET

framework author.
From a computer science perspective, it is clear that our industry has been largely
stagnant from a language perspective for an extremely long time. The slow evolution
of
3GL
s (third-generation languages) from C to C++ to Java to C# has resulted in
incremental improvements, but no major leaps in terms of developer productivity,
maintainability of code, reduction of complexity, or other meaningful metrics.
(I chose the C language progression in my example because it is perhaps the most
widely known. Comparable progressions exist for
BASIC
, Pascal, and many other lan-
guage families.)
Metaprogramming offers interesting possibilities around the creation of domain-
specific languages and other abstraction concepts that could eventually break us out
of the
3GL
world we’ve lived in for the past 20-30 years. Although this book doesn’t
focus on such a long-term goal, I think you can use Metaprogramming in .
NET
as a start-
ing point to gain valuable perspective on myriad core ideas that might inspire you to
think more about the future of our industry.
As someone who’s been a business developer for over 25 years, I’ve watched as
metaprogramming has become one of the most mainstream and important tools for
software development. Metaprogramming enables development time code generation
as well as software that can dynamically adapt its behaviors at runtime.
In the mid-1990s people mocked attempts by Microsoft and others to create “wiz-
ards” that generated code for various business application scenarios. Today, such code
www.it-ebooks.info

FOREWORD
xiv
generation tools are considered invaluable in environments as varied as Ruby on
Rails, Eclipse, and Visual Studio. Most business developers rely daily on massive
amounts of code generated by their tools during the development and build process.
Similarly, developers rely on runtime-generated code created by test mocking
frameworks, dynamic
UI
generation tools, rules engines, and more. Even more subtle
aspects of metaprogramming, such as the use of introspection (reflection) to create
data binding frameworks, are pervasive.
This book explores a number of the underlying technologies and techniques used
to implement code generation and dynamic applications during the development,
build, and runtime phases of an application’s lifecycle. Understanding these concepts
is important for effective use of existing tools, and critical for creating your own or
improving those that exist.
Finally, I am the author of the widely used
CSLA
.
NET
business objects framework.
Within my framework I make extensive use of many of the techniques discussed in this
book, including reflection, dynamic type loading, and expression trees.
A framework such as
CSLA
.
NET
couldn’t exist without these technologies, and
without the basic concepts of metaprogramming. Nor is
CSLA

.
NET
unique in this
regard. Many frameworks in the data layer, business layer, and presentation layer
make heavy use of metaprogramming techniques to provide broad and flexible sup-
port for object-relational mapping, business rules, validation rules, data binding, and
dynamic
UI
generation.
In my view, metaprogramming is extremely important because its core concepts
are used in popular development and testing frameworks and tools, as well as to
enable code generation tooling and dynamic application behaviors. It is also one of
the most promising areas of focus for the future of our industry as we look for ways to
improve maintainability and reduce the cost of software over its lifetime.
This book is an excellent way to get started down the road of understanding and
fully using the power of metaprogramming.
R
OCKFORD
L
HOTKA
CTO

AT
M
AGENIC
C
REATOR

OF


THE
CSLA .NET F
RAMEWORK
www.it-ebooks.info
xv
preface
In software development, metaprogramming is one of those words that sounds fancy
and sophisticated—and somewhat intimidating at the same time. But what does it
mean to be doing metaprogramming? The meta prefix can mean changed or higher. It
can also mean after or beside, depending on the context. All of those terms describe
the various forms of metaprogramming that we cover in this book.
You may choose to do metaprogramming in order to change code to support a
higher level of abstraction within your system or to inject some new behavior that suits
your particular needs. You may choose to do these things at compile time, between
compile time and deployment, or even at runtime. Because of the flexible nature of
the meta prefix, all of these scenarios qualify as metaprogramming.
No matter your reasons for doing metaprogramming, you must have a firm grip on
the larger architectural picture of your project to do it effectively. That’s why metapro-
gramming is sometimes considered a dark art, to be practiced only by senior develop-
ers and architects. Nothing could be further from the truth. Everyone can do some
form of metaprogramming. By manipulating code with other code the metaprogram-
ming way, you can suddenly tackle classes of coding problems that you were never able
to overcome before.
Your foray into metaprogramming may be to improve code reuse through sim-
ple templating or reflection. But soon you might also find yourself doing it to
reduce the complexity of your systems. For example, weaving the code that does
logging, performance monitoring, or transaction handling into a class library after
it’s been compiled can greatly increase developer comprehension by reducing code
www.it-ebooks.info
PREFACE

xvi
complexity. Hiding all of that plumbing with metaprogramming can benefit every-
one on the team.
We love metaprogramming. We want to create beautiful pieces of code that can
enable conventions in applications that make adding a new aspect easy. We want to be
able to optimize our code at runtime so it can perform faster. We want to analyze our
code so we can find issues before compilation. We want to shape whole bodies of tem-
plated code to schemas at runtime, perhaps even compiling them on the fly to get
excellent performance. Metaprogramming helps realize all these goals. We’d also like
for you to fall in love with metaprogramming so you can reach higher goals. That’s
really what we hope to instill in you with this book: a passion to view your code in a dif-
ferent, often more abstract way.
To be fair, it’s not as easy to do metaprogramming in .
NET
compared to other lan-
guages like Ruby. At least it seems that way when you first dive in. Dynamic languages
let you easily manipulate your code, and such concepts are exposed as first-class citi-
zens in languages like Python and Ruby. C# and Visual Basic .
NET
are usually not
touted as being dynamic or malleable. Surprisingly, though, there are a lot of ways to do
real metaprogramming in .
NET
. They may not be obvious or easy to carry out at first,
but they are there at almost every turn. Some metaprogramming features of .
NET
are
baked into the Common Language Runtime (
CLR
). Some exist as code in the Frame-

work Class Library (
FCL
). Still more metaprogramming capabilities show up as lan-
guage features in C# and Visual Basic .
NET
. Once you understand how some of these
features work, you’ll be well on your way to seeing problems in a whole new light.
Writing this book has been laborious, time-consuming, and frustrating, but above
everything else, a joy. As far as we’re concerned, this is the “fun stuff” in software
development. It’s also the “stuff” that can truly transform your code into something
amazing, as long as you’re willing to stretch your boundaries. So take a deep, cleans-
ing breath and dive in with us. You’ll find that the metaprogramming waters aren’t as
choppy as they may seem at first glance. We believe that in the end, you’ll be glad you
made the journey.
We also believe that once you’ve mastered a new concept or two, you’ll be ready to
convince your peers that the metaprogramming seas are smooth enough for anyone
to sail on them.
www.it-ebooks.info
xvii
acknowledgments
We’d like to thank Manning for taking a chance on us and letting us create a book
that didn’t follow the typical .
NET
technical paths. Specifically, we thank Cynthia
Kane, Michael Stephens, and Maureen Spencer for being patient with us during our
long wanderings through the material. It took far longer for us to finish than we origi-
nally thought, and we appreciate them for sticking with us—thank you very much! We
also thank our production team of Corbin Collins, Dennis Dalinnik, Elizabeth Martin,
Mary Piergies, and Janet Vail.
Special thanks to the following reviewers who spent the time perusing the text

and the code for mistakes, odd phrasings, and other quirks: Andrew Kirsch, Arun
Noronha, Bill Wagner, Bryce Darling, Danish Gite, Eddy Vluggen, Harry Cummings,
Jon Von Gillern, Matt Warren, Mick Wilson, Rama Krishna Vavilala, Rob Grainger,
Rupert Wood, Sander Rossel, Scobie Smith, Timo Bredenoort, Timothy Cluff, and
William Lee.
Finally, we’re grateful to Rockford Lhotka for contributing the foreword to our book
and to Justin Chase for his careful tech proofread of the manuscript during production.
KEVIN HAZZARD
I would like to thank

My wife Donna and our five lovely children, for giving up husband and dad for
the year that it took to produce this book. Donna, you will always be my lobster.

Jason, for teaching me a lot about authorship and many things about metapro-
gramming that I didn’t know when I began this work. Jason has patience
www.it-ebooks.info
ACKNOWLEDGMENTS
xviii
beyond all reckoning which I bent nearly to the breaking point more often
than I should have. You’re a real gem, Jason.
JASON BOCK
I would like to thank

Magenic, especially Greg Frankenfield and Paul Fridman, for creating and
growing a great place to work. I’ve been with Magenic for 11 years for many rea-
sons, one being that I find tremendous satisfaction in solving problems for our
clients. Some challenges are technical, others require “innovative thinking” to
come up with ways to move forward. And all of them educate me. With that
experience, I feel like I’ve grown far more than I ever have anywhere else. I’m
thankful that I’ve found a place where I feel like I fit in.


Kevin, for giving up his time to coauthor this book. Your knowledge and insight
have added so much to the material in this book, and I feel that your writing
style forced me to stop being so technical and focus on the story at hand.
Thanks for everything you’ve done in this book. Well done!

My wife Liz and my two sons Hayden and Ryan. I thought I’d never write
another book, but when this opportunity presented itself, I had to do it, even
though I knew it would cut into family time. I truly appreciate my amazing fam-
ily and feel so fortunate that they’ve been supportive of me when “Dad’s writing
his book on his laptop…again!” To each of them: I love you very much.
www.it-ebooks.info
xix
about this book
Metaprogramming in .
NET
requires you to move beyond the canonical material of inter-
faces, virtual methods, and events to more advanced and probably unknown concepts
like reflection, assembly rewriting, expressions, and code analysis. If you’ve never
encountered these
API
s or techniques, it may feel a little daunting to even approach
the first chapter!
We don’t “pontificate on the profound”—that is, although you’ll be exposed to
new ideas, you won’t read about every extreme, esoteric corner of metaprogramming.
Rather, you’ll be guided into these realms with an understanding of why you need to
learn about these techniques. At the end of the day, we want you to not only gain an
appreciation of how powerful metaprogramming is, but how to use this material in
your day-to-day coding experiences.
Throughout this book, you’ll learn about different techniques and frameworks.

They all have their strengths and weaknesses. Some work well in some areas of an
application, and others shine somewhere else. You’ll understand when it’s best to use
one tool, and what the trade-offs are in using a particular approach.
Roadmap

Chapter 1 provides a broad introduction into the world of metaprogram-
ming. We provide high-level examples to explain just what metaprogramming is
all about.

Chapter 2 moves into the world of reflection, describing how to query code,
find out what it contains, and manipulate it.
www.it-ebooks.info
ABOUT THIS BOOK
xx

Chapter 3 discusses code generation with
T4
. You’ll discover how the template
engine works and where it makes sense to use code generation in an application.

Chapter 4 covers the Code
DOM
and why it’s still an applicable
API
to use in cer-
tain development scenarios.

Chapter 5 dives into the Reflection.Emit
API
. You’ll learn about the inner work-

ings of an assembly and how to dynamically create code at runtime with this
API
.

Chapter 6 is all about expressions, specifically
LINQ
expressions. You’ll see how
to create small snippets of code and change their behavior at runtime.

Chapter 7 takes the Emitter
API
one more step and shows how to rewrite assem-
blies, providing a path where you can inject reusable bits of code to enhance
compiled code.

Chapter 8 covers the Dynamic Language Runtime, or
DLR
. You’ll learn all
about binding, dynamic objects, and other things the
DLR
provides.

Chapter 9 looks at other tools and frameworks, as well as other languages that
make it easier to use metaprogramming within .
NET
.

Chapter 10 rounds out the book with a look into the future with Project Roslyn,
a compiler
API

from Microsoft that will provide a view into your code like you’ve
never had from them before.

There are two appendixes. Appendix A is an overview of Windows 8 and how
metaprogramming in .
NET
works in Windows Store applications. Appendix B is
a usage guide summary of the techniques presented in chapters 2–10.
Who should read this book?
If you’re a .
NET
developer who wants not only to learn more than just how to “do”
dependency injection and “use” controllers, but also to create frameworks that pro-
vide useful services to other developers, then this book is for you. Many popular .
NET
frameworks that make hard problems simple usually end up using one or more of the
techniques presented in this book, but they structure their work in such a way that
you probably don’t see it (which is usually a good thing). If you want to create these
components, you’ll need to know how these techniques work, and this book provides
that guidance.
We assume that you’re familiar with the base competencies that a .
NET
developer
would have. For example, we expect that you know what a class is, the difference
between a virtual and a non-virtual method, and what sealed means in C#.
Code conventions and downloads
This book contains numerous code examples. All the code is in a
fixed-width

font

like

this
to separate it from ordinary text. Code members such as method names,
class names, and so on are also in a fixed-width font.
Source code examples in this book are fairly close to the samples that you’ll find
online. But for brevity’s sake, we may have removed material such as comments from
the code to fit it well within the text.
www.it-ebooks.info
ABOUT THIS BOOK
xxi
Annotations accompany many of the source code listings, highlighting important
concepts. In some cases, numbered bullets link to explanations that follow the listing.
The source code for the examples in the book is available for download from the
publisher’s website at www.manning.com/Metaprogrammingin.Net. It is also available
from .
To run the samples, you’ll need to download some of the tools and languages we use
in this book. We provide links in the text to places where you can get the relevant files.
Author Online
The purchase of Metaprogramming in .
NET
includes free access to a private web forum
run by Manning Publications, where you can make comments about the book, ask
technical questions, and receive help from the authors and from other users. To
access the forum and subscribe to it, point your web browser at www.manning.com/
Metaprogrammingin.
NET
. This page provides information on how to get on the
forum once you are registered, what kind of help is available, and the rules of conduct
on the forum.

Manning’s commitment to our readers is to provide a venue where a meaningful
dialogue between individual readers and between readers and authors can take place.
It’s not a commitment to any specific amount of participation on the part of the
authors, whose contributions to the forum remain voluntary (and unpaid). We sug-
gest you try asking the authors some challenging questions, lest their interest stray!
The Author Online forum and archives of previous discussions will be accessible
from the publisher’s web site as long as the book is in print.
About the authors
KEVIN HAZZARD
is a director for CapTech Consulting, a management consulting and
software development firm of 375 consultants based in Richmond, Va., with offices in
Philadelphia, Charlotte, and Washington,
D.C
. Kevin was a Microsoft C#
MVP
for years
until moving into the Windows Azure
MVP
group. Although his head is in the clouds
these days, Kevin still considers himself to be a languages guy, focusing most of his
attention on functional and dynamic languages like F# and Python.
Kevin has served as a leader for the Richmond Code Camp (http://richmondcode-
camp.org), the Richmond .
NET
User Group, the Richmond
SQL
Server User Group,
the Richmond Software Craftsmanship Group, and the Mid-Atlantic Developer Expo
(). He also speaks regularly at conferences around the Midwest
and Mid-Atlantic states, directing most of his attention these days to teaching pro-

gramming and robotics to children.
Kevin taught computer programming language courses in the Virginia Commu-
nity College system for more than a decade, but gave that up in 2011 to run for office
and become elected to his county’s K-12 School Board. You can follow Kevin at http://
twitter.com/KevinHazzard or befriend him at to stay
in touch.
www.it-ebooks.info
ABOUT THIS BOOK
xxii
JASON BOCK
is a principal lead consultant for Magenic (www.magenic.com) and a
Microsoft C#
MVP
. He’s worked on a number of business applications using a diverse
set of substrates and languages, such as C#, .
NET
, and Java. He’s the also the author of
Applied .
NET
Attributes (Apress, 2003),
CIL
Programming: Under the Hood of .
NET
(Apress,
2002), and Visual Basic 6 Win32
API
Tutorial (Wrox, 1998). He’s written numerous arti-
cles on software development, has presented at a number of conferences and user
groups, and is a leader of the Twin Cities Code Camp (www.twincitiescodecamp.com).
Jason holds a master’s degree in electrical engineering from Marquette University.

Visit his website at www.jasonbock.net.
www.it-ebooks.info
xxiii
about the cover illustration
The figure on the cover of Metaprogramming in .
NET
is captioned a “Man from Japo-
des.” The Japodes, also called Lapydes or Giapidi, were an ancient people who dwelt
north of and inland from Liburnia, a region on the northeastern Adriatic coast in
what is now Croatia. This illustration is taken from a recent reprint of Balthasar
Hacquet’s Images and Descriptions of Southwestern and Eastern Wenda, Illyrians, and Slavs
published by the Ethnographic Museum in Split, Croatia, in 2008. Hacquet (1739–
1815) was an Austrian physician and scientist who spent many years studying the bot-
any, geology, and ethnography of many parts of the Austrian Empire, as well as the
Veneto, the Julian Alps, and the western Balkans, inhabited in the past by peoples of
many different tribes and nationalities. Hand-drawn illustrations accompany the many
scientific papers and books that Hacquet published.
The rich diversity of the drawings in Hacquet’s publications speaks vividly of the
uniqueness and individuality of Alpine and Balkan regions just 200 years ago. This was
a time when the dress codes of two villages separated by a few miles identified people
uniquely as belonging to one or the other, and when members of an ethnic tribe,
social class, or trade could be easily distinguished by what they were wearing. Dress
codes have changed since then and the diversity by region, so rich at the time, has
faded away. It is now often hard to tell the inhabitants of one continent from another
and the residents of the picturesque towns and villages on the Adriatic coast are not
readily distinguishable from people who live in other parts of the world.
We at Manning celebrate the inventiveness, the initiative, and the fun of the com-
puter business with book covers based on costumes from two centuries ago brought
back to life by illustrations such as this one.
www.it-ebooks.info


www.it-ebooks.info

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×