Microsoft recently announced one of its upcoming project Codename Astoria at MIX '07. Astoria is an implementation of RESTful architecture to provide data services over HTTP without using any underlying Messaging services such as Web Services or SOAP. Before going in further details lets take a look at REST architecture.
Representational State Transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web.
“Representational State Transfer is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.”
— Dr. Roy Fielding,(def from wikipedia)
Systems that follow Fielding's REST principles are often referred to as RESTful;
Astoria: Data Services for the Web
Project Astoria consists of a combination of patterns, libraries and an online service that explores the concept of data services for the web. Currently, Astoria data services use relational databases as the underlying store, but in general the nature of the store does not surface in the Astoria interfaces.
The goal of Astoria is to facilitate the creation of flexible data services that are naturally integrated with the web. As such, Astoria uses URIs to point to pieces of data and simple, well-known formats to represent that data, such as JSON and plain XML. This results in the data service being surfaced to the web as a REST-style resource collection that is addressable with URIs and that agents can interact with using the usual HTTP verbs such as GET, POST or DELETE.
In order for the system to understand and leverage semantics over the data that is surfacing, Astoria models the data exposed through the data service using a model called the Entity Data Model (EDM), an Entity-Relationship derivative. This organizes the data in the form of instances of "entity types", or "entities", and the associations between them as described in the Astoria Overview document .
The URI addressing scheme used by Astoria is also very simple it follows convention based approach (as used in ruby on Rails and in java struts 2.0 for mapping URLs to methods) to access the underlying data source. some examples are
http://myserver/data.svc/Customers[ALFKI]/Orders
http://myserver/data.svc/Customers[ALFKI]/Orders[Active eq true]
The URL upto http://myserver/data.svc/ is the physical URL while the rest is logical which refers to the Customers table
using ALFKI as key to retrieve orders of that customer. Entities are exposed on Uri on which we can perform GET, POST or DELETE operations. Astro when combined with LINQ becomes more powerful as the underlying source can be a Relational Database or any other datasource.
Links & References:
http://astoria.mslivelabs.com/
http://en.wikipedia.org/wiki/Representational_State_Transfer
http://www.xfront.com/REST-Web-Services.html
http://www.infoq.com/news/2007/05/astoria
http://www.base4.net/Blog.aspx?ID=395
http://udidahan.weblogs.us/2007/05/01/does-rest-simplify-communication-more-than-soa/
Introduction:
VS2005 takes a lot of time to build 'Web Site Projects' which is frustrating and cumbersome.
Here are some optimizations that will make the build process much faster.
Step 1: Changing Target Platform
Description:
By default project target platform is set to ‘Any CPU’ or ‘Mixed platforms’ in VS2005
Resolution:
Go to Properties by Right Clicking your Solution. Under Configuration Properties-> Configuration menu change the projects target platform from "Any CPU or Mixed platforms" to "x86".if x86 does not exists then create it from Configuration manager by selecting new category from 'Active Solution Platform'.
You will see a performance boost for all your Class library projects.
Step 2: Enable Batch Compilation
Description:
Turning batch=true in Web.Config means that all your stuff within one directory is compiled into one Dll at once. Switching batch=false means Dll's for every single page. As I mentioned, on my machine the batch=true option is very slow. Every time when I start debugging by F5 the whole app is compiled and for every page an xml file is generated and so on... Turning off batch compilation makes start debugging rocket fast.
Resolution:
In Web.Config File under compilation tag set batch=false.
Step 3: Leveraging Server-Side Compilation
Description:
Visual Studio 2005 is leveraging ASP.Net 2.0 server-side compilation. The IDE is primarily validating that the site will compile. For most edit/run iterations it's not really necessary to validate/build the entire site on every F5 or solution build. While this does improve build performance because ASP.Net is only compiling the files needed for the request on F5, it doesn't help the developer identify all the compilation issues within the IDE before running.
Resolution:
Change Build options for the web site project: (Property pages <shift><F4> -> Build)
“Start Action (F5)” should be either "build page" or "no build". - Improves F5 performance
“Build Solution Action” unchecks “Build Web as part of solution.” - Makes <ctrl><shift><B> very fast.
Step 4: Resolve Dueling Assembly References
Description:
The “easiest quick fix” way to resolve this issue is to modify one or more of your assembly file-based references to not be “automatic refresh enabled”. You can do this by deleting the .refresh files within your \bin directory that produce that shared conflict. This will avoid having VS auto-update the assemblies, and so will prevent the Dueling Assembly Reference update conflict altogether. You might find it useful to quickly disable this behavior by deleting the .refresh files as a stop-gap, and then re-enable the auto-refresh behavior once you fix the shared assembly conflicts.
Resolution:
Navigate to your website bin Directory and delete all *.refresh files.
Step 5: Disabling HTML Schema Validation
Description:
VS2005 has a background thread that continuously monitors all open aspx files for errors.
Resolution:
On the Tools menu, click Options.
In the Options dialog box, expand the Text Editor node and the HTML node, and then click Validation.
To disable validation, clear the Show errors check box and then click OK.
Step 6:Disable Antivirus On Access Scanning
Description:
VS2005 hits the file-system a lot, and obviously needs to reparse any file within a project that has changed the next time it compiles. One issue I've seen reported several times are cases where virus scanners, Spybot detectors, and/or desktop search indexing tools end up monitoring a directory containing a project a little too closely, and continually change the timestamps of these files (they don't alter the contents of the file - but they do change a last touched timestamp that VS also uses. This then causes a pattern of: you make a change, rebuild, and then in the background the virus/search tool goes in and re-searches/re-checks the file and marks it as altered - which then causes VS to have to re-build it again. Check for this if you are seeing build performance issues, and consider disabling the directories you are working on from being scanned by other programs. I've also seen reports of certain Spybot utilities causing extreme slowness with VS
Debugging - so you might want to verify that you aren't having issues with those either.
Resolution:
Watch out for Virus Checkers, Spy-Bots, and Search/Indexing Tools.
Results:
Initially my project was taking around 4-5 mins to compile, but after optimizing it was reduced to 10 secs.
The proliferation of modern programming languages (all of which seem to have stolen countless features from one another) sometimes makes it difficult to remember what language you’re currently using. This guide is offered as a public service to help programmers who find themselves in such dilemmas.
C
You shoot yourself in the foot.
C++
You accidentally create a dozen clones of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can’t tell which are bitwise copies and which are just pointing at others and saying, “That’s me, over there.”
JAVA
After importing java.awt.right.foot.* and java.awt.gun.right.hand.*, and writing the classes and methods of those classes needed, you’ve forgotten what the hell you’re doing.
Ruby
Your foot is ready to be shot in roughly five minutes, but you just can’t find anywhere to shoot it.
PHP
You shoot yourself in the foot with a gun made with pieces from 300 other guns.
ASP.NET
Find a gun, it falls apart. Put it back together, it falls apart again. You try using the .GUN Framework, it falls apart. You stab yourself in the foot instead.
SQL
SELECT @ammo:=bullet FROM gun WHERE trigger = ‘PULLED’;
INSERT INTO leg (foot) VALUES (@ammo);
Perl
You shoot yourself in the foot, but nobody can understand how you did it. Six months later, neither can you. (via Andy)
Javascript
YOu’ve perfected a robust, rich user experience for shooting yourself in the foot. You then find that bullets are disabled on your gun.
CSS
You shoot your right foot with one hand, then switch hands to shoot your left foot but you realize that the gun has turned into a banana.
FORTRAN
You shoot yourself in each toe, iteratively, until you run out of toes, then you read in the next foot and repeat. If you run out of bullets, you continue anyway because you have no exception-handling ability.
Modula2
After realizing that you can’t actually accomplish anything in this language, you shoot yourself in the head.
COBOL
Using a COLT 45 HANDGUN, AIM gun at LEG.FOOT, THEN place ARM.HAND.FINGER. on HANDGUN.TRIGGER and SQUEEZE. THEN return HANDGUN to HOLSTER. CHECK whether shoelace needs to be retied.
LISP
You shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds the gun with which
you shoot yourself in the appendage which holds ….
BASIC
Shoot yourself in the foot with a water pistol. On big systems, continue until entire lower body is waterlogged.
FORTH
Foot in yourself shoot.
APL
You shoot yourself in the foot, then spend all day figuring out how to do it in fewer characters.
Pascal
The compiler won’t let you shoot yourself in the foot.
SNOBOL
If you succeed, shoot yourself in the left foot.
If you fail, shoot yourself in the right foot.
Concurrent Euclid
You shoot yourself in somebody else’s foot.
HyperTalk
Put the first bullet of the gun into the foot of the left leg of you.
Answer the result.
Motif
You spend days writing a UIL description of your foot, the trajectory, the bullet, and the intricate scrollwork on the ivory handles of the gun. When you finally get around to pulling the trigger, the gun jams.
Unix
% ls
foot.c foot.h foot.o toe.c toe.o
% rm * .o
rm: .o: No such file or directory
% ls
%
Paradox
Not only can you shoot yourself in the foot, your users can too.
Revelation
You’ll be able to shoot yourself in the foot just as soon as you figure out what all these bullets are for.
Visual Basic
You’ll shoot yourself in the foot, but you’ll have so much fun doing it that you won’t care.
Prolog
You tell your program you want to be shot in the foot. The program figures out how to do it, but the syntax doesn’t allow it to explain.
Ada
After correctly packaging your foot, you attempt to concurrently load the gun, pull the trigger, scream and shoot yourself in the foot. When you try, however, you discover that your foot is of the wrong type.
Assembly
You try to shoot yourself in the foot only to discover you must first reinvent the gun, the bullet, and your foot. After that’s done, you pull the trigger, the gun beeps several times, then crashes.
370 JCL
You send your foot down to MIS with a 4000-page document explaining how you want it to be shot. Three years later, your foot comes back deep-fried.
Python
You try to shoot yourself in the foot but you just keep hitting the whitespace between your toes. (via Marco Azaro)
.Net
Microsoft shoots you in the foot.
Microsoft accidentally shoots you in foot. Promises service pack to reattach your foot sometime in the next year. 18 months later you get service pack that removes your colon along with the rest of your foot.
Java -
Build a well formed class with a well designed shootmyselfinthefoot method, start your program and hold your foot still for 40 minutes while your app loads.
For JAVA, I think it should have been:
You waste 2 hours trying to implement a generic foot shooting framework, solving classpath issues, profiling the bullet shooting algo (because at first the bullet is too slow and bounce off the foot), adding performance tweaks and reducing the memory usage (the gun is too heavy), adding try {shooting} catch(whatever could go wrong) to make sure you find out why it doesn’t work only to ‘finally’ figure out that you can risk moving your foot for an indefinite amount of time because the jvm is too slow to boot and shoot, and that the bullet pauses in mid air because of a garbage collection…
CSS:
You try to shoot your left foot, you miss 2 pixels. You try to shoot your right foot, you miss 1 pixel. Finally you try to shoot your head, you miss 10 pixels. Then you realize you’re using MS IE gun.