DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Effortlessly Streamlining Test-Driven Development and CI Testing for Kafka Developers
  • Auditing Tools for Kubernetes
  • The SPACE Framework for Developer Productivity
  • A Complete Guide to AWS File Handling and How It Is Revolutionizing Cloud Storage

Trending

  • Effortlessly Streamlining Test-Driven Development and CI Testing for Kafka Developers
  • Auditing Tools for Kubernetes
  • The SPACE Framework for Developer Productivity
  • A Complete Guide to AWS File Handling and How It Is Revolutionizing Cloud Storage

HTTP and Scalable Software Systems

Thomas Hansen user avatar by
Thomas Hansen
CORE ·
Jan. 08, 20 · Opinion
Like (3)
Save
Tweet
Share
8.52K Views

Join the DZone community and get the full member experience.

Join For Free

If you think about the World Wide Web, it's easy to imagine it as a single software system. Once you do, you realize it's the largest software system the world has ever created — probably by hundreds of orders of magnitude. It contains trillions of lines of code, hundreds of millions of servers, and billions of clients, running thousands of different programming languages. Still, it works more or less as we expect it to work. So, what made it possible for humans to create such an enormous software system? The answer is simple: HTTP!

The HTTP protocol allows us to create perfect encapsulation. The client and the server don't need to know anything about each other, besides the URL, HTTP verb, and what parameters to pass in and expect as output. This allows billions of clients to interact with each other, without knowing (almost) anything about each other. If you reduce it down to its basic components, it becomes painfully obvious that the following is a recipe for winning.

  1. Magic strings (URLs).

  2. Generic and untyped payloads (JSON).

  3. A DNS transforming URLs to a physical address of some client/server.

You may also like: The HTTP Series (Part 1): Overview of the Basic Concepts.

They Lied to You!

The funny thing is that this contradicts some 60 years of software development theory, with strong typing, rigid classes, OOP, etc., where everything should be known at compile time. If anything, the Web's success is based upon completely ignoring every single "best practice" we as software developers have taught ourselves over the last 60+ years.

The paradox is that the above recipe, can also easily be implemented internally within our own systems. Just throw away OOP, forget all about static and strong typing, and invoke your methods as "magic strings." You'll never again experience complexity problems, with entangled dependencies, making it impossible to create a software system above some threshold of complexity, without reducing it to a big ball of mud. Imagine the following pseudo-code:

Plain Text
xxxxxxxxxx
1
 
1
/*
2
 * This is a method invocation, based upon a "magic string".
3
 * The parameters to our invocation is basically a graph object
4
 * Think "JSON" here ...
5
 */
6
"foo.bar"({someUntypedGraphObjectGoesHere})


All of a sudden, there are no dependencies between the place in your code where you are invoking a function and the place where you have implemented the function. There are no strong types transferred between the caller and the method, and nothing is shared, except a mutual agreement of what data to provide and return. Your dependency graph has been effectively reduced to ZERO! No OO, no problems!

All of a sudden, an in-process method invocation has been completely decoupled from the underlying method, and you have all the scalability features internally within your process, as you have with the HTTP standard. This results in software systems with the same amount of complexity as the Web, without experiencing scalability problems that normally occur long before you reach this amount of complexity.

Isn't This SOA?

No. Service Oriented Architecture is based upon having multiple servers, and/or processes. This is completely in-process. There's no need to fiddle with socket connections, server configurations, or anything that creates added complexity. In fact the "DNS" of the above "Magic string method invocations" is a simple dictionary, resembling the following:

Plain Text
xxxxxxxxxx
1
 
1
Dictionary<string, Type> _dns;


Then, you look up a type from your "DNS," like the following, and instantiate an instance of an interface, making it possible to invoke your loosely coupled function.

Plain Text
xxxxxxxxxx
1
 
1
var type = _dns["magic-string"];
2
var instance = services.GetService(type) as IMagicStringType;
3
instance.InvokeLooselyCoupledMethod(/* ...arguments... */);


At this point, all you need is a Node class, capable of passing around arguments — basically the equivalent of JSON for C#, something resembling the following:

C#
xxxxxxxxxx
1
 
1
class Node
2
{
3
  public string Name { get; set; }
4
  public object Value { get; set; }
5
  IEnumerable<Node> Children { get; set; }
6
}


Your dictionary becomes your "DNS," the magic string becomes your "URL," and the Node class becomes your "JSON." This allows for completely independent modules to interact with each other in the same way that the HTTP standard allows completely independent servers to interact with each other, completely eliminating every single dependency between your two components in the process. And as to the speed of this? Well, it's a simple dictionary lookup and an IoC dependency injection invocation. It's more or less the same speed as anything you're already doing in your .NET applications.


Further Reading

  • A Systematic Approach to Write Better Code With OOP Concepts.
  • The HTTP Series (Part 2): Architectural Aspects.
  • A Brief History of TLS.
Software development

Opinions expressed by DZone contributors are their own.

Trending

  • Effortlessly Streamlining Test-Driven Development and CI Testing for Kafka Developers
  • Auditing Tools for Kubernetes
  • The SPACE Framework for Developer Productivity
  • A Complete Guide to AWS File Handling and How It Is Revolutionizing Cloud Storage

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: