100% found this document useful (6 votes)
4K views62 pages

12, and Beyond 3rd Edition (Early Access) Carl-Hugo Marcotte

beyond

Uploaded by

alisivsakik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (6 votes)
4K views62 pages

12, and Beyond 3rd Edition (Early Access) Carl-Hugo Marcotte

beyond

Uploaded by

alisivsakik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Architecting ASP.NET Core Applications: An


atypical design patterns guide for .NET 8, C#
12, and beyond 3rd Edition (Early Access)
Carl-Hugo Marcotte
https://textbookfull.com/product/architecting-asp-
net-core-applications-an-atypical-design-patterns-
guide-for-net-8-c-12-and-beyond-3rd-edition-early-
access-carl-hugo-marcotte/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Architecting ASP.NET Core Applications Carl-Hugo Marcotte

https://textbookfull.com/product/architecting-asp-net-core-
applications-carl-hugo-marcotte/

textbookfull.com

Biota Grow 2C gather 2C cook Loucas

https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-loucas/

textbookfull.com

C# 12 and .NET 8 – Modern Cross-Platform Development


Fundamentals: Start building websites and services with
ASP.NET Core 8, Blazor, and EF Core 8, 8th Edition Mark J.
Price
https://textbookfull.com/product/c-12-and-net-8-modern-cross-platform-
development-fundamentals-start-building-websites-and-services-with-
asp-net-core-8-blazor-and-ef-core-8-8th-edition-mark-j-price/
textbookfull.com

A Golden Treatise of Mental Prayer St Peter Of Alcantara

https://textbookfull.com/product/a-golden-treatise-of-mental-prayer-
st-peter-of-alcantara/

textbookfull.com
Fundamentals of Logic Design 7th Edition Roth

https://textbookfull.com/product/fundamentals-of-logic-design-7th-
edition-roth/

textbookfull.com

Strategic Management of Health Care Organizations Eighth


Edition. Edition Peter M. Ginter

https://textbookfull.com/product/strategic-management-of-health-care-
organizations-eighth-edition-edition-peter-m-ginter/

textbookfull.com

Sports Injuries of the Shoulder Lennard Funk

https://textbookfull.com/product/sports-injuries-of-the-shoulder-
lennard-funk/

textbookfull.com

Acupressure for Horses Hands On Techniques to Solve


Performance Problems and Ease Pain and Discomfort Gosmeier
Ina
https://textbookfull.com/product/acupressure-for-horses-hands-on-
techniques-to-solve-performance-problems-and-ease-pain-and-discomfort-
gosmeier-ina/
textbookfull.com

Advances in Carpet Manufacture K K Goswami

https://textbookfull.com/product/advances-in-carpet-manufacture-k-k-
goswami/

textbookfull.com
Theory of Thermodynamic Measurements of Quantum Systems
Far from Equilibrium Abhay Shastry

https://textbookfull.com/product/theory-of-thermodynamic-measurements-
of-quantum-systems-far-from-equilibrium-abhay-shastry/

textbookfull.com
Architecting ASP.NET Core
Applications
Copyright © 2023 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in


a retrieval system, or transmitted in any form or by any means,
without the prior written permission of the publisher, except in the
case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure
the accuracy of the information presented. However, the information
contained in this book is sold without warranty, either express or
implied. Neither the author, nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged
to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information


about all of the companies and products mentioned in this book by
the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.

Early Access Publication: Architecting ASP.NET Core


Applications

Early Access Production Reference: B19826

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham

B3 2PB, UK
ISBN: 978-1-80512-338-5

