EasyRPC. Be proud of your APIs (First Part) 🤓🚀

Whether you are a front or a back developer, it’s quite likely that you already know about Web APIs. You may be consuming themproviding data with them or both. Web APIs are a key part on most projects, and they have been with us for long timeTheir evolution has been quite interesting, passing from complex and intricate architectures that boiled our brains to their current stateOver time, it seems that the development community came to an agreement on how Web APIs should work, and now almost everybody has a sense of what they are and how deal with them. They tend to be “RESTful”, that is, stateless, and exchanging JSON messages over the HTTP protocol.  

Our mission as developers 

As developers we always should do things right, but not only right, but better than it. 

We’re always should try to do more with less, while trying to keep everything as simple as possible. We’ll talk about programming principles in another post. 

That’s why we shouldn’t just adopt everything blindly. There may be a better way to do our stuff, and that’s what we call continuous improvement. 

And here is where I wanted to go 

Current Web APIs are rigid and constricting.  

They clearly leave room for improvement. A lot. They are outlandish, inappropriate artifacts. They are aliens inside our code. 

Our Web APIs don’t shine 

It’s exactly that. We are introducing an unnecessary layer that essentially forces HTTP to adapt to a programming paradigm it wasn’t designed for.  

Adapt, improve 

 

Pain points

Calling a Web API is boring and sometimes painful because interfaces tend to be unclear, operations aren’t clear enough or they don’t fit well into the HTTP way of thinking.

Calling Web APIs often require clients that need to be configured. Regarding the code, the server part is ugly, and the client side is, too.

  1. You need to figure out how your methods fit with the GET, POST, UPDATE, DELETE methods.
  2. If it’s GET you will have to plan where in the URL are your parameters. Having to do it on your web layer is inconvenient.
  3. You will spend too much time having to deal with URL routes a mapping.
  4. Most methods are just entry points that do nothing but delegating the real actions to a service.
  5. Testing controllers can be a nightmare.

Services should be called with zero pain.

A new approach. Here we go!

Let’s do things differently. Let’s do things more naturally, fluent and terse.

We need something to fill the gap, to ease the pain, to communicate more elegantly among application boundaries.

What if you just had to call a web API service like you call any other class? What if you could stop creating Controllers to deliver our stuff?

EasyRPC is here to heal your soul. It makes your service work like if it was just another local service of your application.

var result = mathService.Add(1, 3);

Pretty conventional, isn’t it? Except for the fact that the service is a remote service.

The client side is beautiful, but the server side is pure goodness.

public class MathService : IMathService 
{
	public decimal Add(decimal a, decimal b) 
	{
		return a + b;	
	}	
}

Nothing more, nothing less.

EasyRPC = Easy + RPC

EasyRPC lives up to its name. For those wondering, RPC stands for “Remote Procedure Call”, a technology that enables calling service methods like they were local services.

The interesting thing is that you can just ignore anything you had in-between. As soon as you write a service, it’s ready to be used. Zero boilerplate. No waste.

Application boundaries are way less of a concern because you don’t ever have to think in all the extra code that conventional Web APIs require, that always end up having sharp edges across layers.

EasyRPC does all the heavy lifting. It just works®

Benefits

Pay close attention, because using it you will automatically get all of these benefits:

  1. EasyRPC removes the need to think about URL construction, parameter passing, or choosing which HTTP verbs to use, allowing the developer to focus on business logic.
  2. It integrates with smoothly with ASP.NET Core authentication framework so that authorization attributes are honored as well as other authentication primitives.
  3. It has built in documentation similar to Swagger, but with no external dependencies 😊
  4. Filters, that provide cross-cutting support for things like transaction commit/rollback, logging, etc. Very similar to MVC filters.
  5. Clients are generated at run time based on interfaces, allowing the developer to access services without having to write any HTTP code. This is simply awesome.
  6. Supports inbound and outbound compression (Gzip, Brotly)
  7. Can be expanded to support encodings other than JSON to things like MessagePack or ProtoBuf

We believe that this way a coding feels so natural that, once you have created your first service, you won’t want to go back 😉

But that will be part of our next post, where we will show you the real working code.

Stay tuned!

Written by: José Manuel Nieto, part of Idiwork’s team

Step by step

