Download Full Architect Modern Web Applications with ASP NET Core and Azure Steve "Ardalis" Smith PDF All Chapters
Download Full Architect Modern Web Applications with ASP NET Core and Azure Steve "Ardalis" Smith PDF All Chapters
com
https://ebookmeta.com/product/architect-modern-web-
applications-with-asp-net-core-and-azure-steve-ardalis-
smith/
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/architect-modern-web-applications-with-
asp-net-core-and-azure-steve-ardalis-smith-2/
ebookmeta.com
https://ebookmeta.com/product/i-m-buffy-and-you-re-history-buffy-the-
vampire-slayer-and-contemporary-feminism-patricia-pender/
ebookmeta.com
Certified OpenStack Administrator Study Guide Get
Everything You Need for the COA Exam Certification Study
Companion Series 2nd Edition Andrey Markelov
https://ebookmeta.com/product/certified-openstack-administrator-study-
guide-get-everything-you-need-for-the-coa-exam-certification-study-
companion-series-2nd-edition-andrey-markelov/
ebookmeta.com
https://ebookmeta.com/product/post-conflict-monuments-in-bosnia-and-
herzegovina-unfinished-histories-1st-edition-uros-cvoro/
ebookmeta.com
https://ebookmeta.com/product/clinical-neuroanatomy-lange-29th-
edition-stephen-waxman/
ebookmeta.com
https://ebookmeta.com/product/abnormal-psychology-6th-canadian-
edition-gordon-l-flett/
ebookmeta.com
Doing Critical Social Work Transformative Practices for
Social Justice 1st Edition Bob Pease Editor Sophie
Goldingay Editor Norah Hosken Editor Sharlene Nipperess
Editor
https://ebookmeta.com/product/doing-critical-social-work-
transformative-practices-for-social-justice-1st-edition-bob-pease-
editor-sophie-goldingay-editor-norah-hosken-editor-sharlene-nipperess-
editor/
ebookmeta.com
EDITION v5.0.1 - Updated to ASP.NET Core 5.0
PUBLISHED BY
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any
form or by any means without the written permission of the publisher.
This book is provided “as-is” and expresses the author’s views and opinions. The views, opinions, and
information expressed in this book, including URL and other Internet website references, may change
without notice.
Some examples depicted herein are provided for illustration only and are fictitious. No real association
or connection is intended or should be inferred.
Microsoft and the trademarks listed at https://www.microsoft.com on the “Trademarks” webpage are
trademarks of the Microsoft group of companies.
The Docker whale logo is a registered trademark of Docker, Inc. Used by permission.
All other marks and logos are property of their respective owners.
Author:
Editors:
Maira Wenzel
Action links
• This e-book is also available in a PDF format (English version only) Download
Introduction
.NET 5 and ASP.NET Core offer several advantages over traditional .NET development. You should use
.NET 5 for your server applications if some or all of the following are important to your application’s
success:
• Cross-platform support.
• Use of microservices.
Traditional .NET applications can and do support many of these requirements, but ASP.NET Core and
.NET 5 have been optimized to offer improved support for the above scenarios.
More and more organizations are choosing to host their web applications in the cloud using services
like Microsoft Azure. You should consider hosting your application in the cloud if the following are
important to your application or organization:
• Reduced investment in data center costs (hardware, software, space, utilities, server
management, etc.)
• Extreme reliability.
• Improved app mobility; easily change where and how your app is deployed.
Building web applications with ASP.NET Core, hosted in Azure, offers many competitive advantages
over traditional alternatives. ASP.NET Core is optimized for modern web application development
practices and cloud hosting scenarios. In this guide, you’ll learn how to architect your ASP.NET Core
applications to best take advantage of these capabilities.
Version
This guide has been revised to cover .NET 5.0 version along with many additional updates related to
the same “wave” of technologies (that is, Azure and additional third-party technologies) coinciding in
time with the .NET 5.0 release. That’s why the book version has also been updated to version 5.0.
Purpose
This guide provides end-to-end guidance on building monolithic web applications using ASP.NET
Core and Azure. In this context, “monolithic” refers to the fact that these applications are deployed as
a single unit, not as a collection of interacting services and applications.
This guide is complementary to “.NET Microservices. Architecture for Containerized .NET Applications”,
which focuses more on Docker, microservices, and deployment of containers to host enterprise
applications.
A secondary audience is technical decision makers who are already familiar ASP.NET or Azure and are
looking for information on whether it makes sense to upgrade to ASP.NET Core for new or existing
projects.
Feel free to forward this guide to your team to help ensure a common understanding of these
considerations and opportunities. Having everybody working from a common set of terminology and
underlying principles helps ensure consistent application of architectural patterns and practices.
References
• Choosing between .NET 5 and .NET Framework for server apps
https://docs.microsoft.com/dotnet/standard/choosing-core-framework-server
Contents
Characteristics of Modern Web Applications ....................................................................... 1
Reference application: eShopOnWeb .............................................................................................................................. 1
Blazor ............................................................................................................................................................................................ 4
Choose Between Traditional Web Apps and Single Page Apps (SPAs) ............................. 6
Blazor ............................................................................................................................................................................................ 7
Architectural principles......................................................................................................... 10
Common design principles ............................................................................................................................................... 10
Encapsulation ..................................................................................................................................................................... 10
i Contents
Bounded contexts ............................................................................................................................................................ 14
CSS .............................................................................................................................................................................................. 33
JavaScript ................................................................................................................................................................................. 35
Angular SPAs...................................................................................................................................................................... 36
React ...................................................................................................................................................................................... 37
Vue ......................................................................................................................................................................................... 37
ii Contents
Mapping requests to responses ..................................................................................................................................... 41
Security ..................................................................................................................................................................................... 53
Identity ................................................................................................................................................................................. 53
Authentication ................................................................................................................................................................... 55
Authorization ..................................................................................................................................................................... 57
Deployment............................................................................................................................................................................. 62
iii Contents
References – Entity Framework Core ........................................................................................................................ 71
Caching ..................................................................................................................................................................................... 75
Integration tests................................................................................................................................................................ 80
References ............................................................................................................................................................................... 95
iv Contents
Web applications .................................................................................................................................................................. 96
v Contents
CHAPTER 1
Characteristics of Modern
Web Applications
“… with proper design, the features come cheaply. This approach is arduous, but continues to
succeed.”
- Dennis Ritchie
Modern web applications have higher user expectations and greater demands than ever before.
Today’s web apps are expected to be available 24/7 from anywhere in the world, and usable from
virtually any device or screen size. Web applications must be secure, flexible, and scalable to meet
spikes in demand. Increasingly, complex scenarios should be handled by rich user experiences built on
the client using JavaScript, and communicating efficiently through web APIs.
ASP.NET Core is optimized for modern web applications and cloud-based hosting scenarios. Its
modular design enables applications to depend on only those features they actually use, improving
application security and performance while reducing hosting resource requirements.
Reference Application
• eShopOnWeb
https://github.com/dotnet/eShopOnWeb
Cross platform
ASP.NET Core is cross-platform and can run on Linux, macOS, and Windows. This capability opens up
many new options for both the development and deployment of apps built with ASP.NET Core.
ASP.NET Core also fully supports dependency injection, both internally and at the application level.
Interfaces can have multiple implementations that can be swapped out as needed. Dependency
injection allows apps to loosely couple to those interfaces, rather than specific implementations,
making them easier to extend, maintain, and test.
Single Page Applications (SPAs), by contrast, involve very few dynamically generated server-side page
loads (if any). Many SPAs are initialized within a static HTML file that loads the necessary JavaScript
libraries to start and run the app. These apps make heavy usage of web APIs for their data needs and
can provide much richer user experiences.
Blazor
Blazor is included with ASP.NET Core 3.0 and later. It provides a new mechanism for building rich
interactive web client applications using Razor, C#, and ASP.NET Core. It offers another solution to
consider when developing modern web applications. There are two versions of Blazor to consider:
server-side and client-side.
Server-side Blazor was released in 2019 with ASP.NET Core 3.0. As its name implies, it runs on the
server, rendering changes to the client document back to the browser over the network. Server-side
Blazor provides a rich client experience without requiring client-side JavaScript and without requiring
separate page loads for each client page interaction. Changes in the loaded page are requested from
and processed by the server and then sent back to the client using SignalR.
Client-side Blazor released in May 2020 eliminates the need to render changes on the server. Instead,
it leverages WebAssembly to run .NET code within the client. The client can still make API calls to the
server if needed to request data, but all client-side behavior runs in the client via WebAssembly, which
is already supported by all major browsers and is just a JavaScript library.
There are two general approaches to building web applications today: traditional web applications
that perform most of the application logic on the server, and single-page applications (SPAs) that
perform most of the user interface logic in a web browser, communicating with the web server
primarily using web APIs. A hybrid approach is also possible, the simplest being host one or more rich
SPA-like subapplications within a larger traditional web application.
• Your application must expose a rich user interface with many features.
• Your application must already expose an API for other (internal or public) clients.
Additionally, SPA frameworks require greater architectural and security expertise. They experience
greater churn due to frequent updates and new frameworks than traditional web applications.
Configuring automated build and deployment processes and utilizing deployment options like
containers may be more difficult with SPA applications than traditional web apps.
Improvements in user experience made possible by the SPA approach must be weighed against these
considerations.
6 CHAPTER 2 | Choose Between Traditional Web Apps and Single Page Apps (SPAs)
Blazor
ASP.NET Core includes a model for building rich, interactive, and composable user interfaces called
Blazor. Blazor server-side allows developers to build UI with C# and Razor on the server and for the UI
to be interactively connected to the browser in real-time using a persistent SignalR connection. Blazor
WebAssembly introduces another option for Blazor apps, allowing them to run in the browser using
WebAssembly. Because it’s real .NET running on WebAssembly, you can reuse code and libraries from
server-side parts of your application.
Blazor provides a new, third option to consider when evaluating whether to build a purely server-
rendered web application or a SPA. You can build rich, SPA-like client-side behaviors using Blazor,
without the need for significant JavaScript development. Blazor applications can call APIs to request
data or perform server-side operations. They can interoperate with JavaScript where necessary to take
advantage of JavaScript libraries and frameworks.
• Your team is more comfortable with .NET development than JavaScript or TypeScript
development
If you have an existing web forms application you’re considering migrating to .NET Core or the latest
.NET, you may wish to review the free e-book, Blazor for Web Forms Developers to see whether it
makes sense to consider migrating it to Blazor.
For more information about Blazor, see Get started with Blazor.
Many web applications are primarily consumed in a read-only fashion by the vast majority of their
users. Read-only (or read-mostly) applications tend to be much simpler than those applications that
maintain and manipulate a great deal of state. For example, a search engine might consist of a single
entry point with a textbox and a second page for displaying search results. Anonymous users can
easily make requests, and there is little need for client-side logic. Likewise, a blog or content
management system’s public-facing application usually consists mainly of content with little client-
side behavior. Such applications are easily built as traditional server-based web applications, which
perform logic on the web server and render HTML to be displayed in the browser. The fact that each
unique page of the site has its own URL that can be bookmarked and indexed by search engines (by
default, without having to add this functionality as a separate feature of the application) is also a clear
benefit in such scenarios.
7 CHAPTER 2 | Choose Between Traditional Web Apps and Single Page Apps (SPAs)
Web applications that need to function in browsers with limited or no JavaScript support should be
written using traditional web app workflows (or at least be able to fall back to such behavior). SPAs
require client-side JavaScript in order to function; if it’s not available, SPAs are not a good choice.
If your team is unfamiliar with JavaScript or TypeScript, but is familiar with server-side web application
development, then they will probably be able to deliver a traditional web app more quickly than a
SPA. Unless learning to program SPAs is a goal, or the user experience afforded by a SPA is required,
traditional web apps are a more productive choice for teams who are already familiar with building
them.
Your application must expose a rich user interface with many features
SPAs can support rich client-side functionality that doesn’t require reloading the page as users take
actions or navigate between areas of the app. SPAs can load more quickly, fetching data in the
background, and individual user actions are more responsive since full page reloads are rare. SPAs can
support incremental updates, saving partially completed forms or documents without the user having
to click a button to submit a form. SPAs can support rich client-side behaviors, such as drag-and-drop,
much more readily than traditional applications. SPAs can be designed to run in a disconnected mode,
making updates to a client-side model that are eventually synchronized back to the server once a
connection is re-established. Choose a SPA-style application if your app’s requirements include rich
functionality that goes beyond what typical HTML forms offer.
Frequently, SPAs need to implement features that are built into traditional web apps, such as
displaying a meaningful URL in the address bar reflecting the current operation (and allowing users to
bookmark or deep link to this URL to return to it). SPAs also should allow users to use the browser’s
back and forward buttons with results that won’t surprise them.
Writing SPAs requires familiarity with JavaScript and/or TypeScript and client-side programming
techniques and libraries. Your team should be competent in writing modern JavaScript using a SPA
framework like Angular.
8 CHAPTER 2 | Choose Between Traditional Web Apps and Single Page Apps (SPAs)
If you’re already supporting a web API for use by other clients, it may require less effort to create a
SPA implementation that leverages these APIs rather than reproducing the logic in server-side form.
SPAs make extensive use of web APIs to query and update data as users interact with the application.
Like JavaScript-based SPAs, Blazor applications can support rich client behavior without page reloads.
These applications are more responsive to users, fetching only the data (or HTML) required to respond
to a given user interaction. Designed properly, server-side Blazor apps can be configured to run as
client-side Blazor apps with minimal changes once this feature is supported.
Your team is more comfortable with .NET development than JavaScript or TypeScript
development
Many developers are more productive with .NET and Razor than with client-side languages like
JavaScript or TypeScript. Since the server-side of the application is already being developed with .NET,
using Blazor ensures every .NET developer on the team can understand and potentially build the
behavior of the front end of the application.
Decision table
The following decision table summarizes some of the basic factors to consider when choosing
between a traditional web application, a SPA, or a Blazor app.
9 CHAPTER 2 | Choose Between Traditional Web Apps and Single Page Apps (SPAs)
CHAPTER 3
Architectural principles
“If builders built buildings the way programmers wrote programs, then the first woodpecker that
came along would destroy civilization.”
- Gerald Weinberg
You should architect and design software solutions with maintainability in mind. The principles
outlined in this section can help guide you toward architectural decisions that will result in clean,
maintainable applications. Generally, these principles will guide you toward building applications out
of discrete components that are not tightly coupled to other parts of your application, but rather
communicate through explicit interfaces or messaging systems.
Architecturally, applications can be logically built to follow this principle by separating core business
behavior from infrastructure and user-interface logic. Ideally, business rules and logic should reside in
a separate project, which should not depend on other projects in the application. This separation
helps ensure that the business model is easy to test and can evolve without being tightly coupled to
low-level implementation details. Separation of concerns is a key consideration behind the use of
layers in application architectures.
Encapsulation
Different parts of an application should use encapsulation to insulate them from other parts of the
application. Application components and layers should be able to adjust their internal implementation
without breaking their collaborators as long as external contracts are not violated. Proper use of
encapsulation helps achieve loose coupling and modularity in application designs, since objects and
packages can be replaced with alternative implementations so long as the same interface is
maintained.
Dependency inversion
The direction of dependency within the application should be in the direction of abstraction, not
implementation details. Most applications are written such that compile-time dependency flows in the
direction of runtime execution, producing a direct dependency graph. That is, if class A calls a method
of class B and class B calls a method of class C, then at compile time class A will depend on class B,
and class B will depend on class C, as shown in Figure 4-1.
Dependency inversion is a key part of building loosely coupled applications, since implementation
details can be written to depend on and implement higher-level abstractions, rather than the other
way around. The resulting applications are more testable, modular, and maintainable as a result. The
practice of dependency injection is made possible by following the dependency inversion principle.
Explicit dependencies
Methods and classes should explicitly require any collaborating objects they need in order to
function correctly. Class constructors provide an opportunity for classes to identify the things they
need in order to be in a valid state and to function properly. If you define classes that can be
constructed and called, but that will only function properly if certain global or infrastructure
components are in place, these classes are being dishonest with their clients. The constructor contract
is telling the client that it only needs the things specified (possibly nothing if the class is just using a
parameterless constructor), but then at runtime it turns out the object really did need something else.
By following the explicit dependencies principle, your classes and methods are being honest with their
clients about what they need in order to function. Following the principle makes your code more self-
documenting and your coding contracts more user-friendly, since users will come to trust that as long
as they provide what’s required in the form of method or constructor parameters, the objects they’re
working with will behave correctly at run time.
In a monolithic application, we can apply the single responsibility principle at a high level to the layers
in the application. Presentation responsibility should remain in the UI project, while data access
responsibility should be kept within an infrastructure project. Business logic should be kept in the
application core project, where it can be easily tested and can evolve independently from other
responsibilities.
When this principle is applied to application architecture and taken to its logical endpoint, you get
microservices. A given microservice should have a single responsibility. If you need to extend the
behavior of a system, it’s usually better to do it by adding additional microservices, rather than by
adding responsibility to an existing one.
Rather than duplicating logic, encapsulate it in a programming construct. Make this construct the
single authority over this behavior, and have any other part of the application that requires this
behavior use the new construct.
Note
Avoid binding together behavior that is only coincidentally repetitive. For example, just because two
different constants both have the same value, that doesn’t mean you should have only one constant, if
conceptually they’re referring to different things.
Persistence ignorance
Persistence ignorance (PI) refers to types that need to be persisted, but whose code is unaffected by
the choice of persistence technology. Such types in .NET are sometimes referred to as Plain Old CLR
Objects (POCOs), because they do not need to inherit from a particular base class or implement a
particular interface. Persistence ignorance is valuable because it allows the same business model to be
persisted in multiple ways, offering additional flexibility to the application. Persistence choices might
change over time, from one database technology to another, or additional forms of persistence might
13 CHAPTER 3 | Architectural principles
be required in addition to whatever the application started with (for example, using a Redis cache or
Azure Cosmos DB in addition to a relational database).
• Classes responsible for saving themselves (such as the Active Record pattern).
The requirement that classes have any of the above features or behaviors adds coupling between the
types to be persisted and the choice of persistence technology, making it more difficult to adopt new
data access strategies in the future.
Bounded contexts
Bounded contexts are a central pattern in Domain-Driven Design. They provide a way of tackling
complexity in large applications or organizations by breaking it up into separate conceptual modules.
Each conceptual module then represents a context that is separated from other contexts (hence,
bounded), and can evolve independently. Each bounded context should ideally be free to choose its
own names for concepts within it, and should have exclusive access to its own persistence store.
At a minimum, individual web applications should strive to be their own bounded context, with their
own persistence store for their business model, rather than sharing a database with other applications.
Communication between bounded contexts occurs through programmatic interfaces, rather than
through a shared database, which allows for business logic and events to take place in response to
changes that take place. Bounded contexts map closely to microservices, which also are ideally
implemented as their own individual bounded contexts.
Additional resources
• JAVA Design Patterns: Principles
• Bounded Context
Most traditional .NET applications are deployed as single units corresponding to an executable or a
single web application running within a single IIS appdomain. This approach is the simplest
deployment model and serves many internal and smaller public applications very well. However, even
given this single unit of deployment, most non-trivial business applications benefit from some logical
separation into several layers.
All-in-one applications
The smallest possible number of projects for an application architecture is one. In this architecture, the
entire logic of the application is contained in a single project, compiled to a single assembly, and
deployed as a single unit.
A new ASP.NET Core project, whether created in Visual Studio or from the command line, starts out as
a simple “all-in-one” monolith. It contains all of the behavior of the application, including
presentation, business, and data access logic. Figure 5-1 shows the file structure of a single-project
app.
In a single project scenario, separation of concerns is achieved through the use of folders. The default
template includes separate folders for MVC pattern responsibilities of Models, Views, and Controllers,
as well as additional folders for Data and Services. In this arrangement, presentation details should be
limited as much as possible to the Views folder, and data access implementation details should be
limited to classes kept in the Data folder. Business logic should reside in services and classes within
the Models folder.
Although simple, the single-project monolithic solution has some disadvantages. As the project’s size
and complexity grows, the number of files and folders will continue to grow as well. User interface (UI)
concerns (models, views, controllers) reside in multiple folders, which aren’t grouped together
alphabetically. This issue only gets worse when additional UI-level constructs, such as Filters or
ModelBinders, are added in their own folders. Business logic is scattered between the Models and
Services folders, and there’s no clear indication of which classes in which folders should depend on
which others. This lack of organization at the project level frequently leads to spaghetti code.
To address these issues, applications often evolve into multi-project solutions, where each project is
considered to reside in a particular layer of the application.
With a layered architecture, applications can enforce restrictions on which layers can communicate
with other layers. This architecture helps to achieve encapsulation. When a layer is changed or
replaced, only those layers that work with it should be impacted. By limiting which layers depend on
which other layers, the impact of changes can be mitigated so that a single change doesn’t impact the
entire application.
Layers (and encapsulation) make it much easier to replace functionality within the application. For
example, an application might initially use its own SQL Server database for persistence, but later could
choose to use a cloud-based persistence strategy, or one behind a web API. If the application has
properly encapsulated its persistence implementation within a logical layer, that SQL Server-specific
layer could be replaced by a new one implementing the same public interface.
Logical layering is a common technique for improving the organization of code in enterprise software
applications, and there are several ways in which code can be organized into layers.
Note
Layers represent logical separation within the application. In the event that application logic is
physically distributed to separate servers or processes, these separate physical deployment targets are
referred to as tiers. It’s possible, and quite common, to have an N-Layer application that is deployed
to a single tier.
These layers are frequently abbreviated as UI, BLL (Business Logic Layer), and DAL (Data Access Layer).
Using this architecture, users make requests through the UI layer, which interacts only with the BLL.
The BLL, in turn, can call the DAL for data access requests. The UI layer shouldn’t make any requests to
the DAL directly, nor should it interact with persistence directly through other means. Likewise, the BLL
should only interact with persistence by going through the DAL. In this way, each layer has its own
well-known responsibility.
One disadvantage of this traditional layering approach is that compile-time dependencies run from
the top to the bottom. That is, the UI layer depends on the BLL, which depends on the DAL. This
means that the BLL, which usually holds the most important logic in the application, is dependent on
data access implementation details (and often on the existence of a database). Testing business logic
in such an architecture is often difficult, requiring a test database. The dependency inversion principle
can be used to address this issue, as you’ll see in the next section.
Figure 5-3 shows an example solution, breaking the application into three projects by responsibility
(or layer).
Although this application uses several projects for organizational purposes, it’s still deployed as a
single unit and its clients will interact with it as a single web app. This allows for very simple
deployment process. Figure 5-4 shows how such an app might be hosted using Azure.
As application needs grow, more complex and robust deployment solutions may be required. Figure
5-5 shows an example of a more complex deployment plan that supports additional capabilities.
Internally, this project’s organization into multiple projects based on responsibility improves the
maintainability of the application.
This unit can be scaled up or out to take advantage of cloud-based on-demand scalability. Scaling up
means adding additional CPU, memory, disk space, or other resources to the server(s) hosting your
app. Scaling out means adding additional instances of such servers, whether these are physical
servers, virtual machines, or containers. When your app is hosted across multiple instances, a load
balancer is used to assign requests to individual app instances.
The simplest approach to scaling a web application in Azure is to configure scaling manually in the
application’s App Service Plan. Figure 5-6 shows the appropriate Azure dashboard screen to configure
how many instances are serving an app.
Clean architecture
Applications that follow the Dependency Inversion Principle as well as the Domain-Driven Design
(DDD) principles tend to arrive at a similar architecture. This architecture has gone by many names
over the years. One of the first names was Hexagonal Architecture, followed by Ports-and-Adapters.
More recently, it’s been cited as the Onion Architecture or Clean Architecture. The latter name, Clean
Architecture, is used as the name for this architecture in this e-book.
The eShopOnWeb reference application uses the Clean Architecture approach in organizing its code
into projects. You can find a solution template you can use as a starting point for your own ASP.NET
Core on the ardalis/cleanarchitecture GitHub repository.
Clean architecture puts the business logic and application model at the center of the application.
Instead of having business logic depend on data access or other infrastructure concerns, this
dependency is inverted: infrastructure and implementation details depend on the Application Core.
This functionality is achieved by defining abstractions, or interfaces, in the Application Core, which are
then implemented by types defined in the Infrastructure layer. A common way of visualizing this
architecture is to use a series of concentric circles, similar to an onion. Figure 5-7 shows an example of
this style of architectural representation.
Author: Various
Language: English
EDINBURGH MAGAZINE.
Vol. LXXIX.
CONTENTS.
EDINBURGH:
WILLIAM BLACKWOOD & SONS, 45
GEORGE STREET,
AND 37 PATERNOSTER ROW, LONDON;
To whom all communications (post paid) must be addressed.
EDINBURGH MAGAZINE.
“Poets,” said the ancient wisdom, “are not made, but born.” We
have made miraculous progress in all the arts of manufacture since
the time of this saying, but we have not been able to controvert the
judgment of our forefathers. Education, refinement, taste, and talent,
are great things in their way, and men do wonders with them; but we
have not fallen yet upon a successful method of bringing down the
divine spark into the marble, let us work it ever so curiously. The
celestial gift in these new times, as in the old, comes down with
divine impartiality, yet seldom into the tenement most specially built
and garnished for its reception. We can make critics, connoisseurs,
“an enlightened audience,” but, let us labour at it as we will, we
cannot make a poet.
And indeed, to tell the truth, it is but small help we can give, with
all our arts and ingenuities, even to the perfecting of the poet born.
Science discusses the subject gravely—at one time troubled with
apprehensions lest her severe shadow should kill the singer outright,
as Reason killed Love—at another, elate with the happier thought of
increasing all his conquests, and sending forth as her own esquire,
bearing her ponderous lance and helmet, the glorious boy in his
perennial youth. It is a vain speculation. The poet glances past this
important figure with a calm eye and a far-shining smile. His
vocation is beyond and beyond the range of all the sciences. The
heart and soul that were in the first home, ere ever even spade and
distaff were invented, when two forlorn hopeful creatures, wistfully
looking back to the sunset of Eden, wistfully looking forward to the
solemn nightfall of the drear world without, with all its starry
promises of another morning and a higher heaven, were all the
human race—are world and scope enough for the humanest and
most divine of arts. That God has made of one blood all the nations
and all the generations of this many-peopled earth, is the argument
on which he speaks; that heart answers unto heart all the world over,
is the secret of his power. The petulant passion of a child, the
heroisms and exultations and agonies of that fantastical sweet youth,
over whose unconscious mockery of our real conflict we graver
people smile and weep, are of more import to the poet than all the
secrets of the earth, and all the wonders of the sky; and he turns—it
is his vocation—from the discovery of a planet, forgetting all about it,
to make the whole world ring with joy over a cottage cradle, or weigh
down the very wings of the winds with wailing over some
uncommemorated grave.
Yes, it is a humiliating confession—but in reality we are quite as
like to injure as to elevate our poet by all our educations. Perhaps the
heavenly glamour in his eyne had best be left entirely unobscured by
any laws save those of nature; but at all events it seems tolerably
sure, that the more we labour at his training, the less satisfactory is
the result of it. A school of poets is the most hopeless affair in
existence; and whether it dwindle into those smallest of small
rhymsters, leaden echoes of the silver chimes of Pope, in whom the
eighteenth century delighted, or to the present makers of dislocated
verses, whose glory it is to break stones upon the road where the
Laureate’s gilded coach flashes by, we wait with equal weariness and
equal impatience for the Coming Man, who knows neither school nor
education—whose business it is to rout the superannuated spinsters,
and make the world ring once more with the involuntary outburst of
song and youth.
But we who are but the unhappy victims of the mania, why do we
blame ourselves? Alas! it is not we, but our poets, foolish fraternity,
who have set about this fatal task of making a school and perfecting
themselves in their art. How do you suppose they are to do it, kindest
reader? In other arts and professions the self-love of the student in
most instances suffers a woeful downfall at his very outset. Tutors
and books, dire conspirators against his innocence, startle the
hapless neophyte out of all his young complacency; professors set
him down calmly as a know-nothing; chums, with storms of laughter,
drive him out of his last stronghold. He has to shut himself out from
his college doors; seal himself up, poor boy, in his home letters, and
so sit down and study other people’s wisdom, till he comes by that far
away and roundabout process to some true estimate of his own.
But the poet, say the poets, needs other training. For him it is
safest that we shut him up with himself. Himself, a separated
creature, garlanded and crowned for the sacrifice, is, in one noble
concentration, all the ethics, the humanity, and the religion with
which he has to do; significances, occult and mysterious, are in every
breath of wind that whispers about his dedicated head; his smallest
actions are note-worthy, his sport is a mystery, his very bread and
cheese symbolical. He is a poet—everywhere, and in all places, it is
the destiny of this unfortunate to reverence himself, to contemplate
himself, to expound and study the growth of a poet’s mind, the
impulses of a poet’s affections; he is not to be permitted to be
unconscious of the sweet stirrings within him of the unspoken song;
he is not to be allowed to believe with that sweetest simplicity of
genius that every other youthful eye beholds “the light that never was
on sea or land,” as well as his own. Unhappy genius! ill-fated poet!
for him alone of all men must the heavens and the earth be blurred
over with a miserable I,—and so he wanders, a woeful Narcissus,
seeing his own image only, and nothing better, in all the lakes and
fountains; and, bound by all the canons of his art, falls at last
desperately either in love or in hate with the persistent double,
which, go where he will, still looks him in the face.
But we bethink us of the greater poets, sons of the elder time.
There was David, prince of lyric-singers; there was Shakespeare,
greatest maker among men. The lyricist was a king, a statesman, a
warrior, and a prophet; the leisure of his very youth was the leisure
of occupation, when the flocks were feeding safe in the green
pastures, and by the quiet waters; and even then the dreaming poet-
eye had need to be wary, and sometimes flashed into sudden
lightning at sight of the lion which the stripling slew. He sung out of
the tumult and fulness of his heart—out of the labours, wars, and
tempests of his most human and most troubled life: his business in
this world was to live, and not to make poems. Yet what songs he
made! They are Holy Writ, inspired and sacred; yet they are human
songs, the lyrics of a struggling and kingly existence—the overflow of
the grand primal human emotions to which every living heart
resounds. His “heart moved him,” his “soul was stirred within him”—
true poet-heart—true soul of inspiration! and not what other men
might endure, glassed in the mirror of his own profound poetic
spirit, a study of mankind; but of what himself was bearing there and
at that moment, the royal singer made his outcry, suddenly, and “in
his haste,” to God. What cries of distress and agony are these! what
bursts of hope amid the heartbreak! what shouts and triumphs of
great joy! For David did not live to sing, but sang because he strove
and fought, rejoiced and suffered, in the very heart and heat of life.
Let us say a word of King David ere we go further. Never crowned
head had so many critics as this man has had in these two thousand
years; and many a scorner takes occasion by his failings, and
religious lips have often faltered to call him “the man after God’s own
heart;” yet if we would but think of it, how touching is this name! Not
the lofty and philosophic Paul, though his tranced eyes beheld the
very heaven of heavens; not John, although the human love of the
Lord yearned towards that vehement angel-enthusiast, whose very
passion was for God’s honour; but on this sinning, struggling,
repenting David, who fights and falls, and rises only to fall and fight
again—who only never will be content to lie still in his overthrow,
and acknowledge himself vanquished—who bears about with him
every day the traces of some downfall, yet every day is up again,
struggling on as he can, now discouraged, now desperate, now
exultant; who has a sore fighting life of it all his days, with enemies
within and without, his hands full of wars, his soul of ardours, his life
of temptations. Upon this man fell the election of Heaven. And small
must his knowledge be, of himself or of his race, who is not moved to
the very soul to think upon God’s choice of this David, as the man
after His own heart. Heaven send us all as little content with our sins
as had the King of Israel! Amen.
And then there is Shakespeare: never man among men, before or
after him, has made so many memorable people; yet amid all the
crowding faces on his canvass, we cannot point to one as “the
portrait of the painter.” He had leisure to make lives and histories for
all these men and women, but not to leave a single personal token to
us of himself. The chances seem to be, that this multitudinous man,
having so many other things to think of, thought marvellously little
of William Shakespeare; and that all that grave, noble face would
have brightened into mirthfullest laughter had he ever heard, in his
own manful days, of the Swan of Avon. His very magnitude, so to
speak, lessens him in our eyes; we are all inclined to be apologetic
when we find him going home in comfort and good estate, and
ending his days neither tragically nor romantically, but in ease and
honour. He is the greatest of poets, but he is not what you call a
poetical personage. He writes his plays for the Globe, but, once
begun upon them, thinks only of his Hamlet or his Lear, and not a
whit of his audience; nor, in the flush and fulness of his genius, does
a single shadow of himself cross the brilliant stage, where, truth to
speak, there is no need of him. The common conception of a poet, the
lofty, narrow, dreamy soul, made higher and more abstract still by
the glittering crown of light upon his crested forehead, is entirely
extinguished in the broad flood of sunshine wherein stands this
Shakespeare, a common man, sublimed and radiant in a very deluge
and overflow of genial power. Whether it be true or not that these
same marvellous gifts of his would have made as great a statesman
or as great a philosopher as they made a poet, it does not lie in our
way to discover; but to know that the prince of English poets did his
work, which no man has equalled, with as much simplicity and as
little egotism as any labouring peasant of his time—to see him setting
out upon it day by day, rejoicing like a strong man to run a race, but
never once revealing to us those laborious tokens of difficulties
overcome, which of themselves, as Mr Ruskin says, are among the
admirable excellences of Art—to perceive his ease and speed of
progress, and how his occupation constantly is with his story and
never with himself,—what a lesson it is! But alas, and alas! we are
none of us Shakespeares. Far above his motives, we would scorn to
spend our genius on a Globe Theatre, or on any other vulgar manner
of earning daily bread. The poet is a greater thing than his poem; let
us take it solely as an evidence of his progress; and in the mean time,
however he may tantalise the world with his gamut and his exercises,
let all the world look on with patience, with awe, and with
admiration. True, he is not making an Othello or a Hamlet; but never
mind, he is making Himself.
Yet the thought will glide in upon us woefully unawares,—What
the better are we? We are ever so many millions of people, and only a
hundred or two of us at the utmost can be made happy in the
personal acquaintanceship of Mr Tennyson or (we humbly crave the
Laureate’s pardon for the conjunction) Mr Dobell. In this view of the
question, it is not near so important to us that these gentlemen
should perfect the poet, as that they should make the poem. We ask
the Laureate for a battle-song, and he gives us a skilful fantasia upon
the harp; we hush our breath and open our ears, and, listening
devoutly to the “Eureka!” of here and there a sanguine critic, who has
found a poet, wait, longing for the lay that is to follow. Woe is upon
us!—all that we can hear in the universal twitter is, that every man is
trying his notes. We are patient, but we are not a stoic; and in the
wrath of our disappointment are we not tempted a hundred times to
plunge these melodious pipes into the abyss of our waste-paper
basket, and call aloud for Punch, and the Times?
Yes, that great poetic rebel, Wordsworth, has heavier sins upon his
head than Betty Foy and Alice Fell; it is to him we owe it, that the
poet in these days is to be regarded as a delicate monster, a creature
who lives not life but poetry, a being withdrawn out of the common
existence, and seeing its events only in the magic mirror of his own
consciousness, as the Lady of Shallott saw the boats upon the river,
and the city towers burning in the sun. The Poet of the Lakes had no
imaginary crimes to tell the world of, nor does it seem that he
regarded insanity as one of the highest and most poetic states of
man; but we venture to believe there never would have been a
Balder, and Maud should have had no crazy lover, had there been no
Recluse, solemnly living a long life for Self and Poetry in the retired
and sacred seclusion of Rydal Mount.
It is in this way that the manner which is natural and a necessity to
some one great spirit, becomes an intolerable bondage and
oppression to a crowd of smaller ones. The solemn egotism, self-
reserved and abstract, which belonged to Wordsworth, is more easily
copied than the broad, bright, manful nature of our greatest English
poet, who was too mighty to be peculiar; and the delusion has still a
deeper root. It is in our nature, as it seems, to scorn what is familiar
and common to all the world; priesthoods, find them where you will,
are bound to profess a more ethereal organisation, and seek a
separated atmosphere. Wordsworth is a very good leader; but for a
thorough out-and-out practical man, admitting no compromise with
his theory, commend us to Anthony the Eremite, the first of all
monkish deserters from this poor sinking vessel, the world. The poet
is the priest of Nature; out with him from this Noah’s ark of clean
and unclean,—this field of wheat and tares, growing together till the
harvest,—this ignoble region of common life. Let the interpreter
betake him to his monastery, his cloister, his anchorite’s cell—and
when he is there? Yes, when he is there—he will sing to us poor
thralls whom he has left behind, but not of our ignoble passions and
rejoicings, or the sorrows that rend our hearts. Very different from
our heavy-handed troubles, rough troopers in God’s army of
afflictions, are the spectre shapes of this poetic world. True, their
happiness is rapture, their misery of the wildest, their remorse the
most refined; but the daylight shines through and through these
ghostly people, and leaves nothing of them but bits of cloud. Alas, the
preaching is vain and without profit! What can the poet do—when he
is tired of his Mystic, sick of his Balder, weary of Assyrian bulls and
lords with rabbit-mouths? Indeed, there seems little better left for
him than what his predecessors did before. The monk spent his soul
upon some bright-leaved missal, and left the record of his life in the
illumination of an initial letter, or the border of foliage on a vellum
page; the poet throws away his in some elaborate chime of words,
some new inverted measure, or trick of jingling syllables. Which is
the quaintest? for it is easy to say which is the saddest waste of the
good gifts of God.
Also it is but an indifferent sign of us, being, as we undoubtedly
are, so far as poetry is concerned, a secondary age, that there can be
no dispute about the first poet of our day. There is no elder
brotherhood to compete for the laurel; no trio like Wordsworth,
Coleridge, and Southey; no guerilla like Byron to seize upon the
contested honour, nor Irish minstrel to strike a sugared note of
emulation. Should a chance arrow at this moment strike down our
poetic champion, so far from comforting ourselves, like King Henry,
that we have “five hundred as good as he,” we could not find for our
consolation one substitute for Tennyson. Echoes of him we could
indeed find by the score; but no one his entire equal in all the field.
Let no one say we do not appreciate poetry; in these mechanical days
there are still a goodly number of singers who could echo that
unfortunate admission which cost Haverillo his life, and was the last
stroke of exasperation to the redoubtable Firmilian, “I have a third
edition in the press.” But in spite of Smith and Dobell, the Brownings
and the Mystics, our Laureate holds his place; holding his laurel with
justice and right less disputable than most of his predecessors. Yet
our admiration of Tennyson is perplexed and unsatisfactory. He is
the first in his generation, but out of his generation he does not bear
comparison with any person of note and fame equal to his own. He is
small in the presence of Wordsworth, a very inferior magician indeed
by the side of Coleridge; his very music—pardon us, all poets and all
critics!—does not flow. It may be melodious, but it is not winged; one
stanza will not float into another. It is a rosary of golden beads, some
of them gemmed and radiant, fit to be set in a king’s crown; but you
must tell them one by one, and take leisure for your comment while
they drop from your fingers. They are beautiful, but they leave you
perfectly cool and self-possessed in the midst of your admiration. To
linger over them is a necessity; it becomes them to be read with
criticism; you go over the costly beadroll and choose your single
favourites here and there, as you might do in a gallery of sculpture.
And thus the poet chooses to make you master of his song,—it does
not seize upon you.
This is a kind and manner of influence which poets have not often
aimed at. Hitherto it has been the object of this fraternity to arrest
and overpower their audience as the Ancient Mariner fascinated the
wedding guest; and we all know how helplessly, and with what
complete submission, we have followed in the train of these
enchanters, wheresoever it pleased them to turn their wayward
footsteps. But Mr Tennyson aims at a more refined and subtle
influence than this downright enslaving. A poet who writes, or seems
to write, because he cannot help it,—and a poet who writes, or seems
to write, of set purpose and malice prepense, are two very different
persons. A man of the first class could not have written In
Memoriam. Had he been mourning, he must have mourned a closer
grief, and broken his heart over it, ere he had wept the half of those
melodious tears; but for the poet quietly selecting a subject for his
poem, the wisest philosopher could not have suggested a better
choice. A great deal has been said and written on this subject, and we
are fully aware that grief does not make books, or even poems, except
in very rare and brief instances, and that the voice of a great sorrow
is a sharp and bitter outcry, and not a long and eloquent monologue.
But Mr Tennyson does not present himself to us under the strong
and violent compulsion of a great sorrow. It is not grief at his heart
which makes him speak, using his gifts to give ease and utterance to
its burden of weeping; but it is himself who uses his grief, fully
perceiving its capabilities, and the entrance it will give him into the
sacred and universal sympathy of his fellows. For, like all great works
of art, this poem appeals to one of the primitive and universal
emotions of human nature. The dead—the early dead, the beloved,
the gifted, the young: we may discuss the appropriateness of the
tribute, but we cannot refuse to be moved by its occasion. No man
can look on these pages without finding here and there a verse which
strikes home; for few of us are happy enough to live so much as
twenty years in this weary world of ours without some In Memoriam
of our own.
Yet we cannot complain of Mr Tennyson that he makes
merchandise of any of the nearest and closest bereavements, the
afflictions which shake the very balance of the world to those who
suffer them. His sorrow is as much of the mind as of the heart; he
weeps a companion beloved, yet almost more honoured and
esteemed than beloved—a friend, not even a brother, still less a child
or a wife;—enough of the primitive passion to claim sympathy from
all of us, but not so much that our sympathy loses itself in a woe
beyond consolation. Pure friendship is seldom so impassioned; but
had it been a commoner tie—a relationship more usual—these
gradual revelations of grief in all its successive phases must have
been too much at once for the poet and his audience. This nice
discrimination secures for us that we are able to read and follow him
into all those solemn regions of thought and fancy which open at the
touch of death; he does not fall down upon the grave, the threshold,
as we are but too like to do, and we wander after him wistfully,
beguiled with the echo of this thoughtful weeping, which must have
overpowered us had it been as close or as personal as our own. We
feel that over our own minds these same thoughts have flashed now
and then—a momentary gleam—while we were wading in the bitter
waters, and woefully making up our minds, a hundred times in an
hour, to the will of God; but who could follow them out? The poet,
more composed, does what we could not do; he makes those flashes
of hope or of agony into pictures visible and true. Those glimpses of
the face of the dead, of the moonlight marking out upon the marble
the letters of his name, those visions of his progress now from height
to height in the pure heavens, all the inconsistent lights and shadows
—mingled thoughts of the silence in the grave, and of the sound and
sunshine of heaven—not one of them is passed over. People say it is
not one poem, but a succession of poems. It must have been so, or it
would not have been true. One after another they come gleaming
through the long reverie of grief—one after another, noting well their
inconsistencies, their leaps from day to night, from earth to heaven,
the poet has set them down. He knows that we think of the lost, in
the same instant, as slumbering under the sod and as awaking above
the sky; he knows that we realise them here and there, as living and
yet as dead; he knows that our
“fancy fuses old and new,
And flashes into false and true,
And mingles all without a plan.”