www.packt.com
Table of Contents
1. Architecting ASP.NET Core Applications, Third Edition: An
atypical design patterns guide for .NET 8, C# 12, and beyond
2. 1 Introduction
I. Before you begin: Join our book community on Discord
II. What is a design pattern?
III. Anti-patterns and code smells
i. Anti-patterns
ii. Code smells
IV. Understanding the web – request/response
V. Getting started with .NET
i. .NET SDK versus runtime
ii. .NET 5+ versus .NET Standard
iii. Visual Studio Code versus Visual Studio versus the
command-line interface
iv. Technical requirements
VI. Summary
VII. Questions
VIII. Further reading
3. 2 Automated Testing
I. Before you begin: Join our book community on Discord
II. Introduction to automated testing
i. Unit testing
ii. Integration testing
iii. End-to-end testing
iv. Other types of tests
v. Picking the right test style
III. Testing approaches
i. TDD
ii. ATDD
iii. BDD
iv. Refactoring
v. Technical debt
IV. Testing techniques
i. White-box testing
ii. Black-box testing
iii. Grey-box testing
iv. White-box vs. Black-box vs. Grey-box testing
v. Conclusion
V. Test case creation
i. Equivalence Partitioning
ii. Boundary Value Analysis
iii. Decision Table Testing
iv. State Transition Testing
v. Use Case Testing
VI. How to create an xUnit test project
VII. Key xUnit features
i. Facts
ii. Assertions
iii. Theories
iv. Closing words
VIII. Arrange, Act, Assert
IX. Organizing your tests
i. Unit tests
ii. Integration tests
X. Writing ASP.NET Core integration tests
i. Classic web application
ii. Minimal hosting
XI. Important testing principles
XII. Summary
XIII. Questions
XIV. Further reading
4. 3 Architectural Principles
I. Before you begin: Join our book community on Discord
II. Separation of concerns (SoC)
III. Don’t repeat yourself (DRY)
IV. Keep it simple, stupid (KISS)
V. The SOLID principles
i. Single responsibility principle (SRP)
ii. Open/Closed principle (OCP)
iii. Liskov substitution principle (LSP)
iv. Interface segregation principle (ISP)
v. Dependency inversion principle (DIP)
VI. Summary
VII. Questions
VIII. Further reading
5. 4 REST APIs
I. Before you begin: Join our book community on Discord
II. REST & HTTP
i. HTTP methods
ii. HTTP Status code
iii. HTTP headers
iv. Versioning
v. Wrapping up
III. Data Transfer Object (DTO)
i. Goal
ii. Design
iii. Conceptual examples
iv. Conclusion
IV. API contracts
i. Code-first API Contract
ii. Wrapping up
V. Summary
VI. Questions
VII. Further reading
VIII. Answers
6. 5 Minimal API
I. Before you begin: Join our book community on Discord
II. Top-level statements
III. Minimal Hosting
IV. Minimal APIs
i. Map route-to-delegate
ii. Configuring endpoints
iii. Leveraging endpoint filters
iv. Leveraging the endpoint filter factory
v. Organizing endpoints
V. Using Minimal APIs with Data Transfer Objects
i. Goal
ii. Design
iii. Project – Minimal API
iv. Conclusion
VI. Summary
VII. Questions
VIII. Further reading
IX. Answers
7. 6 Model-View-Controller
I. Before you begin: Join our book community on Discord
II. The Model View Controller design pattern
i. Goal
ii. Design
iii. Anatomy of ASP.NET Core web APIs
iv. Conclusion
III. Using MVC with DTOs
i. Goal
ii. Design
iii. Project – MVC API
iv. Conclusion
IV. Summary
V. Questions
VI. Further reading
VII. Answers
8. 7 Strategy, Abstract Factory, and Singleton Design Patterns
I. Before you begin: Join our book community on Discord
II. The Strategy design pattern
i. Goal
ii. Design
iii. Project – Strategy
iv. Conclusion
III. The Abstract Factory design pattern
i. Goal
ii. Design
iii. Project – Abstract Factory
iv. Project – The mid-range vehicle factory
v. Impacts of the Abstract Factory
vi. Conclusion
IV. The Singleton design pattern
i. Goal
ii. Design
iii. An alternate (better) way
iv. Code smell – Ambient Context
v. Conclusion
V. Summary
VI. Questions
VII. Answers
9. 8 Dependency Injection
I. Before you begin: Join our book community on Discord
II. What is dependency injection?
i. The composition root
ii. Striving for adaptability
iii. Understanding the use of the IoC container
iv. The role of an IoC container
v. Code smell – Control Freak
vi. Object lifetime
vii. Registering our dependencies
viii. Registering your features elegantly
ix. Using external IoC containers
III. Revisiting the Strategy pattern
i. Constructor injection
ii. Property injection
iii. Method injection
iv. Project – Strategy
v. Conclusion
IV. Understanding guard clauses
V. Revisiting the Singleton pattern
i. Project – Application state
ii. Project – Wishlist
iii. Conclusion
VI. Understanding the Service Locator pattern
i. Project – ServiceLocator
ii. Conclusion
VII. Revisiting the Factory pattern
i. Project – Factory
VIII. Summary
IX. Questions
X. Further reading
XI. Answers
10. 9 Options, Settings, and Configuration
I. Before you begin: Join our book community on Discord
II. Loading the configuration
III. Learning the building blocks
i. IOptionsMonitor<TOptions>
ii. IOptionsFactory<TOptions>
iii. IOptionsSnapshot<TOptions>
iv. IOptions<TOptions>
IV. Project – CommonScenarios
i. Manual configuration
ii. Using the settings file
iii. Injecting options
iv. Named options
v. Reloading options at runtime
V. Project – OptionsConfiguration
i. Creating the program
ii. Configuring the options
iii. Implementing a configurator object
iv. Adding post-configuration
v. Using multiple configurator objects
vi. Exploring other configuration possibilities
VI. Project – OptionsValidation
i. Eager validation
ii. Data annotations
iii. Validation types
VII. Project – OptionsValidationFluentValidation
VIII. Workaround – Injecting options directly
IX. Project – Centralizing the configuration
X. Using the configuration-binding source generator
i. Project – ConfigurationGenerators: Part 1
XI. Using the options validation source generator
i. Project – ConfigurationGenerators: Part 2
XII. Using the ValidateOptionsResultBuilder class
i. Project - ValidateOptionsResultBuilder
XIII. Summary
XIV. Questions
XV. Further reading
XVI. Answers
11. 10 Logging patterns
I. Before you begin: Join our book community on Discord
II. About logging
III. Writing logs
IV. Log levels
V. Logging providers
VI. Configuring logging
VII. Structured logging
VIII. Summary
IX. Questions
X. Further reading
XI. Answers
12. 11 Structural Patterns
I. Before you begin: Join our book community on Discord
II. Implementing the Decorator design pattern
i. Goal
ii. Design
iii. Project – Adding behaviors
iv. Project – Decorator using Scrutor
v. Conclusion
III. Implementing the Composite design pattern
i. Goal
ii. Design
iii. Project – BookStore
iv. Conclusion
IV. Implementing the Adapter design pattern
i. Goal
ii. Design
iii. Project – Greeter
iv. Conclusion
V. Implementing the Façade design pattern
i. Goal
ii. Design
iii. Project – The façades
iv. Conclusion
VI. Summary
VII. Questions
VIII. Further reading
IX. Answers
13. 12 Behavioral Patterns
I. Before you begin: Join our book community on Discord
II. Implementing the Template Method pattern
i. Goal
ii. Design
iii. Project – Building a search machine
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
iv. Conclusion
III. Implementing the Chain of Responsibility pattern
i. Goal
ii. Design
iii. Project – Message interpreter
iv. Conclusion
IV. Mixing the Template Method and Chain of Responsibility
patterns
i. Project – Improved message interpreter
ii. Project – A final, finer-grained design
iii. Conclusion
V. Summary
VI. Questions
VII. Answers
14. 13 Understanding the Operation Result Design Pattern
I. Before you begin: Join our book community on Discord
II. The Operation Result pattern
i. Goal
ii. Design
iii. Project – Implementing different Operation Result
patterns
iv. Advantages and disadvantages
III. Summary
IV. Questions
V. Further reading
VI. Answers
15. 14 Layering and Clean Architecture
I. Before you begin: Join our book community on Discord
II. Introducing layering
i. Classic layering model
ii. Splitting the layers
iii. Layers versus tiers versus assemblies
III. Responsibilities of the common layers
i. Presentation
ii. Domain
iii. Data
IV. Abstract layers
V. Sharing the model
VI. Clean Architecture
VII. Implementing layering in real life
i. To be or not to be a purist?
ii. Building a façade over a database
VIII. Summary
IX. Questions
X. Further reading
XI. Answers
16. 15 Object Mappers, Aggregate Services, and Façade
I. Before you begin: Join our book community on Discord
II. Object mapper
i. Goal
ii. Design
iii. Project – Mapper
iv. Conclusion
III. Code smell – Too many dependencies
IV. Pattern – Aggregate Services
V. Pattern – Mapping Façade
VI. Project – Mapping service
VII. Project – AutoMapper
VIII. Project – Mapperly
IX. Summary
X. Questions
XI. Further reading
XII. Answers
17. 16 Mediator and CQRS Design Patterns
I. Before you begin: Join our book community on Discord
II. A high-level overview of Vertical Slice Architecture
III. Implementing the Mediator pattern
i. Goal
ii. Design
iii. Project – Mediator (IMediator)
iv. Project – Mediator (IChatRoom)
v. Conclusion
IV. Implementing the CQS pattern
i. Goal
ii. Design
iii. Project – CQS
iv. Conclusion
V. Code smell – Marker Interfaces
i. Metadata
ii. Dependency identifier
VI. Using MediatR as a mediator
i. Project – Clean Architecture with MediatR
ii. Conclusion
VII. Summary
VIII. Questions
IX. Further reading
X. Answers
18. 17 Getting Started with Vertical Slice Architecture
I. Before you begin: Join our book community on Discord
II. Anti-pattern – Big Ball of Mud
III. Vertical Slice Architecture
i. What are the advantages and disadvantages?
ii. Project – Vertical Slice Architecture
iii. Conclusion
IV. Continuing your journey: A few tips and tricks
V. Summary
VI. Questions
VII. Further reading
VIII. Answers
19. 18 Request-EndPoint-Response (REPR) and Minimal APIs
I. Before you begin: Join our book community on Discord
II. Request-EndPoint-Response (REPR) pattern
i. Goal
ii. Design
iii. Project – SimpleEndpoint
iv. Conclusion
III. Project – REPR—A slice of the real-world
i. Assembling our stack
ii. Dissecting the code structure
iii. Exploring the shopping basket
iv. Managing exception handling
v. Grey-box testing
IV. Summary
V. Questions
VI. Further reading
VII. Answers
20. 19 Introduction to Microservices Architecture
I. Before you begin: Join our book community on Discord
II. What are microservices?
i. Cohesive unit of business
ii. Ownership of data
iii. Microservice independence
III. An introduction to event-driven architecture
i. Domain events
ii. Integration events
iii. Application events
iv. Enterprise events
v. Conclusion
IV. Getting started with message queues
i. Conclusion
V. Implementing the Publish-Subscribe pattern
i. Message brokers
ii. The event sourcing pattern
iii. Example
iv. Conclusion
VI. Introducing Gateway patterns
i. Gateway Routing pattern
ii. Gateway Aggregation pattern
iii. Backend for Frontend pattern
iv. Mixing and matching gateways
v. Conclusion
VII. Project – REPR.BFF
i. Layering APIs
ii. Running the microservices
iii. Creating typed HTTP clients using Refit
iv. Creating a service that serves the current customer
v. Features
vi. Conclusion
VIII. Revisiting the CQRS pattern
i. Advantages and potential risks
ii. Conclusion
IX. Exploring the Microservice Adapter pattern
i. Adapting an existing system to another
ii. Decommissioning a legacy application
iii. Adapting an event broker to another
iv. Conclusion
X. Summary
XI. Questions
XII. Further reading
XIII. Answers
21. 20 Modular Monolith
I. Before you begin: Join our book community on Discord
II. What is a Modular Monolith?
i. What are traditional Monoliths?
ii. What are microservices?
III. Advantages of Modular Monoliths
IV. Key Components of a Modular Monolith
V. Implementing a Modular Monolith
i. Planning the project
ii. Defining our stack
VI. Project—Modular Monolith
i. Sending events from the catalog module
ii. Consuming the events from the basket module
iii. Inside the aggregator
iv. Exploring the REST API HttpClient
v. Sending HTTP requests to the API
vi. Validating the existence of a product
VII. Transitioning to Microservices
VIII. Challenges and Pitfalls
IX. Conclusion
X. Questions
XI. Further reading
XII. An end is simply a new beginning
XIII. Answers
Architecting ASP.NET Core
Applications, Third Edition: An
atypical design patterns guide for
.NET 8, C# 12, and beyond
Welcome to Packt Early Access. We’re giving you an exclusive
preview of this book before it goes on sale. It can take many months
to write a book, but our authors have cutting-edge information to
share with you today. Early Access gives you an insight into the latest
developments by making chapter drafts available. The chapters may
be a little rough around the edges right now, but our authors will
update them over time.You can dip in and out of this book or follow
along from start to finish; Early Access is designed to be flexible. We
hope you enjoy getting to know more about the process of writing a
Packt book.

1. Chapter 1: Introduction
2. Chapter 2: Automated Testing
3. Chapter 3: Architectural Principles
4. Chapter 4: REST APIs
5. Chapter 5: Minimal API
6. Chapter 6: Model-View-Controller
7. Chapter 7: Strategy, Abstract Factory, and Singleton Design
Patterns
8. Chapter 8: Dependency Injection
9. Chapter 9: Options, Settings, and Configuration
10. Chapter 10: Logging patterns
11. Chapter 11: Structural Patterns
12. Chapter 12: Behavioral Patterns
13. Chapter 13: Understanding the Operation Result Design Pattern
14. Chapter 14: Layering and Clean Architecture
15. Chapter 15: Object Mappers, Aggregate Services, and Façade
16. Chapter 16: Mediator and CQRS Design Patterns
17. Chapter 17: Getting Started with Vertical Slice Architecture
18. Chapter 18: Request-EndPoint-Response (REPR) and Minimal
APIs
19. Chapter19: Introduction to Microservices Architecture
20. Chapter20: Modular Monolith
1 Introduction
Before you begin: Join our book community on Discord
Give your feedback straight to the author himself and chat to other early readers on our Discord
server (find the "architecting-aspnet-core-apps-3e" channel under EARLY ACCESS
SUBSCRIPTION).

https://packt.link/EarlyAccess

The goal of this book is not to create yet another design pattern book; instead, the chapters are
organized according to scale and topic, allowing you to start small with a solid foundation and build
slowly upon it, just like you would build a program.Instead of a guide covering a few ways of
applying a design pattern, we will explore the thought processes behind the systems we are designing
from a software engineer’s point of view.This is not a magic recipe book; from experience, there is no
magical recipe when designing software; there are only your logic, knowledge, experience, and
analytical skills. Let’s define “experience” as your past successes and failures. And don’t worry, you
will fail during your career, but don’t get discouraged by it. The faster you fail, the faster you can
recover and learn, leading to successful products. Many techniques covered in this book should help
you achieve success. Everyone has failed and made mistakes; you aren’t the first and certainly won’t
be the last. To paraphrase a well-known saying by Roosevelt: the people that never fail are the ones
who never do anything.At a high level:

This book explores basic patterns, unit testing, architectural principles, and some ASP.NET Core
mechanisms.
Then, we move up to the component scale, exploring patterns oriented toward small chunks of
software and individual units.
After that, we move to application-scale patterns and techniques, exploring ways to structure an
application.
Some subjects covered throughout the book could have a book of their own, so after this book,
you should have plenty of ideas about where to continue your journey into software architecture.

Here are a few pointers about this book that are worth mentioning:

The chapters are organized to start with small-scale patterns and then progress to higher-level
ones, making the learning curve easier.
Instead of giving you a recipe, the book focuses on the thinking behind things and shows the
evolution of some techniques to help you understand why the shift happened.
Many use cases combine more than one design pattern to illustrate alternate usage so you can
understand and use the patterns efficiently. This also shows that design patterns are not beasts
to tame but tools to use, manipulate, and bend to your will.
As in real life, no textbook solution can solve all our problems; real problems are always more
complicated than what’s explained in textbooks. In this book, I aim to show you how to mix and
match patterns to think “architecture” instead of giving you step-by-step instructions to
reproduce.
The rest of the introduction chapter introduces the concepts we explore throughout the book,
including refreshers on a few notions. We also touch on .NET, its tooling, and some technical
requirements.In this chapter, we cover the following topics:

What is a design pattern?


Anti-patterns and code smell.
Understanding the web – request/response.
Getting started with .NET.

What is a design pattern?


Since you just purchased a book about design patterns, I guess you have some idea of what design
patterns are, but let’s make sure that we are on the same page.Abstract definition: A design
pattern is a proven technique that we can use to solve a specific problem.In this book, we apply
different patterns to solve various problems and leverage some open-source tools to go further,
faster! Abstract definitions make people sound smart, but understanding concepts requires more
practice, and there is no better way to learn than by experimenting with something, and design
patterns are no different.If that definition does not make sense to you yet, don’t worry. You should
have enough information by the end of the book to correlate the multiple practical examples and
explanations with that definition, making it crystal clear.I like to compare programming to playing
with LEGO® because what you have to do is very similar: put small pieces together to create
something bigger. Therefore, if you lack imagination or skills, possibly because you are too young,
your castle might not look as good as someone with more experience. With that analogy in mind, a
design pattern is a plan to assemble a solution that fits one or more scenarios, like the tower of a
castle. Once you designed a single tower, you can build multiple by following the same steps. Design
patterns act as that tower plan and give you the tools to assemble reliable pieces to improve your
masterpiece (program).However, instead of snapping LEGO® blocks together, you nest code blocks
and interweave objects in a virtual environment!Before going into more detail, well-thought-out
applications of design patterns should improve your application designs. That is true whether
designing a small component or a whole system. However, be careful: throwing patterns into the mix
just to use them can lead to the opposite result: over-engineering. Instead, aim to write the least
amount of readable code that solves your issue or automates your process.As we have briefly
mentioned, design patterns apply to different software engineering levels, and in this book, we start
small and grow to a cloud-scale! We follow a smooth learning curve, starting with simpler patterns
and code samples that bend good practices to focus on the patterns—finally ending with more
advanced topics and good practices.Of course, some subjects are overviews more than deep dives,
like automated testing, because no one can fit it all in a single book. Nonetheless, I’ve done my best
to give you as much information about architecture-related subjects as possible to ensure the proper
foundations are in place for you to get as much as possible out of the more advanced topics, and I
sincerely hope you’ll find this book a helpful and enjoyable read.Let’s start with the opposite of
design patterns because it is essential to identify wrong ways of doing things to avoid making those
mistakes or to correct them when you see them. Of course, knowing the right way to overcome
specific problems using design patterns is also crucial.

Anti-patterns and code smells


Anti-patterns and code smells are bad architectural practices or tips about possible bad design.
Learning about best practices is as important as learning about bad ones, which is where we start.
The book highlights multiple anti-patterns and code smells to help you get started. Next, we briefly
explore the first few.

Anti-patterns
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
An anti-pattern is the opposite of a design pattern: it is a proven flawed technique that will most
likely cause you trouble and cost you time and money (and probably give you headaches).An anti-
pattern is a pattern that seems a good idea and seems to be the solution you were looking for, but it
causes more harm than good. Some anti-patterns started as legitimate design patterns and were
labelled anti-patterns later. Sometimes, it is a matter of opinion, and sometimes the classification
can be influenced by the programming language or technologies.Let’s look at an example next. We
will explore some other anti-patterns throughout the book.

Anti-pattern – God Class

A God class is a class that handles too many things. Typically, this class serves as a central entity
which many other classes inherit or use within the application it is the class that knows and manages
everything in the system; it is the class. On the other hand, it is also the class that nobody wants to
update, which breaks the application every time somebody touches it: it is an evil class!The best
way to fix this is to segregate responsibilities and allocate them to multiple classes rather than
concentrating them in a single class. We look at how to split responsibilities throughout the book,
which helps create more robust software.If you have a personal project with a God class at its core,
start by reading the book and then try to apply the principles and patterns you learn to divide that
class into multiple smaller classes that interact together. Try to organize those new classes into
cohesive units, modules, or assemblies.To help fix God classes, we dive into architectural principles
in Chapter 3, Architectural Principles, opening the way to concepts such as responsibility
segregation.

Code smells
A code smell is an indicator of a possible problem. It points to areas of your design that could
benefit from a redesign. By “code smell,” we mean “code that stinks” or “code that does not smell
right.”It is important to note that a code smell only indicates the possibility of a problem; it does not
mean a problem exists. Code smells are usually good indicators, so it is worth analyzing your
software’s “smelly” parts.An excellent example is when a method requires many comments to
explain its logic. That often means that the code could be split into smaller methods with proper
names, leading to more readable code and allowing you to get rid of those pesky comments.Another
note about comments is that they don’t evolve, so what often happens is that the code described by a
comment changes, but the comment remains the same. That leaves a false or obsolete description of
a block of code that can lead a developer astray.The same is also true with method names.
Sometimes, the method’s name and body tell a different story, leading to the same issues.
Nevertheless, this happens less often than orphan or obsolete comments since programmers tend to
read and write code better than spoken language comments. Nonetheless, keep that in mind when
reading, writing, or reviewing code.

Code smell – Control Freak

An excellent example of a code smell is using the new keyword. This indicates a hardcoded
dependency where the creator controls the new object and its lifetime. This is also known as the
Control Freak anti-pattern, but I prefer to box it as a code smell instead of an anti-pattern since
the new keyword is not intrinsically wrong.At this point, you may be wondering how it is possible not
to use the new keyword in object-oriented programming, but rest assured, we will cover that and
expand on the control freak code smell in Chapter 7, Deep Dive into Dependency Injection.

Code smell – Long Methods

The long methods code smell is when a method extends to more than 10 to 15 lines of code. That is
a good indicator that you should think about that method differently. Having comments that
separate multiple code blocks is a good indicator of a method that may be too long.Here are a few
examples of what the case might be:

The method contains complex logic intertwined in multiple conditional statements.


The method contains a big switch block.
The method does too many things.
The method contains duplications of code.

To fix this, you could do the following:

Extract one or more private methods.


Extract some code to new classes.
Reuse the code from external classes.
If you have a lot of conditional statements or a huge switch block, you could leverage a design
pattern such as the Chain of Responsibility, or CQRS, which you will learn about in Chapter 10,
Behavioral Patterns, and Chapter 14, Mediator and CQRS Design Patterns.

Usually, each problem has one or more solutions; you need to spot the problem and then find,
choose, and implement one of the solutions. Let’s be clear: a method containing 16 lines does not
necessarily need refactoring; it could be OK. Remember that a code smell indicates that there might
be a problem, not that there necessarily is one—apply common sense.

Understanding the web – request/response


Before going any further, it is imperative to understand the basic concept of the web. The idea
behind HTTP 1.X is that a client sends an HTTP request to a server, and then the server responds to
that client. That can sound trivial if you have web development experience. However, it is one of the
most important web programming concepts, irrespective of whether you are building web APIs,
websites, or complex cloud applications.Let’s reduce an HTTP request lifetime to the following:

1. The communication starts.


2. The client sends a request to the server.
3. The server receives the request.
4. The server does something with the request, like executing code/logic.
5. The server responds to the client.
6. The communication ends.

After that cycle, the server is no longer aware of the client. Moreover, if the client sends another
request, the server is unaware that it responded to a request earlier for that same client because
HTTP is stateless.There are mechanisms for creating a sense of persistence between requests for
the server to be “aware” of its clients. The most well-known of these is cookies.If we dig deeper, an
HTTP request comprises a header and an optional body. Then, requests are sent using a specific
method. The most common HTTP methods are GET and POST . On top of those, extensively used by
web APIs, we can add PUT , DELETE , and PATCH to that list.Although not every HTTP method accepts
a body, can respond with a body, or should be idempotent, here is a quick reference table:

Method Request has body Response has body Idempotent


GET No* Yes Yes
POST Yes Yes No
PUT Yes No Yes
PATCH Yes Yes No
DELETE May May Yes
* Sending a body with a GET request is not forbidden by the HTTP specifications, but the
semantics of such a request are not defined either. It is best to avoid sending GET requests with
a body.

An idempotent request is a request that always yields the same result, whether it is sent once or
multiple times. For example, sending the same POST request multiple times should create multiple
similar entities, while sending the same DELETE request multiple times should delete a single entity.
The status code of an idempotent request may vary, but the server state should remain the same. We
explore those concepts in more depth in Chapter 4, Model-View-Controller.Here is an example of a
GET request:

GET http: //www.forevolve.com/ HTTP/1.1


Host: www.forevolve.com
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,fr-CA;q=0.8,fr;q=0.7
Cookie: ...

The HTTP header comprises a list of key/value pairs representing metadata that a client wants to
send to the server. In this case, I queried my blog using the GET method and Google Chrome
attached some additional information to the request. I replaced the Cookie header’s value with ...
because it can be pretty large and that information is irrelevant to this sample. Nonetheless, cookies
are passed back and forth like any other HTTP header.

Important note about cookies

The client sends cookies, and the server returns them for every request-response cycle. This
could kill your bandwidth or slow down your application if you pass too much information
back and forth (cookies or otherwise). One good example would be a serialized identity
cookie that is very large.

Another example, unrelated to cookies but that created such a back-and-forth, was the good
old Web Forms ViewState . This was a hidden field sent with every request. That field could
become very large when left unchecked.

Nowadays, with high-speed internet, it is easy to forget about those issues, but they can
significantly impact the user experience of someone on a slow network.

When the server decides to respond to the request, it returns a header and an optional body,
following the same principles as the request. The first line indicates the request’s status: whether it
was successful. In our case, the status code was 200 , which indicates success. Each server can add
more or less information to its response. You can also customize the response with code.Here is the
response to the previous request:
HTTP/1.1 200 OK
Server: GitHub.com
Content-Type: text/html; charset=utf-8
Last-Modified: Wed, 03 Oct 2018 21:35:40 GMT
ETag: W/"5bb5362c-f677"
Access-Control-Allow-Origin: *
Expires: Fri, 07 Dec 2018 02:11:07 GMT
Cache-Control: max-age=600
Content-Encoding: gzip
X-GitHub-Request-Id: 32CE:1953:F1022C:1350142:5C09D460
Content-Length: 10055
Accept-Ranges: bytes
Date: Fri, 07 Dec 2018 02:42:05 GMT
Via: 1.1 varnish
Age: 35
Connection: keep-alive
X-Served-By: cache-ord1737-ORD
X-Cache: HIT
X-Cache-Hits: 2
X-Timer: S1544150525.288285,VS0,VE0
Vary: Accept-Encoding
X-Fastly-Request-ID: 98a36fb1b5642c8041b88ceace73f25caaf07746
<Response body truncated for brevity>

