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 Video Library
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
View Events Video Library
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
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

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Understanding Cloud-Native Application Protection Platforms: A Comprehensive Overview
  • Cloud Backends for Frontend Developers
  • Safeguard Your Cloud Native Applications: Empower Development With IBM Cloud App ID
  • Seamless Feature Release Without Deployment Using IBM Cloud AppConfiguration: An Alternative to LaunchDarkly

Trending

  • Supercharging Productivity in Microservice Development With AI Tools
  • How to Configure Istio, Prometheus and Grafana for Monitoring
  • Adopting Agile Practices for Workforce Management: Benefits, Challenges, and Practices
  • Unlocking Opportunities: The Advantages of Certifications for Software Engineers
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Building Cloud Agnostic Applications

Building Cloud Agnostic Applications

Matt Farina user avatar by
Matt Farina
·
Apr. 22, 14 · Interview
Like (0)
Save
Tweet
Share
8.62K Views

Join the DZone community and get the full member experience.

Join For Free

Vendor lock-in can be a pain. Imagine you've written an application to work against one cloud provider and now you'd like to migrate to another one. I've seen cases where the engineering and development work to make the change would cost more than any savings of running on the new provider.

Then there are those cases where you might want to migrate to or from a private cloud. Or, efficiently develop locally without a cloud system installed.

There's a way to design applications so that switching providers isn't such a hassle.

Deferring Important Decisions

When "Uncle Bob" Martin regularly describes clean architecture he notes,

A good architecture allows you to defer critical decisions, it doesn’t force you to defer them. However, if you can defer them, it means you have lots of flexibility.

Odds are you're building an application to run in "the cloud" rather that a specific cloud. I'm assuming you don't work for Amazon, Google, Microsoft, or one of the other cloud providers. Most cloud developers don't. Given this assumption, an application shouldn't assume a particular cloud and tightly couple to it. It's a decision that can be deferred in the architecture.

Use An Interface

Start with a well defined interface describing what you want to do. For example, an interface to save data.

interface SaveMyData {

    function save(array $data); 
}

When creating the interface don't copy the API to the cloud library you are using. Don't tightly couple to that API as it could change in a future version or there may be a time to move away from it.

On the interface only describe the functionality you need. It's easy to start describing all the features the initial implementation you have in mind can do. Describing everything will give you more software to write and maintain without providing something useful to the application. Add more features as the application needs them.

Note, when if comes to crafting interfaces consider using the interface segregation principle.

Create An Implementation

The next step is to create an implementation of the interface. For something like saving data I would likely create two implementations. One to save data to the cloud I'm using and a second one to save data locally. The option to save data locally would enable me to work on the application without interacting with the cloud itself.

This is where the ability to avoid vendor lock-in happens. When the time comes to switch cloud providers simply create and test another implementation of the interface using the new cloud provider. It's a far simpler switch.

Dependency Injection

How would you pass the appropriate implementation around an application? A common way to do that is with dependency injection. Using dependency injection the implementation can even be part of the configuration for the application.

Dependency injection is common enough there are already best practices for implementing it in most programming languages and frameworks.

application Cloud

Published at DZone with permission of Matt Farina, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Understanding Cloud-Native Application Protection Platforms: A Comprehensive Overview
  • Cloud Backends for Frontend Developers
  • Safeguard Your Cloud Native Applications: Empower Development With IBM Cloud App ID
  • Seamless Feature Release Without Deployment Using IBM Cloud AppConfiguration: An Alternative to LaunchDarkly

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

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: