Modular : Detach from your Environment

03 Jun 2015

Modular : Detach from your Environment

Being modular, is definitely one major aspect of good software design, modularity allows us to have alot of freedom within the constraints of the module. UItimately designing the “module” causes us lots of pain. The cost primarily being decision making. Making the critical decisions as to what should remain seen, and what should remain unseen, which piece of code should have access to which system, without making the encapsulation so narrow as to bleed out your internal implementation in the communication protocol. Yet we commit to modularlization because we know that its better than having one nested web of mess.

Right now , I’m using Docker and Elasticbeanstalk to build webservices. I’m modularlizing the computational unit, the application environment.

In the past prior to linux containers, I’ve constantly had to deal with application environment bleed. I define application environment bleed as the applications dependence on running in a certain environment to achieve its desired behavior. An example of application environment bleed might be a background worker process that requires a specific version of libpgp, where the worker process doesn’t have the ability to include the lib in the system library path. What hurts about this situation is that It is often times that a set of libraries , packages, environment variables, etc… drift . Most times it doesn’t just drift, it drifts silently until there’s a runtime error or an edge case is hit.

These external dependencies means that the applications modularity is hurt. It is now not as portable extensible as it could be because of the application environment bleed. Enforcing environment is hard, I’ve developed on ancient closed VMS systems, AWS systems, with Chef, deployment systems that had strict rules about only installing binaries that had top level config files. The problem with all of these systems is the humans.

Enter Docker, Docker aims to make it simple to leverage linux containers to modularlize the computation unit. Essentially containers functionally are like lightweight virtual machines, that make it possible to run as many different basic linux kernels with the libraries and packages your application needs. So you get to enforce the right level of encapsulation for your application. No more application environment bleed , simply wrap your application into a container and deploy.

comments powered by Disqus