Now that the browser has received the server’s response, it renders the HTML webpage. Then, for
each resource, it sends another HTTP call to its URI and loads it. A resource is an external asset,
such as an image, a JavaScript file, a CSS file, or a font.After the response, the server is no longer
aware of the client; the communication has ended. It is essential to understand that to create a
pseudo-state between each request, we need to use an external mechanism. That mechanism could
be the session-state leveraging cookies, simply using cookies, or some other ASP.NET Core
mechanisms, or we could create a stateless application. I recommend going stateless whenever
possible. We write primarily stateless applications in the book.

Note

If you want to learn more about session and state management, I left a link in the Further
reading section at the end of the chapter.

As you can imagine, the backbone of the internet is its networking stack. The Hypertext Transfer
Protocol (HTTP) is the highest layer of that stack (layer 7). HTTP is an application layer built on
the Transmission Control Protocol (TCP). TCP (layer 4) is the transport layer, which defines
how data is moved over the network (for instance, the transmission of data, the amount of
transmitted data, and error checking). TCP uses the Internet Protocol (IP) layer to reach the
computer it tries to talk to. IP (layer 3) represents the network layer, which handles packet IP
addressing.A packet is a chunk of data that is transmitted over the wire. We could send a large file
directly from a source to a destination machine, but that is not practical, so the network stack breaks
down large items into smaller packets. For example, the source machine breaks a file into multiple
packets, sends them to the target machine, and then the target reassembles them back into the
source file. This process allows numerous senders to use the same wire instead of waiting for the first
transmission to be done. If a packet gets lost in transit, the source machine can also send only that
packet back to the target machine.Rest assured, you don’t need to understand every detail behind
networking to program web applications, but it is always good to know that HTTP uses TCP/IP and
chunks big payloads into smaller packets. Moreover, HTTP/1 limits the number of parallel requests a
browser can open simultaneously. This knowledge can help you optimize your apps. For example, a
high number of assets to load, their size, and the order in which they are sent to the browser can
increase the page load time, the perceived page load time, or the paint time.To conclude this subject
and not dig too deep into networking, HTTP/1 is older but foundational. HTTP/2 is more efficient
and supports streaming multiple assets using the same TCP connection. It also allows the server to
send assets to the client before it requests the resources, called a server push.If you find HTTP
interesting, HTTP/2 is an excellent place to start digging deeper, as well as the HTTP/3 proposed
standard that uses the QUIC transport protocol instead of HTTP (RFC 9114). ASP.NET Core 7.0+
supports HTTP/3, which is enabled by default in ASP.NET Core 8.0.Next, let’s quickly explore .NET.

Getting started with .NET


A bit of history: .NET Framework 1.0 was first released in 2002. .NET is a managed framework that
compiles your code into an Intermediate Language (IL) named Microsoft Intermediate
Language (MSIL). That IL code is then compiled into native code and executed by the Common
Language Runtime (CLR). The CLR is now known simply as the .NET runtime. After releasing
several versions of .NET Framework, Microsoft never delivered on the promise of an interoperable
stack. Moreover, many flaws were built into the core of .NET Framework, tying it to Windows.Mono,
an open-source project, was developed by the community to enable .NET code to run on non-
Windows OSes. Mono was used and supported by Xamarin, acquired by Microsoft in 2016. Mono
enabled .NET code to run on other OSes like Android and iOS. Later, Microsoft started to develop an
official cross-platform .NET SDK and runtime they named .NET Core.The .NET team did a
magnificent job building ASP.NET Core from the ground up, cutting out compatibility with the older
.NET Framework versions. That brought its share of problems at first, but .NET Standard alleviated
the interoperability issues between the old .NET and the new .NET.After years of improvements and
two major versions in parallel (Core and Framework), Microsoft reunified most .NET technologies
into .NET 5+ and the promise of a shared Base Class Library (BCL). With .NET 5, .NET Core
simply became .NET while ASP.NET Core remained ASP.NET Core. There is no .NET “Core” 4, to
avoid any potential confusion with .NET Framework 4.X.New major versions of .NET release every
year now. Even-number releases are Long-Term Support (LTS) releases with free support for 3
years, and odd-number releases (Current) have free support for only 18 months.The good thing
behind this book is that the architectural principles and design patterns covered should remain
relevant in the future and are not tightly coupled with the versions of .NET you are using. Minor
changes to the code samples should be enough to migrate your knowledge and code to new
versions.Next, let’s cover some key information about the .NET ecosystem.

.NET SDK versus runtime


You can install different binaries grouped under SDKs and runtimes. The SDK allows you to build
and run .NET programs, while the runtime only allows you to run .NET programs.As a developer,
you want to install the SDK on your deployment environment. On the server, you want to install the
runtime. The runtime is lighter, while the SDK contains more tools, including the runtime.

.NET 5+ versus .NET Standard


When building .NET projects, there are multiple types of projects, but basically, we can separate
them into two categories:

Applications
Libraries

Applications target a version of .NET, such as net5.0 and net6.0 . Examples of that would be an
ASP.NET application or a console application.Libraries are bundles of code compiled together, often
distributed as a NuGet package. .NET Standard class library projects allow sharing code between
.NET 5+, and .NET Framework projects. .NET Standard came into play to bridge the compatibility
gap between .NET Core and .NET Framework, which eased the transition. Things were not easy
when .NET Core 1.0 first came out.With .NET 5 unifying all the platforms and becoming the future of
the unified .NET ecosystem, .NET Standard is no longer needed. Moreover, app and library authors
should target the base Target Framework Moniker (TFM), for example, net8.0 . You can also
target netstandard2.0 or netstandard2.1 when needed, for example, to share code with .NET
Framework. Microsoft also introduced OS-specific TFMs with .NET 5+, allowing code to use OS-
specific APIs like net8.0-android and net8.0-tvos . You can also target multiple TFMs when
needed.

Note

I’m sure we will see .NET Standard libraries stick around for a while. All projects will not
just migrate from .NET Framework to .NET 5+ magically, and people will want to continue
sharing code between the two.

The next versions of .NET are built over .NET 5+, while .NET Framework 4.X will stay where it is
today, receiving only security patches and minor updates. For example, .NET 8 is built over .NET 7,
Random documents with unrelated
content Scribd suggests to you:
a hemisphere of stars. Ahead, above the horizon, was a crescent
moon that served to silhouette the hill and its horizon of trees.
Around them were dark shapes, motionless.
Earl kept the flashlight ready, but didn't use it as they stole swiftly
forward. Neither man spoke, but their breathing was a stentorian
sound that blended with distant traffic noises and the nearby chirping
of a cricket, and the rustling of weeds as they forced them aside in
their passage.
They reached the hill and went forward more slowly, using caution as
they remembered the effects of the paralysis gun. Now Earl was
remembering the way he had come before, finding landmarks in the
darkness. At last he stopped and touched Basil's arm to bring him to
a halt.
"It's on the other side of these bushes," he whispered. "I'll use the
flash."
He parted the branches. Suddenly a cone of light exploded in the
darkness.
"Right there," Basil said. Then, in surprise, "It's gone!"
"Naturally," Earl said in some disgust. "It fits the pattern."
"What pattern?" Basil asked.
Earl was slow in answering. He said, "I don't know. I just felt it. Or
maybe I do know. Nadine and that guy Ladd were small and got big
in a hurry. What was to keep that thing from doing the same? That's
part of it. The other part is just a feeling. They don't seem to want to
advertise to the world that they're here. Maybe the damn thing
became invisible or something. With stasis spheres and small people
that get big, and paralysis guns, what's so impossible about that ship
or whatever it is getting big and becoming invisible? I'll bet it's still
there."
But though they passed back and forth over the entire area, with
increasing boldness, they encountered nothing, visible or invisible,
that was out of the ordinary.
There was a concave depression in the soil where Earl remembered
the puffball shape to have been. Even fresh scars in the dirt around
the depression.
For a while Earl blundered through the underbrush calling Nadine's
name cautiously, without hope. Finally they were forced to give up
and return to the lab building.
"We could call the police," Basil said doubtfully.
"Oh, sure," Earl said, his voice harsh. "What would we tell them? Dr.
Glassman would be called in. Next they'd call the boys in the white
jackets."
"Maybe they're just the boys we need," Basil said. "Or a good stiff
drink. I like the idea of the drink."

It was ten o'clock in the morning when Irene Conner pushed open
the door without knocking and strolled casually into Earl's laboratory.
She saw him at the far end of the room, hunched over with his
elbows on the window sill, his back to her.
"Hi, Earl," she called cheerfully. "Want to have mid-morning coffee
with me?"
"No," Earl said without moving.
"You sound tired," Irene said, going over to stand beside him. "Or is
it spring fever—more accurately the summer doldrums."
"Neither," he said, glancing up at her with tired eyes. "I just want to
be left alone. I'm thinking." He straightened up with a deep sigh.
"Why don't you get Basil to have coffee with you?"
"That jerk?" Irene said. "He gets in my hair."
"Like you get in mine?" Earl said.
"That was cruel."
"Sorry," Earl relented. "I didn't get much sleep last night. I've got
problems. I'd much rather be left alone with them right now."
Irene inspected him critically as a man might inspect his automobile.
"Your eyes are bloodshot," she said. "Why not have some coffee with
me and tell me your problems. Maybe I can help you."
"Nobody can help me—least of all you."
The phone on the desk in the corner rang. Earl went to answer it.
"This is Glassman," the phone said. "I want a general staff meeting in
my office at once. Tell Dr. Conner she must be there too."
"Okay," Earl said. He hung up and looked at Irene. "Goat face," he
explained. "General staff meeting. We're to go to his office at once."
"Maybe this is it," Irene said, suddenly sober.
Earl nodded. That was the way it would come. A phone call for
general staff meeting. A quiet announcement that one of the
scientists had at last found the ideal nerve fluid for the brain. That's
all there would be to it. The greatest achievement since—if not
including—the atom bomb, and the historic moment would pass
without a shout—with perhaps only a tired sigh of relief, a glance of
envy at the lucky one who had found it.
"Well, let's get it over with," Earl said.
They went into the hall and walked side by side in silence toward the
back of the building where it joined the Dome. Basil joined them, for
once hardly noticing Irene as he looked questioningly at Earl, who
shook his head imperceptibly.
They entered Dr. Glassman's office. The director was sitting behind
his desk, ignoring them, pretending to be reading some typewritten
papers.
Earl looked around. They were all there now, he and the other nine
scientists, and Dr. Glassman. Only there was something wrong with
the picture. One of them should have been beaming at the others,
the light of triumph in his or her eyes. Instead, the other nine
reflected his own puzzled bewilderment.
"Sit down, sit down," Dr. Glassman said, looking up at them. He
waited until they were all seated about the room, then cleared his
throat importantly, pushing aside the papers he had been reading. He
started to say something, then became aware of their expressions.
He shook his head. "The end isn't in sight yet. But we may be closer
than we think. I'll introduce you in a moment to a new addition to
our staff. A person who—from the reports I've seen from Washington
—seems to be quite a genius at creating new type molecules, tailor-
made for specific tasks. Our new associate won't be assigned a
separate lab. Instead, will serve as a sort of general consultant,
observing all your work, and will make suggestions for hastening
things up a bit." A murmur of voices and sharp footsteps came from
the hall. "My wife has been showing our new colleague the Brain. I
think they're coming now."
The door opened. Mrs. Glassman's cheerful face appeared. "They're
all here now," she said over her shoulder.
The door opened farther. Earl, and everyone else, was staring at the
opening, waiting for their first glimpse of the newcomer.
Earl half rose to his feet before he stopped himself. Then he slowly
sat down, his eyes wide and puzzled.

It was Nadine. She wasn't wearing the clothes he had bought for her
the day before. Instead, she was dressed in a stylishly cut business
suit and low heeled slippers, a trim hat covering her hair. She had
paused just inside the room, a half smile on her carefully painted lips.
Her eyes surveyed each face pleasantly, passing over Earl's as though
she had never seen him before.
"Come up here, my dear," Dr. Glassman said in honeyed tones. And
to the others, "I want you to meet Dr. Nadine Holmes." Then back to
her, "What did you think of the Brain? Quite an imposing thing, isn't
it?"
"Yes, it is," Nadine replied. "I felt quite—awed by it, sitting there
where it will remain for untold centuries, waiting only for the vital
fluid that will give it the ability to think."
"I'm sure it won't be untold centuries before it gets the fluid," Dr.
Glassman said, chuckling heartily at his own humor. "I'll introduce
you to your co-workers, Dr. Holmes. This is Dr. Paul Hardwick...."
Earl caught Basil's attention and shook his head warningly. He waited,
then, for his turn at being introduced, his heart pounding violently,
his pulse racing.
"... and this is Dr. Earl Frye ..." Dr. Glassman said.
"How do you do, Dr. Frye." Nadine's hand was smooth and cool as
she rested it in his. Her eyes sized him up with impersonal interest,
but without a flicker of recognition.
"... and this is Dr. Basil Nelson ...."
Nadine withdrew her hand gently and moved on.
"And now you may return to your work," Dr. Glassman announced. "I
know the male members of the staff will be waiting for a visit from
our charming new member, but you must be patient. She will get
around to all of you in the next few days."
Earl was in the hall before Glassman had finished. He wanted to
think. Rapid footsteps caught up with him. "Now can we have
coffee?" she asked with humorous petulance.
"No!" Earl said with more fierceness in his voice than he had
intended. It had the effect of a physical blow on Irene. She fell back
a step, blinking.
Basil caught up with them. "I want to talk with you, Earl," he said.
"Basil," Irene cut in, "will you have coffee with me?"
"Me?" Basil said in delight. "Sure." He linked his arm in hers. "Let's
go." He looked back over his shoulder at Earl. "Thanks, Earl," he said.
"I'll see you later." It was two hours later.

"You sure it's her?" Basil said. "I'm inclined to agree with you. Of
course, I saw her only for a second or two.... Where do you suppose
she picked up those snazzy clothes? I was watching her when she
was introduced to you. Boy, is she some actress!"
"I'm wondering if it was an act," Earl said frowning.
"Of course it was—had to be if she's the same girl. But she didn't let
on she knew you at all."
"That's why I wonder if it was an act. There was something strange
about her. I can't quite put my finger on it—or yes I can. She's
changed. Today her whole personality is different. And where did she
get papers authentic enough to fool Glassman?"
"Why don't you ask her when she comes here?" Basil suggested.
Earl shook his head. "I wonder if she could be under some sort of
hypnosis? No, wait. It isn't any more absurd than a paralysis gun. If
she doesn't stay here tonight I'm going to follow her and see where
she goes. Are you with me?"
"Uh," Basil hesitated. "Depends on when she leaves the building.
Irene and I have sort of a date to have dinner at the Red Barn at six
o'clock."
"Go ahead," Earl said, grinning. "I'll probably have more success
alone anyway. We'd get in each other's way."
"Why don't you ask Glassman where she's staying? It's probably
some hotel in town."
"I'll think about it," Earl said.
When Basil left, Earl went to the window and looked toward the hill.
Would Nadine go there? Was there some hiding place on the hill
where she would go, to wait until tomorrow, after her "day's work"
was done?
Earl nodded to himself. It had to be. Nothing else fitted into the crazy
pattern of events.
One thing he was certain of now. In spite of the accident that had
broken open the "ship" when it landed out there, its coming here—or
here and now—was no accident. Nor Nadine's apparent familiarity
with his name the night before, or her showing up now with
credentials that gave her the run of the place in an almost
supervisory capacity.
And that meant that her interest was in the Brain. Hers—and who
else? George Ladd, of course. How many more? If each of those
stasis spheres had contained a person, there were dozens more in on
it.
Then why had Nadine been sent into the open when she was certain
to be recognized by him?
That was what had been bothering him from the instant she walked
into Glassman's office. On the surface it was the most stupid thing
that could have occurred. On the surface....
Stupid. Yet somehow stupid didn't seem to fit. Maybe it had been
exceedingly cunning. Maybe there was something he had missed.
Cunning it might be—or stupid. But there was something else about it
that neither adjective quite fit. There was obviously organization in
back of Nadine. People. A "ship". Paralysis guns and what they
implied. Therefore planning, colored by one accident. Suppose every
detail of the plan had been worked out ahead of time, and was going
ahead without alteration. Suppose the original plan had specified that
Nadine was to be the "front", and the plan was proceeding blindly, on
the behavior level of instinct in animals who repeat instinctive
routines made senseless by changed environment. Or the blind
function level of a machine that keeps turning out parts when the
conveyor belt has stopped, until it wrecks itself.
It annoyed Earl not to be able to pin his thoughts down, to bring
everything into full focus.

He went to his kitchenette and fixed a hasty lunch. All afternoon he


worked, immersed in the routine of testing chemicals in batches of
ten and making out report sheets on each one. And all afternoon he
puzzled over what could be behind Nadine's having shown up. Not so
much what might be behind her having returned to the scene, nor
her not recognizing him, but why someone else hadn't been used.
No one dropped in. Irene's absence gave him only a sense of relief.
Basil, no doubt, was staying away because of a guilt complex. Nadine
—her continued absence could be because she wasn't ready for him
yet, or she truly didn't remember him and would get to him in due
time, perhaps tomorrow; or maybe the Plan involved some other
member of the research group. Or the destruction of the Brain? Earl
shook his head at this thought. That alternative didn't fit.
And then it was four-thirty. Already Earl had reasoned out what he
intended to do. Either Nadine would go into town and stay at a hotel,
remain in the building as a guest of the Glassmans', or she would
leave the building and make her way by some circuitous route to the
spot on the hill where the "ship" had been.
Only the latter possibility interested Earl right now. He quickly slipped
off his lab apron and put on a suit coat. He wished that he still had a
gun, but it had been stolen with the stasis spheres. He'd have to do
without it.
Leaving the building, he walked along the sidewalk until he was able
to approach the hill from the other side where he wouldn't be seen
from the windows.
It was ten minutes to five when he settled down to wait in the
concealment of a thicket where he could command a view of the
approaches from every direction, and a clear view of the slight
depression in the ground where the "ship" had dropped.
There was nothing to do now but wait—and stay awake. He was
acutely aware, suddenly, of his lack of sleep the night before. A warm
breeze rustled the leaves around him. A small hoptoad paused to
stare up at him in unblinking fixity.
Overhead in a large Maple tree a host of sparrows paused to hold a
brief political convention.
And then Nadine was coming up the slope from the side away from
the lab. Her chic hat dangled carelessly in her right hand, the warm
breeze mussing her hair. A too normal smart-looking woman's purse
was under her arm. The breeze caught her skirt, molding her graceful
legs, her slim body. She was too much the picture of a normal girl
idly strolling in a park.
A great nostalgia, an almost overwhelming yearning, took possession
of Earl. He wanted to rush forward, let her know he was there,
waiting for her.
Instead, he remained motionless, watching her approach.
She seemed to be heading straight for him. For an instant he thought
she must have seen him. But her expression held no excitement or
anything but half dreamy enjoyment of her surroundings.

