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 David Totzke on Jun 07, 2006
Nemerle provides the ability to mix object-oriented and funtional programming techniques which can be quite handy in some problem domains. The top-level program structure is OO but in the body of the program you can use (but are not limited to) a more funtional style. Functional values, variants and pattern matching are some of the features that enable this.
Functional Values
Functional values allow you to pass functions as arguments of other functions as well as pass them as a return value. They are similar in nature to C# delegates.
Variants
Variants are similar to the C# enum. The easiest way to demonstrate this is by example:
variant RgbColor { | Red | Yellow | Green | Different { red : float; green : float; blue : float; } }
In this case, if the color is not red, yellow or green, it can be represented by RGB values.
Pattern Matching
Pattern matching is described as being similar to the C# switch statement on steroids and is used to simplify working with variants. There are many types of patterns offered and you can do some powerful things with them. Check out this section of the Grokking Nemerle tutorial for examples of their use.
Other Important Features
Other features in Nemerle are intended to simplity the life of the programmer. This is where macros and type inference fit in.
Macros
Macros in Nemerle are much more than boiler-plate code expansions. Macros in Nemerle offer code generation with additional static checks by the compiler. One compelling example is the use of the SQL macros. With them you can write:
ExecuteReaderLoop ("SELECT firstname, lastname FROM employee WHERE firstname = $myparm", dbcon, { System.Console.WriteLine ("Name: {0} {1}", firstname, lastname) });
Instead of:
string sql = "SELECT firstname, lastname FROM employee WHERE firstname = :a"; NpgsqlCommand dbcmd = new NpgsqlCommand (sql, dbcon, dbtran); dbcmd.Parameters.Add("a", myparm); NpgsqlReader reader = dbcmd.ExecuteReader(); while(reader.Read()) { string firstname = reader.GetString (0); string lastname = reader.GetString (1); System.Console.WriteLine ("Name: {0} {1}", firstname, lastname) } reader.Close(); dbcmd.Dispose();
The macro doesn't simply hide functionality away in a library. Work is performed by the compiler to evaluate the query string, variables used, and the columns that will be returned by the query. It will also connect to the database at compile time to verify that your query actually makes any sense.
Type Inference
Ruby afficianados will no doubt understand this concept already. Why declare the type of your variables when in many, if not most, cases the compiler can figure out (infer) the types. A simple example will make help to make it clear.
Why write all of this: Dictionary<string, int> d = new Dictionary<string, int> d.Add ("Ala", 7); foreach (string s in args) { ... } When this will suffice: def d = Dictionary (); d.Add ("Ala", 7); foreach (s in args) { ... }
Nemerle is certainly something to keep an eye on.
Troubleshoot Java/.NET performance while getting full visibility in production
Automating Error Reporting for .NET Applications
RDBMS to NoSQL: Managing the Transition
Visual Studio vNext: ALM features for Agile Planning, Team Collaboration
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.
No comments
Watch Thread Reply