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 Jonathan Allen on Jul 03, 2007
Marek Safar has announced that the C# 3.0 compiler for Mono now supports implicitly typed local variables and implicitly typed arrays using a technique known as type inference.
In C-based languages like C#, it is common to use the redundant "type variable = new type" pattern. When the type names are long or are changed frequently, this can become quite tedious.
C# 3.0 eliminates much of this redundancy by introducing the "var" keyword. This allows developers to omit the variable type without sacrificing static typing. The compiler determines the correct type based on the static type of the expression to the right of the equals sign.
A key point here is that C# is still early-bound and statically typed. This does not open up C# developers to the kinds of problems associated with late binding in Visual Basic such as missing method exceptions caused by spelling errors.
While nice to have, type inference was not added just to make typing a bit faster. It is a necessary feature for anonymous classes, which are heavily used by LINQ. Since anonymous classes do not have a name, there is no way to create variables of their type in C# without type inference. (VB does with late binding, but again that opens the possibility for missing method exceptions.)
There are two type inference features supported by C#. Implicitly typed variables and implicitly typed arrays. Both work fundamentally the same way, at compile time the keyword "var" is replaced with the correct scalar or array type for the associated expression.
Type inference is not allowed in cases where the variable is not assigned a value on the same line it is declared. While this is technically possible, it would introduce a level of complexity that the C# compiler team probably does not want to address.
Marek Safar mentions two other areas where type inference is not allowed.
Also as the name says, implicitly typed local variable, you cannot use var for field declaration or constant variables, therefore following declarations will both produce a compiler error.
I am not sure why there are such limitations but I am probably missing something.
Note: Technically speaking, anonymous classes have names that are generated by the compiler. However, the names are not necessarily predictable and should be considered an implementation detail. Or in other words, it is safer to pretend they do not have them at all.
Automating Error Reporting for .NET Applications
Visual Studio vNext: ALM features for Agile Planning, Team Collaboration
Troubleshoot Java/.NET performance while getting full visibility in production
RDBMS to NoSQL: Managing the Transition
The WebSphere Liberty Profile for Developers: An Introduction
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