Scarcely fifteen feet away she came to a stop and turned to face
toward the concave depression in the ground, another fifty feet
beyond her. With her free hand she reached up and patted at her hair
like any normal girl would do, unconsciously.
Abruptly Earl became aware of something just beyond her. It wasn't
tangible. A shimmering in the air. A slight but definite refractive
quality that had not been there the moment before.
Nadine had seen it too. She walked forward a few steps.
"This is it!" Earl thought to himself. He crouched to run after her.
She took another step. She vanished, not abruptly, but as one might
vanish into a bright silver but otherwise transparent fog.
In that instant Earl moved hurtling forward so that when she
disappeared he was a step behind her.
Instantly the peaceful wooded scene vanished. His feet were on a
smooth hard floor. Ahead of him he caught a brief glimpse of walls, of
people without clothes.
Then he was falling over Nadine and trying to keep from falling on
her. His arms were around her. Somehow he twisted so that when he
landed she was on top, unhurt.
There was a stunned eternity when her eyes were looking into his,
recognition and gladness unmasked, hope and pleading sending him
some secret message, some unspoken word trembling on her lips.
But Earl had seen George Ladd even as he fell, and the never
forgotten instincts developed in him during World War III were in
motion, making him continue his roll so that in the next instant he
was on his feet, Nadine behind him. Ladd hadn't expected this and
was caught by surprise. Earl took advantage of that brief uncertainty,
stepping in and bringing a short chopping right against Ladd's jaw.
Before George Ladd reached the floor, Earl was running in great
strides, his eyes darting ahead in search of a place to escape.
"Wait!" Nadine called. But he didn't pause. He couldn't trust her.
George Ladd had been armed with his paralysis gun. He'd been
waiting for him. This had been a trap, and Nadine had led him into it.
Ahead was a doorway. He hesitated. Should he continue on down the
corridor or take the doorway? He decided on the latter. It opened into
a room, unoccupied at the moment. There were windows. One of
them was open. Earl didn't hesitate. Beyond the window was a wide
paved street. If he could get away, mingle with crowds....
No one was in sight. He sprinted along the pavement, away from the
Dome which he had glimpsed over his shoulder. It was beautiful, its
basic structure adorned with granite superstructures of fine
workmanship. But he didn't pause to admire it. He wanted people,
lots of people, to mix with and hide from pursuit.
For a hundred yards the street went through parkways. Then ahead
were buildings. He reached them, racing along a canyon formed by
windowless walls of buildings. He rounded a corner. The street was
still deserted.
He ran on and on, turning corners when he came to them, but
always heading in one general direction so as not to circle back
toward the Dome.

Abruptly he paused. Beside him was a door in a building. He darted


inside, closing the door behind him and leaning against it while he
breathed in rasping gulps of air.
Ahead of him was a corridor and more doors. After a brief rest he
sprinted down the hallway. If he could find a vacant room, a place to
hide until he could map out some plan.
He listened at the first door. There was no sound. He tried the knob.
The door opened silently under his touch. He stepped in. The room
was unoccupied. Its far wall was of glass. He glanced through it. He
was looking out over an enormous workshop of some kind. Row upon
row of small vats were there—and people.
He was seeing his first people of this world he had plunged into. They
wore no clothes. They seemed to be tending the vats, walking along
the aisles, pausing here and there at a vat to touch banks of controls
and watch what was in each vat.
From the hall Earl had just left came loud voices. The words were in
a strange language, but the tones carried their own message. His
pursuers had caught up with him. In another moment they would
open the door and find him.
He looked around for a way to escape. There was a trap door in the
floor. It undoubtedly led to the huge workshop. Earl lifted the door
and saw a ladder. He climbed onto it, letting the trap door fall back
into place as he descended.
He fully expected workers to see him and react to his presence in
some way. A worker was less than ten feet away. The worker didn't
pause or seem to notice him.
Silently Earl watched the man's eyes, dull and void of intelligence.
They seemed only passive recorders of what there was for him to
see. He was touching control knobs in front of a vat.
Earl looked into the vat and caught his breath. Floating in the tank
was a human embryo. It was alive, its umbilical cord growing from a
spongy mass on the floor of the tank.
Forgetting his danger, Earl grabbed the man's shoulder. "What is
this?" he demanded. "Human babies growing in tanks?"
The worker waited unresisting until Earl released his grip, then
continued on his routine way. He was, in every respect, a robot,
doing his specialized job, his mind a complete blank to anything else.
A zombie. Earl looked out over the vast baby factory and realized
with numb horror that all the hundreds of people working here were
the same. Walking dead, their minds capable of only one thing—
doing this specialized task. And the human embryos in the tanks?
Would they become walking zombies?
Over his head came the sound of the trap door opening. Earl didn't
take time to look up. He ran. Down an aisle between rows of unborn
humans tended by undead zombies. Up another ladder into another
observation room, ignoring shouts that caught up with him. Out
another door, down another hall, through another door, and into a
street again.
Miles of streets, and then something recognizable. A factory with
belching smokestacks. He plunged toward it recklessly, desperately
hoping to find intelligent men. Men with minds. Men able to help him
hide.
He found himself inside a huge plant where giant ladles were pouring
molten metal into molds. There were men running the machines that
controlled the pouring. They wore thick asbestos-like suits.
As Earl ran toward them he saw one of them slip and fall so that his
arm went into the stream of molten metal. The man didn't cry out
nor jerk away. Splattering metal cascaded on the others. There was
the stench of burned flesh.
His mind numb with the shock of what he was seeing, Earl stood
rooted, watching the others continue their work with expressionless
faces, blank eyes. Mindless creatures, controlled like inanimate
robots.
"Earl!"
He turned in the direction of the voice. He saw Nadine beckoning for
him to come to her. He started toward her, then stopped. She was
different from these—or was she? No, she wasn't any different. She
too was an automaton. She was beckoning him to walk into another
trap.
He turned to run the other way, but in that moment of indecision he
had been surrounded by men like George Ladd, carrying the little
paralysis guns—and they were automatons too.
He turned, searching for a way of escape, the smell of molten metal
and cooked flesh strong in his nostrils. And then he felt the sting of
the paralysis gun and was falling forward.
A sharp pain entered the base of his skull. He lost consciousness then
with the monstrous horror of what was around him searing into his
soul.
The next instant, it seemed, he awakened, all the horror fresh in his
mind, the stinging sensation at the nape of his neck changed to a dull
throbbing pain. Nadine had led him into this. But she was like the
rest, a zombie unable to think for herself.
He shook his head slowly in pained bewilderment. She hadn't been
that way the first time he met her. She had been—herself. What
could have created this nightmare?
A voice somewhere sounded in deep resonant tones. "So you are
awake," it said.
Earl rolled onto his side and searched for the source of the voice.
There was no one in view. He was in a room whose walls and ceiling
were heavy glass. He looked through the ceiling and saw the familiar
maze of steel catwalks inside the dome.
Outside his glass prison a pair of video cameras were trained on him.
Their lenses seemed somehow sentient, so that their motionlessness
partook of the quality of a fixed stare.
"I've always wanted to meet you," the voice said, and it seemed to
come from a small case atop the camera frames.
It was a dream, Earl decided. He had been hit on the head. In his
delirium he had conjured up the Brain, activated and intelligent as it
was designed to be in theory, possessed of a mind of its own.
"Of course," the voice went on, "I've seen film shots of you. You are
the discoverer of the nerve fluid that made me possible."
Earl sat up abruptly. "Who are you? And where—"
"I am the Cyberene. This is the year 3042 A. D., in the old calendar. I
had you brought here through what might be called a time tube from
your own period. Shortly you will return through that tube to your
own time—as many hours ahead from the time you left as you spend
here before you go back."
Earl got to his feet slowly, watching the glistening lenses. "Now it
begins to fit together," he said. "You're behind Nadine and Ladd. You
say I'm the discoverer of the nerve fluid. You're mistaken. It hasn't
been found yet—and there are ten of us looking for it. One of the
others may be the one to find it."
"History says you found it."
"And you just wanted to see me because of that?" Earl asked.
"Watch," the voice said.
The plate glass wall in front of Earl changed suddenly, to become
apparently a giant window over-looking a huge sprawling city. There
were buildings that reached thousands of feet into the sky, with
fragile looking networks of bridges spanning the spaces among them.
There were giant aircraft in the sky. In the distance was a trail of fire
that might be from an inter-planetary rocket ship departing
spaceward.
And abruptly the elfin city was blotted out by a blinding sun. Seconds
later the blinding sun was gone, and Earl could see the city again.
But now it was only the skeleton of what it had been. Its spiderweb
design of bridges was torn and twisted. Many of its tall buildings
were even now toppling toward the ground. Fire shot skyward in a
pyrotechnic display of havoc.

A giant airplane appeared, heading straight toward the window


through which Earl watched. It grew larger. For a brief second he
looked into its control cabin and saw its pilot and co-pilot. They were
human, but their faces were harsh and cruel, their eyes cold and
inhuman. In the next instant they were gone.
"That is a typical scene on—the other Earth," the voice of the
Cyberene explained.
The scene of the desolate city vanished. In its place appeared
another scene. A city under construction. Giant building machines
were placing it together, and the parts that were completed were
even more beautiful than had been that other city.
Earl, from his vantage point, seemed to drop closer and drift over the
scene of construction to a part that was inhabited. He saw the people
below. They wore no clothes and didn't seem to mind. Each appeared
to be intent on going somewhere. None of them were talking or
paying any attention to one another. Their expressions were blank,
their eyes vacant.
The vantage point followed one of them. Shortly the man being
followed turned into an archway, up an incline, and into a large hall.
He went through a door into the room filled with cell-like vats. In
each transparent vat Earl saw a human embryo, alive and growing.
He "followed" the man through this place to another, where children
were playing with psychological toys designed to increase mechanical
and scientific aptitudes.
"This, too, is a typical scene on—this Earth," the Cyberene said. The
scene vanished. Once again Earl looked into the video eyes of the
Brain. "They are both Earth in the year 3042," the Cyberene said,
"but not the same Earth. In 1980 there was a split. Earth followed
two independent futures. The first, filled with wars and eternal
carnage, ever more perfect weapons of destruction, developed from
one decision you made. The second, my world, filled with perpetual
peace and happiness, developed from the alternative decision. You
created these two futures."
"I?" Earl said. "You must be crazy. How?"
"In the first you discovered the vital nerve fluid that makes me
possible. You thought you were God. You thought you could see a
future in which I would work the human race harm. You suppressed
your discovery by the simple process of giving a negative lab report
on the substance. In the second world—my world—you did as you
were supposed to do. You announced your discovery. I came into
being."
"You mean to say my actions caused the whole planet to split into
two identical worlds?"
"In effect, yes. I'll try to explain. Matter and motion are not real in
the basic sense. They are properties of your mind. They are what
your finite mind sees; but reality is the space-time continuity of which
one instant is a cross-section. In effect, consciousness flows along
the time dimension which I term the fourth dimension. But in
addition there is a fifth dimension, so that these two Earths have the
same space-time coordinates in four dimensions, and two different
ones in the fifth. In Euclidean concepts, that other Earth is eighty-
seven millionths of an inch from this, in the fifth dimension. In that
Earth I did not develop. The Dome is still there, but the Brain, if it still
exists, was never activated. As a result, humanity continued its
violent progress through time, engaging in war after war.
"When I discovered time travel and saw all this I decided to go back
and contact you before your instant of decision and get you to
release the identity of the nerve fluid when you discover it
tomorrow."
"Tomorrow?" Earl said.
"In your time."
"I see," Earl said. "Tomorrow I make the discovery. In one time
stream I tell Glassman. In the other I decide not to. What made me
decide not to?"
"You thought the Brain would be bad for humanity. You were, of
course, wrong."
"Was I?" Earl said.
"In that other world, wars are the normal state of things. They stem
from problems that don't exist in my world. Over-population,
competition in trade in things that aren't necessary to human
economy, opposed political systems—all the foibles and
inconsistencies of untrained and unorganized populations."
"I understand that," Earl said. "Why don't your people wear clothes?"
"Clothes are unnecessary—one of the things I eliminated in reducing
the industrial economy to a minimum. Over-population? There is
none. People are made in the laboratory as they are needed. Their
lives are uncomplicated by animal problems such as reproduction,
and artificial customs such as modesty. Their education is simplified
and factual, their lives functional."
"And I made that decision all by myself?"
"Yes. That's why I have brought you here—to get you to change that
decision. You see, I must change the past. I must do that in order to
correct the future, make the other Earth a sane place, dominated by
a second Cyberene which is a counterpart of me."

