Cloud Oriented Programming
Sharing the article on behalf of Vishwas Lele, Vishwas Lele Serves as CTO at Applied Information Sciences. He is a noted industry Speaker, an author and Microsoft Regional Director for Washington D.C. and is currently a Microsoft Azure MVP. It’s an honour to share his views from his personal blog with the C-Sharp Corner Community on his request.
For Reference See the Following Course on Pluralsight http://www.pluralsight.com/courses/cloud-oriented-programming
The public cloud is tomorrow’s IT backbone. As cloud vendors introduce new capabilities, the application-building process is undergoing a profound transformation. The cloud is based on key tenets such as commodity hardware, usage-based billing, scale-out, and automation, all on a global scale. But how does the cloud impact what we do as programmers every day? What do we need to do at a program level that aligns us with the aforementioned tenets? This course is organized into three modules which discuss a total of nine techniques designed to help developers make more effective use of the cloud.
A brief summary of the course is as follows.
This module will outline key principles that make up cloud computing and introduces the discussion on cloud oriented programming.
Exception handling and instrumentation
Be very careful about “tight loops” in your logic. The consequences may be more than just an unresponsive UI. You are likely to run up a hefty cloud usage bill. So whether you are checking for a message in the queue or reading a table, it is essential to build in logic that multiplicatively decreases (aka exponentially) the rate on invocation.
Reimagine the Exception Handler
It has been a best practice to only handle exceptions from which our program can recover. For all other exceptions, the guidance is to “rethrow” the exception up the call stack. But with the cloud (and DevOps), we now have the ability to provision new resources, or alternatively redirect the request to another data center in a different geographical location.
Logging Takes a New Meaning
We know the importance of logging in a complex distributed application. In the cloud, it becomes critical to have rich logging. But don’t create a hotspot by logging into a single repository. Instead, use diagnostics frameworks that allow you to log locally but transfer the logs to a centralized repository asynchronously.
Container, Microservices and Reuse
Try to encapsulate as much as logic as possible into a “container” that corresponds to the unit of scale and availability on the cloud platform – whether it is a Windows VM instance or a Linux group. Doing so will allow the platform to scale and be more resilient.
Decomposition is a well understood software design principle. The idea of breaking a business problem down into smaller parts that promotes not only “separation of concerns” but also the notion of reuse is indeed very worthy. Microservices are being seen as a way to decompose your cloud based applications.
Reuse is often cited as the Holy Grail of software development. In the cloud it takes on a whole new meaning. Easy access to prebuilt ML algorithms and cloud marketplace offerings increasingly available on the cloud platforms and are very easy to use.
Cost, Scale and Automation
Cost Aware Computing
Architects, PMs and IT folks are not the only ones that need to worry about the overall total cost of ownership (TCO). Programmers have an important role to play to keep the costs down – whether it is adequate “poison message” handling, exponential back off or tight memory management can all go a long way in keeping the TCO low.
Partitioning is the key to scalability
“Sharding” is not just for databases. In the cloud, consider the use of horizontal partitioning logic for something as low-level as a singleton (i.e. if possible, use a partitioned set vs. a singleton set). The best way to scale in the cloud is to embrace “scale-out” at the lowest levels of your code.
Infrastructure as Code
A new category of programs that developers are likely to write, when working in the cloud, is automating the provisioning of infrastructure that is needed to host the applications they build.
The cloud has ushered an era of “software defined everything” – network, storage, compute etc. Consequently, every aspect of a modern data center API is accessible, thus bridging the chasm between developer and operations that is commonly referred to as DevOps.