Idiwork has arrived and we invite you to join us!
Raspberry Pi4 – All of a sudden!
Experiment #101 How to set up an IoT device in Azure IoT Hub
Start your own video game with Unity3D and CreatorKits
Experiment #101 How To Create a Blockchain Workbench App
XR World: Minecraft Earth
Experiment #101 Architectural Diagram
Cyberpunk 2077 and The Future
Experiment #101 How to create an Azure Function App to record telemetry readings
An Introduction to neural networks
Microsoft Mixer, streaming your life !
Introduction to Azure Notebooks applying Cognitive Services with Jupyter
AR [T] Walk
Return of Age of Empires
Idiwork and Uno Platform partnership!!
The differences between Augemented Reality, Mixed Reality and Virtual Reality !
Experiment #102 How to Create an Azure Notebooks Project and Deploy a Summarization Service
Uno Platform Conference
YouTube Video: Creator Kits, learn how to create a RPG with Unity3D !! 🤖
Experiment #102 How to construct and train a Deep Neural Network using Keras and deploy the model as an Azure Web Service 🧠☁️
Uno Platform Conference Recap 😎
How to create a Uno Platform project in Visual Studio 💻🤓
What is a Neural Network? by Alberto Pinedo 🧠💻
Experiment #102 How to Deploy and Integrate Azure Cognitive Services: Computer Vision and Text Analytics 💻📑
Next stop: Madrid Games Week 👉🤖
Our Madrid Games Week experience ! 😎🤖
Experiment #102 How to use Microsoft Flow to send an email when an event occurs 📧📌
How to create your own controllers for Mixed Reality ToolKit 🎮🤓
Experiment #102 Architectural Diagram 📍
The magic of Hytale ⚔️
Start programming your own app in Uno Platform 📲👨‍💻
Avalonia, a big candidate to create cross-platform apps with XAML 😎📲
The value of Blockchain for business by Pablo Junco ⛓️🏢
Living in the night: Bloodlines 2 🧛🎮
Uno Platform Workshop Recap 💻📌
Paralives, reimagine your virtual life 👾👩‍💻
Experiment #103 How to Modify the Project to Work with Face Cognitive Service and Servo Motor 👩‍💻📙
Experiment #103 How to Set Up the IoT Device Hardware: Peripherals and Electronics 🔈💡
We are going to be in the GDG DevFest in Málaga! 😎👾
EasyRPC. Be proud of your APIs (Second Part) 🤓🚀
Experiment #103 How to Build a 3D Printed Box to Pack and Run the IoT Project 🚀
MediEvil, remember the fear💀
Never forget the Fallen Order 🏹🎮
Experiment #103 Architectural Diagram 📍
Grace: The perfect DI IoC container [part 1] 💻🤓
Death Stranding: a story of death and connection ☠🏹
Experiment #204 How to assembly the 3D printed parts and servo motors of the robotic arm 🦾🤖
TemTem: a dream come true 🐹💥
Grace: The perfect DI IoC container [part 2] 💻🤓
Exploring the Outer Worlds 🎇⚔
Our review from Hololens 2 👓👷
Learn to code on your iPhone for FREE 📲🚀
New life, new horizons in Animal Crossing 🎮🐱
What’s WinUI? 💻🚀
Half Life Alyx ☠🧟‍♂
How to deploy a Censorship Resistant Website for FREE 🔓🌎
Superpower: The parser combinator library [Part 1] 💻🤓
UnoPlatform and WinUI, what to expect? 🚀📲
Happiness begins in Stardew Valley 🍎🐓
Science fiction in Assassin’s Creed 👽
The Cyber Attack Lifecycle 🕵‍♀💻
Superpower: The parser combinator library [Part 2] 💻🤓
Learn more about UnoPlatform! 😜📢
Create cybernetically enhanced web apps with SvelteJS 💻👇
Six Fun Drag & Drop 🧩 Programming Languages To Learn How To Code! 💻
Riot and Hytale unite! 👾😉
A new home called EVE Online 👽👇
Rejoice with UnoPlatform! May 2020 📲👇
UnoPlatform arrives to macOS 💻👈
Your new empire in Civilization VI 🎮🏹
Play Station 5 is near!
Build and defend your city, this is Manor Lords
Customization, landscape generation and more in Hytale🧝🏻‍♀️🧝🏼
Welcome, MAUI! 💣📲
Zombies will be zombies (TLOU2) 👽🧟‍♂
Rejoice with UnoPlatform! August 2020 📲👇
Final Fantasy Crystal Chronicles is back🧝🏻‍♀️⚔️
Bolt is now free in Unity3D 🎮
Feel the Flutter! 🌐
Microsoft buys ZeniMax Media (including Bethesda!)
Intel and Microsoft team up to empower AI on Edge
Linux and WSL2 - Part 1 Linux and WSL2 – Part 1: How do you run Windows applications on Linux? Or vice versa.
Guide how to Run Windows applications on Linux Linux and WSL2 – Part 2: How do you run Windows applications on Linux? Or vice versa.
Domain-driven design Domain-Driven Design: the elephant in the room
azure object anchors Azure Object Anchors: the third tool
Experiment #205 Step by step 1 Experiment #205 Applied Artificial Intelligence, the real one 🤖📹
AI Assembling the system Experiment #205 Applied Artificial Intelligence – Assembling the system ⚙️🦾
Redit Conquer all the APIs Refit – Conquer all the APIs
Experiment #205 Applied AI: the Information analysis Experiment #205 Applied Artificial Intelligence – Analysis of the information
Brand Presence step by step 1 Blog Experiment #206 Brand Presence
Experiment #206 Brand Presence - The analysis Experiment #206 Brand Presence – The analysis

Stay up to date!



1 comment

Leave a Reply to Tony Henrique Cancel reply