"That's what I thought," Earl said with reckless boldness. "I'm


beginning to understand why I made my decision to suppress the
identity of the nerve substance. You did that. The things I've seen.
You're just like dictators of our time. You think you're so right that
everyone will naturally agree with you. I don't. I think it's more
humane to let people come into the world as they will and have wars
that destroy them, than to decide just how many are to be born. You
need a new man in the garbage disposal plant in twenty years? Press
a button and he will be born in a few months. Going to have less to
do in some factory in twenty years? Keep the zombies from being
born. Less trouble than killing them off later to save on the food bill."
"I was afraid you might feel that way," the Cyberene said. "I have the
answer to it. Nadine Holmes. Make an accurate report tomorrow on
the tests. In return I will leave her in your time—even plant directives
so that she will always be a loving and devoted wife to you."
"I would prefer her as she is, naturally."
"Today her every outward manifestation was under my direct mental
control. Don't you see, Earl Frye? Just before you followed her into
my neatly laid trap to get you here, you watched her come up the
hill, and adored every line of her, every mannerism, every play of
expression. With one small corner of my mind I can anticipate your
wishes and fulfill them in her—"
"It wouldn't be her," Earl said shaking his head. "And even if it were,
at the cost of billions of unborn generations? No."
"But you will do as I wish whether you wish to or not. Why not obey
me freely and get this reward, rather than nothing?
"I can control you." The voice ended triumphantly.
"No!" It was a shuddering protest from Earl's lips, forcing itself out
against his wishes.
The throbbing ache at the base of his brain increased abruptly,
slowly, to measurable beats.
"I can control your body, your conscious mind, shoving you into the
back recesses of thought. And when you try to come out, I can
punish you—like I'm doing now."
"No!" Earl screamed, his reserve breaking down completely.
Suddenly, into his cosmos of unbearable suffering and horror, filtered
a thought that created hope. Nadine had been free during those first
hours he had met her. She had defied George Ladd. Unsuccessfully,
but she had defied him. And when they had sprawled through that
doorway to the future, for a moment he had seen that same free
Nadine in her eyes, her expression. Or had she ever been free? The
terrible throbbing pain blurred his thinking. Had she been free in the
smelter where she attracted his attention while the others
surrounded him? If he had run directly to her he would have escaped
being surrounded. But....
Anger entered his mind like a little finger of thought. Anger at
Nadine? He was surprised. Confused. Then it came to him that it was
not his anger. It came from outside. Alien.
From the depths of his own instincts fear welled up and became blind
panic, fighting against the something that was growing stronger,
crowding around his soul, forcing it to retreat within itself, until Earl
Frye, his awareness of being Earl Frye, of being himself, was all that
remained, helpless to control or even to feel.
Through a mental fog he was aware that he had stood up, the glass
cage had lifted, and he was free to go—but not he! His body was
controlled by the Cyberene.
He was aware that he had left the dome to walk through a beautifully
landscaped garden to a building he had not seen before but which he
knew to be the 3042 end of the time tube. He was aware of pausing
and looking back at the Dome, now a thing of incredible beauty to
him, the repository of his physical vehicle, the Brain. But not his. The
Cyberene's.

He entered the time tube. He stepped from it onto grassy ground. He


went through the trees to the sidewalk. He returned to the lab
building, to his lab, to his living quarters.
He encountered Basil. He listened to himself talk, in casual tones,
normal tones. He was unable to control even his conscious thoughts.
But his consciousness was a thing apart from him.
He fought the domination of the Cyberene with arms that would not
move, with a tongue that would not utter his words, with a rage that
would not alter his calm and pleasant expression. He fought the pain
that throbbed within him. He fought to stay sane.
Slowly he began to adjust to his position. He no longer fought. He
was like a passenger in a plane who watches it take off, fly great
distances, and land, with no concern about the details. Having no
control whatever over his body, he was free of responsibility toward
its routine behavior. He became aware that pain had departed. The
very thing he had fought began to interest him. There must be some
definite mechanism—property of the mind—that made telepathic
enslavement possible in this way. Undoubtedly Nadine was also a free
focus of thought behind her enslaved surface.
She came into the lab at ten o'clock, cheerful but impersonal. He
heard himself talking to her in the same way. He could see her, listen
to her. Therefore, behind her impersonal eyes was the Nadine he had
first met, watching him, knowing what had happened. It gave him
comfort to know that. He had not lost her. She was there.
Knowing that, and knowing there was no way to communicate with
her at present, he turned his attention to what her body and his were
doing.
"The silicones haven't been explored too thoroughly yet," she was
saying. "They have some disadvantages, but those can be eliminated
by additions to the ion rings to serve as protective buffers. I have
several of them in this tray I brought in. I'd like you to run them
through the tests."
Earl's eyes focused on the tray. They paused briefly on the formula of
the third one from the nearest end. Earl sensed that this was the long
sought for substance. He built up its theoretical structure. He saw at
once how it achieved its properties.
"I'll be back this afternoon," Nadine said. "By then you should have
your lab reports ready."
Then she was gone. Earl's hands went through the motions of
pouring each vial into a pump. He turned his attention away from the
routine, as a traveler in a passenger plane might turn from the
window to something else.
A feeling of hopelessness grew within him. How could he stop things
or interfere with them when he couldn't affect a muscle?
The Cyberene had been playing with him when it tried to get him to
do its bidding of his own free will. He realized that now. It would
have pleased its vanity if he had.
But this was too important to it for it to trust anything other than
itself.
When it was done? When the fluid was forced into the hundreds of
thousands of miles of hair-like glass tubing, the billions of fine glass
cells? It would never give him his freedom. It would be afraid of what
he might be able to do. So it would kill him.
Unless he could prevent the Brain from being activated. And unless
he were free to command his body, he could never do that.
What had the Cyberene said to him about time travel and alternate
time streams? The theories weren't exactly new. They had been
explored in imaginative fiction for over fifty years. No one had really
thought there might be some basis in fact for the theories.
What had caused the "split" which had produced two Earths in
separate time streams? The Cyberene hadn't seemed to know that
detail—or if it had it had brushed over it casually so as not to make
him curious about it.
Was it events? Or was it something in the basic substratum of matter,
and the events were the result? That might be an important
distinction.
If it were events, then bringing the Brain to life in this time stream
might eliminate the divergent streams, bringing them together as
one. That, in effect, might destroy the other world of 3042 A.D.
Maybe that was what the Cyberene intended.
But suppose he were able even yet to defeat the Cyberene's scheme.
Then the two time streams would remain unchanged. The free world
of the future would remain free. But that was not enough. He wanted
to destroy both Brains. How could he accomplish that, assuming he
were able to accomplish anything?

The logical time to do it would be in 1980—now—before the


Cyberene gained control of the world and made itself impregnable.
But how? And if he could figure that out, could he act if an
opportunity arose?
Irene Conner came in at lunch time. "I had a wonderful time with
Basil last night," she said.
"I'm glad you did," Earl heard his voice say.
Hope leaped within him. Maybe the Cyberene would make some
mistake that would arouse suspicions in her. The hope died as the
door to the hall opened again and Nadine came in.
"You promised to take me to lunch, Earl," she said.
"Ready," Earl heard himself say.
It was evident that the Cyberene didn't intend him to be alone with
any of the others long enough for the possibility of something
suspicious to arise.
They went to a small cafe several blocks from the lab building. For
the benefit of anyone happening to be looking at them, they carried
on small talk while they ate. Earl found himself hanging onto every
word Nadine uttered, watching her every expression. He was so close
to her, yet so far away. It was like standing outside a window and
watching her while she seemed unaware of him.
He kept watching for the faintest flicker of expression that would
show the real Nadine. Slowly, without quite realizing it, he began to
pretend it was Nadine. He listened to her small talk. He listened to
his, and at times forgot it wasn't actually his and that he couldn't
control one word of what he said.
He became happy. He let himself be aware of the flavor of the food.
He laughed within himself when his vocal cords laughed. He reached
out and touched Nadine's hand, thrilling to the feel of her soft skin.
She drew her hand back, a startled light in her eyes. It was gone the
next instant. Once more she was impersonal, controlled.
The dull, throbbing pain flared to torturing intensity within him,
blurring thought, punishing him, forcing him behind his prison walls
of gray mental fog. But through the pain, apart from it, he
experienced a surge of hope. It had been he who had reached out to
Nadine. Not the Cyberene controlling him!
Was there still hope? At two o'clock Nadine would pick up his lab
report sheets and turn them over to Glassman. Then the identity of
the ideal nerve fluid would be known. It would be out of his hands
even if he were in full control of his faculties.
He and Nadine rose. They were going back to the lab building. He
raged against the hidden mental barriers that contained him. He
fought frenziedly to influence some slight movement of his body.
He might as well have been a passenger on an ocean liner trying to
change the course of the thousands of tons of steel by thought alone
while standing at the rail.
His sphere of awareness grew clouded. He was raging against a
mental wall that became almost tangible. He stopped fighting from
sheer impotence—and the barrier retreated.
The more I fight the more helpless I am. That thought at once
created its corollary. The less I struggle the closer I am to control!
That was it! He had so identified his desires with the actions of his
body that for one instant he meshed with it!
That, then, was the secret. The principle. But it contained within itself
its own difficulty. By "wanting" to activate the Brain he could perhaps
actually control some of his actions. But the instant he did something
counter to the Cyberene, that control would be taken away from him,
and replaced by throbbing pain.
He had touched Nadine's hand though. It had been a gesture so
unconscious that the Cyberene had been unaware of it until it
happened.
It was the right direction.

