Cloud Foundry: Design and Architecture
Derek Collison discusses the goals, the design premises and patterns employed in creating the architecture of Cloud Foundry, VMware’s open source PaaS, unveiling internal architectural details.
The content has been bookmarked!
There was an error bookmarking this content! Please retry.
Posted by Abel Avram on Nov 12, 2011
Google has open source under Apache License 2.0 Closure Stylesheets, a utility belonging to the Closure Tools package and useful when dealing with CSS. Closure Stylesheets is a Java program adding variables, functions, conditionals and mixins to CSS, making it simpler to work with large CSS files. The developer works with Google stylesheets (GSS) that are processed by the tool which generates the actual CSS files used by a web application or a website.
Variables
Variables are defined using ‘@def’. Following is a simple example showing the use of variables:
@def BG_COLOR rgb(235, 239, 249);
@def DIALOG_BG_COLOR BG_COLOR; body {
background-color: BG_COLOR;
}
.dialog {
background-color: DIALOG_BG_COLOR;
}
The resulting CSS is:
body {
background-color: #ebeff9;
}
.dialog {
background-color: #ebeff9;
}
Functions
Closure Stylesheets introduces a number of arithmetic functions that can operate on numerical values, such as pixels: add(), sub(), mult(), div(), min(), and max(). An example of using these functions looks like this:
@def LEFT_WIDTH 100px;
@def LEFT_PADDING 5px;
@def RIGHT_PADDING 5px; .content {
position: absolute;
margin-left: add(LEFT_PADDING,
LEFT_WIDTH,
RIGHT_PADDING,
px);
The resulting CSS block is:
.content {
position: absolute;
margin-left: 110px;
}
Conditionals
Closure Stylesheets allows the use of @if, @elseif and @else in creating conditional branches based on the value of some variables.
Mixins
Mixins are constructs for reusing parameterized declarations as in the next example:
@defmixin size(WIDTH, HEIGHT) {
width: WIDTH;
height: HEIGHT;
}
.image {
@mixin size(200px, 300px);
}
Mixins are more useful when addressing cross-browser issues:
@defmixin gradient(POS, HSL1, HSL2, HSL3, COLOR, FALLBACK_COLOR) {
background-color: FALLBACK_COLOR; /* fallback color if gradients are not supported */
background-image: -webkit-linear-gradient(POS, hsl(HSL1, HSL2, HSL3), COLOR); /* Chrome 10+,Safari 5.1+ */
/* @alternate */ background-image: -moz-linear-gradient(POS, hsl(HSL1, HSL2, HSL3), COLOR); /* FF3.6+ */
/* @alternate */ background-image: -ms-linear-gradient(POS, hsl(HSL1, HSL2, HSL3), COLOR); /* IE10 */
/* @alternate */ background-image: -o-linear-gradient(POS, hsl(HSL1, HSL2, HSL3), COLOR); /* Opera 11.10+ */
}
.header {
@mixin gradient(top, 0%, 50%, 70%, #cc0000, #f07575);
}
Resulting in:
.header {
background-color: #f07575;
background-image: -webkit-linear-gradient(top,hsl(0%,50%,70%) ,#cc0000);
background-image: -moz-linear-gradient(top,hsl(0%,50%,70%) ,#cc0000);
background-image: -ms-linear-gradient(top,hsl(0%,50%,70%) ,#cc0000);
background-image: -o-linear-gradient(top,hsl(0%,50%,70%) ,#cc0000);
}
Closure Stylesheets can also be used to concatenate multiple CSS files into one and to minify them, it performs static checks on the syntax, knows how to exchange left values with right ones (RTL flipping), and how to rename classes.
Closure Tools is a set of utilities comprising Compiler, Library and Templates, used internally by Google for GMail, GDocs and Maps, and open sourced in 2009. These help dealing with large JavaScript applications.
Introducing SQLFire: a memory-optimized, high performance SQL database
Taming HTML5 and JS: High Performance Mobile, WebKit, FireFox Dev Tools @QCon New York
Building HTML5 Apps in Hours, Not Days
VMware vFabric SQLFire - Test drive the data management system with memory speed, horizontal scalability and a familiar SQL interface
Seems like Google's version of LESS or SASS:
www.infoq.com/news/2009/07/dry-css-less-yass
Except that their compilers/translators are written in JS.
Derek Collison discusses the goals, the design premises and patterns employed in creating the architecture of Cloud Foundry, VMware’s open source PaaS, unveiling internal architectural details.
Andrew Watson talks about the work of the OMG, where CORBA is alive and well (hint: in your car), UML and UML Profiles vs. custom Modeling languages, DDS and other middleware, and much more.
Sohil Shah discusses creating iPhone and Android enterprise mobile applications based on cloud services using the open source platform OpenMobster.
Paul Sanford presents the transformations supported by data throughout its life cycle, and how that can be better done with Splunk, an engine for monitoring and analyzing machine-generated data.
A common “best practice” for unit tests is to only write a one assertion in each test. I intend to question this advice by showing that multiple assertions per test are both necessary and beneficial.
John Rauser presents the architectural and technological evolution of Amazon retail websites starting with 1994 and ending with adopting Amazon Web Services.
Michael Stal discusses system architecture quality, how to avoid architectural erosion, how to deal with refactoring, and design principles for architecture evolution.
Every developer has had to integrate with another system, API or component. Tis article provides strategies to handle the change and for he separating system boundaries.
1 comment
Watch Thread Reply