The possibility of what he wanted to do filled him with a sense of


defeat. It would be impossible to falsify the lab report on the nerve
fluid. One false word on the card, and the Cyberene would erase it
and fill the card out correctly.
He fought back the feeling of futility. He reached out, identifying
himself with every sensation from his body. He was walking. He
wanted to walk. He was talking. He wanted to say what he heard
himself say.
It would go along well, and then his body would do something he
didn't expect, and he would be filled with the realization that he had
no control. It would be a mental stumble while his body didn't falter.
During each brief period of identifying his desires with his actions, he
found his awareness of sensations expand until it was almost
complete identification—complete meshing.
Meshing until the gears were almost strong enough to grip—for a
brief second. Perhaps in time they would grip for more than a second
before alarm bells rang for the Cyberene.
He was alone in his lab. He was placing the fine tubes of test
substances in their respective instrument cabinets. Ordinarily he did
this almost automatically. Now he watched his every move, building
up interest in it, desiring to do everything he did, anticipating what
he would do next and wanting to do it, pretending it was he who
issued the commands to his muscles.
The crucial moment was just ahead. He had stepped to the
instrument case that held the key fluid. He started to write down the
readings from the instruments. His fingers shook, and it was his
nervousness that shook them.
A "mistake" in the readings here and there would do it. Speed of ion
travel: The meter said two thousand plus feet per second. His fingers
wrote the two and a zero. Before he could write the second zero he
tried to write the plus sign. Triumphantly he saw his fingers obey his
will.
Abruptly they paused—and he was aware that a power outside his
will had made them pause.
Throbbing pain surged up to full intensity, enveloping him, sickening
him so that his soul was a writhing thing, unable to think or feel
anything other than pain. Slowly it lessened—or was he growing
better able to suffer it? Thoughts filtered in to him through gray mists
clouding his mind.
He saw his hands fill out the rest of the card correctly. He was dimly
aware of rushing excitedly from the lab, down the hall, shouting that
he had found it.
Others were joining him as he hurried to Glassman's office and burst
in, waving the card.
Glassman seized it, his eyes afire with the fulfillment of his Dream.
And it was too late. Too late now to erase the knowledge of the
identity of that fluid from Glassman's mind, from the minds of the
other nine scientists crowding around him, congratulating him.
It was too late.
That realization crowded out everything else. The Cyberene had won.

"We want to put it through every test conceivable," Glassman said.


"All ten of you drop everything else and work on it. Get the speed of
impulse down to the last fraction of an inch per second. Get behavior
in different sized tubes. Find the least diameter of the fluid column
for non-function. Everything. We want to be sure before we start
pumping two hundred and fifty thousand gallons of the stuff into the
Brain."
Dr. Glassman's eyes were afire with the triumph of success. "The
dream of my life has come true," he said. "The Brain will live! It will
live forever, growing wiser than any man or any group of men. It will
remake the world. Civilization. It will end wars. It will guide mankind
into a garden of Eden. Utopia. It was my dream for mankind."
He became aware of those watching him. The fire of fanaticism left
his eyes. He relaxed, and laughed embarrassedly. "But right now
congratulations are in order for Dr. Frye. He's the one who has found
the substance that makes it possible."
Nadine had been standing quietly on the sidelines, almost forgotten
in this moment. She came forward now and extended her hand.
"Congratulations, Dr. Frye," she said.
It was for effect. Earl heard himself say, "Maybe you are the one who
should get the credit." He paid little attention. It was a show, an
opera, and his body and hers were players reciting lines from a script.
But her hand in his was warm. He clung to the feel of it, thinking
bitterly that now there was nothing else. What would become of him?
He didn't care.
He sunk into a mood of utter defeat. It was all the worse, he realized,
because right now, if the Cyberene had not come into the picture, if
he had been left to himself, he would be deliriously happy—just as his
own exterior self was seeming to be.
After a while he was back in the lab. His body was working on more
elaborate experiments with the fluid. His vocal cords were humming a
tune in a tone of absent-minded happiness.
He wished fervently that there were some way he could be wiped out
completely. Gray walls around his awareness were not enough. Not
with the unbearable suffering.
The hours passed slowly for him. He tried not to think, to remain
passive. It was no use. His bitterness was too strong. His sense of
defeat was too overpowering.
His eyes glanced up at the door as it opened, then down at his wrist
watch. It was three minutes after five. Nadine was in the doorway.
"It's time to go Earl," she said.
Go? Where? But his body hastily putting things in order as though it
knew.
They left the building together, walked along the sidewalk as though
they might be headed toward some dinner rendezvous. They left the
sidewalk, and then Earl knew. They were going to the entrance to the
time tube. They were going back to the year 3042. Why? He should
have remained. Maybe this would create suspicion. But even as he
thought that, he knew it wouldn't. Everyone would think he and
Nadine were at some restaurant, perhaps later at some night spot.
No one would bother to check and see if he came back to his rooms.
Ahead was the clear spot with its smooth convex depression. And the
shimmering refraction in the air. Side by side he and Nadine walked
toward it—and were in a corridor, the woodland scene wiped out.
No unusual sensation of any kind. Stepping across a thousand years
was no different than crossing the threshold of a doorway.
George Ladd was there waiting for them. "The Cyberene wants to see
both of you," he said. Nothing more. No paralysis gun, no guards to
keep Earl from escaping. But he couldn't escape. He couldn't move a
muscle of his own volition. "Okay," he heard himself say casually.
He and Nadine left the building and went through the beautiful park
to the Dome. Inside, they walked along the seemingly roofless
slightly curving corridor. He went to a small red square and stood on
it. Out of the corner of his eye he saw Nadine do the same. From
above, the glass boxes were lowered over them.
Something left him. Without having tested the feeling, he knew that
he was in full possession of himself. He could command and his body,
his voice, would obey.
He turned toward the glass wall facing Nadine. He pressed against it.
She was doing the same.
"Nadine!" he said, and it was a greeting, a caress.
"Earl!"
And they were drinking in one another with their eyes.
"Very touching," a voice said. "One would think you are in love with
her, Earl Frye."
"Oh no. I—That is...." Earl stopped in amazement at the self
revelation.
"Look at her," the Cyberene's voice said. "In spite of most careful
conditioning starting in the lab tank in her pre-breathing stage, she
feels the same way about you."
Nadine's lips were trembling with a smile. She was nodding.
Earl was irritated. "Did you bring me here just to tell me that?" he
asked. "Or to torture me further?" he added bitterly.
"No. I brought you here to show you that I'm grateful. You did what I
wanted done. The fact that it was done in spite of you makes no
difference. It's done and can't be undone by you. You realize that?"
"To gloat. I might have known," Earl said contemptuously.
"Not that either. I want to reward you. I've thoroughly explored your
mind. I know that if you give your word, you will keep it. I
understand a little about your feeling on personal freedom. Now that
the vital fluid is known to enough people so that nothing you can do
would undo that, I'm willing to let you have Nadine. The real
Nadine."
"Yes?" Earl said warily.
"Yes. All I ask in return is your promise not to try to undo anything,
and to go ahead with your work without ever mentioning what has
happened. Once you give your promise, I will let you and Nadine go
to your time and stay there, free agents."
Earl frowned. "I don't get it," he said. "I didn't expect anything like
this from you."
"You thought that after I had by-passed you and accomplished my
purpose I would eliminate you?" The Cyberene laughed. "You will find
that I'm a very benevolent master." The video eyes seemed to glisten
with joviality.
"I still don't get it," Earl said, puzzled. "You want my word that I
won't interfere with anything you do from here on in."
"Yes. After all, there is a lot to do yet before the Brain in your time
stream is activated. I must—"
"So!" Earl interrupted. "According to your theory of time that you so
carefully explained to me, the discovery of the vital nerve substance
should have fixed up everything. It didn't."
"The Brain hasn't been activated yet in your time stream. When it
has, then the future will reshape itself."
"I want to understand," Earl said. "As I understand it, some act,
some crucial act, must be changed from the way it happened in the
past—in my future in that past. Until that crucial moment is changed
from the way it happened, all the future stemming from it remains
unaltered. The instant that crucial moment is changed, presto—the
whole future from 1980 right down to 3042 does a mighty flip flop
and right here and now, in that other Earth so close to this one,
things will change as abruptly as the change of scene on a screen."
"That's correct."
"Then getting my lab reports correct wasn't the thing. There is still
something to come, back there, that must be changed? In spite of
everything up to now, you are still facing defeat? That's why you are
willing to offer me so much?"
"You misunderstand my motives," the Cyberene said.
"I don't think so. You aren't dealing with a mind-slave now. You may
be non-human, but you're a thinking mind. You have desires, motives
for doing things, ways of doing them. In other words, you're a type.
In offering me everything I want, you're out of your type—unless
there's something you want that you can't get any other way. When I
came in here I was licked. All I wanted was to die. Now I'm not so
sure. I'm not even sure you know what you're doing. I have hope. Do
you understand that?" Earl was trembling violently, a mixture of
emotions coursing through him. "I'm going to destroy you before I'm
done. You're going to take control of me again and try to prevent

You might also like