2009年12月19日 星期六

11 Optimization Tips For Visual Studio | Hatim's Development Blog

11 Optimization Tips For Visual Studio

Monday, April 27th, 2009
at 6:33pm

Trusted By

Welcome Back! I hope you enjoy the content on this site. If you have not done so already, you may want to subscribe to my RSS feed and if you have a minute I would love to have your Feedback. Thanks for visiting!

Sometimes ago I compiled this list for myself and our team to help get things done faster and deal with visual studio quirks.

Remember if you mess things up you can always reset your Visual Studio Settings (Tools->Import and Export Settings->Reset All Settings)

Visual Studio Optimization Tips:

  1. Disable F1. (Tools->Options->Environment->Keyboard) (I always end up hitting it by mistake when reaching for the escape key)
  2. Disable "Animate environment tools" (Tools->Options->Environment->General)
  3. Disable Start Page (Tools->Options->Environment->Startup)
  4. Disable "Track Active Item in Solution Explorer" (Projects and Solutions).
  5. Disable Navigation Bar (Tools->Options->Text Editor->C#)
  6. Set "AutoToolboxPopulate" to false (Tools->Options->Windows Forms Designer).
  7. Turn off Track Changes. (Tools->Options->Text Editor->Track changes)
  8. Bind Ctrl+Shift+k to Edit.LineDelete
  9. Bind Shift+Enter to Edit.LineOpenBelow
  10. Bind CTRL+SHIFT+ALT+Z to Attach To Process
  11. (Ctrl+K, Ctrl+D) to reformat the code when things get messy

If you have some tips on your own please share in the comments!

Hope this helps!

Hatim

ShareThis

Posted via web from CodeBetter

2009年12月9日 星期三

InfoQ: Resource-Oriented Architecture: The Rest of REST

Resource-Oriented Architecture: The Rest of REST

Posted by Brian Sletten on Dec 03, 2009

Community
SOA
Topics
REST ,
Semantic Web
Tags
URI ,
SOAP ,
Web services ,
ROA ,
HATEOAS

Series Introduction

Think for a moment, if you can, back to a time before the Web. Imagine trying to explain the impending changes to your hapless contemporaries. It is likely they would simply not be able to fathom the impacts that the Web's emergence would have on nearly every aspect of their lives. In retrospect, it feels like a tsunami caught us off-guard and forever altered the landscape around us. The reality is more pedestrian, however. It was a deliberate series of technical choices that built upon each other that yielded the results we have experienced.

Now, pause and reflect upon the idea that you are probably in a similar position to those incredulous pre-Web types you were just trying to enlighten. Unless you have been paying close attention, you are about to be caught off-guard again as it feels like a new wave crashes upon our economic, social, technological and organizational landscapes. While the resulting changes will feel like they occur overnight, the reality is that they have been in the works for years and are just now producing tangible results. This new wave is about a Web that has evolved beyond documents into Webs of Data, both personal and private. We will no longer focus on information containers, but on information itself and how it is connected.

This wave has been in the works for years and is again being driven by the deliberate adoption of specific choices and technologies. These choices are combining to solve the problems caused by the inexorable march of technological change, business flux, new and varied data sources and the ubiquitous, expensive and failure-prone efforts that have cost millions and delivered insufficient value. Web Services and Service-Oriented Architectures (SOA) were supposed to be part of the answer, but the elegance of their visions have been forever stained by the inelegance of their technical solutions.

The beauty is that we are not starting from scratch. We are building upon the technology we have in place to grow these data webs organically. We can wrap our databases, libraries, services and other content sources with a new set of abstractions that will help us off the treadmill we have been on. We are integrating the public Web of Data with our own, privately held data. The incremental adoption of these technologies is yielding new capabilities that will, in turn, unlock further capabilities.

This is the first article in a new series to highlight the evolution of information-oriented systems that got us to where we are and provide a roadmap to where we are going. Despite what it may seem on the surface, these choices are neither ad hoc nor esoteric, but rather foundational decisions based on a long tradition of academia and applied engineering.

We will start by revisiting the REpresentational State Transfer (REST) architectural style. Oft quoted and even more often misunderstood, this manner of building networked software systems allows us to merge our documents, data and information-oriented services into a rich, logical ecosystem of named resources. From there, we will introduce the vision of the Semantic Web and walk through its core technologies represented by a flexible and extensible data model and the ability to query it. We will see how to incorporate relational data, content from documents, spreadsheets, RSS feeds, etc. into a rich web of reusable content.

After we present the basics, we will walk through a variety of successful efforts building on these technologies and then return to reclaiming the vision promised to us by proponents of Web Services technologies. We will describe a process where we can achieve something of a Unified Theory of Information Systems; one that not only handles, but embraces the kind of technical and social change that has been painful and intractable to manage in the past.

There has been too much hype surrounding the Semantic Web, but there have also been a steady stream of quiet successes. This series will be a pragmatic guide into both new and familiar territory. We will connect the technologies in deeper ways than perhaps you have seen before. We will highlight events and actions by companies, government organizations and standards bodies that indicate that this is happening and it will change everything. We will show how a very large difference in your system implementation can often be made through subtle shifts in perspective and adoption of standards that are designed to facilitate change.

The first step, is to embrace a common naming scheme for all aspects of our infrastructure. A Service-Only Architecture usually ignores the data that flows through it. At the end of the day, our organizations care about information first and foremost. REST and the Web Architecture puts this priority up front and lays the foundation for the remainder of our discussion.

The Rest of REST

It has become fashionable to talk about the REpresentational State Transfer (REST) as something of a weapon in the War On Complexity. The enemies in this war, according to some, are SOAP and the Web Services technology stack that surrounds it. This Us vs Them rhetoric brings passion to the table, but rarely meaningful dialogue so people remain confused as to the underlying message and why it is important. The goal is not to replace SOAP; the goal is to build better systems.

REST is not even a direct replacement for SOAP. It is not some kind of technology of convenience; a simple solution for invoking Web Services through URLs. The management of information resources is not the same thing as invoking arbitrary behavior. This confusion leads people to build "RESTful" solutions that are neither RESTful, nor good solutions.

REST derives its benefits as much from its restrictions as it does its resultant flexibility. If you read Dr. Roy Fielding's thesis (which you are encouraged to do), you will learn that the intent was to describe how the combination of specific architectural constraints yields a set of properties that we find desirable in networked software systems. The adoption of a uniform interface, the infamous Uniform Resource Locator (URL), contributes to the definition of REST, but is insufficient to define it. Likewise, interfaces that simply expose arbitrary services via URLs will not yield the same benefits we have seen so successfully in the explosion of the Web. It takes a richer series of interactions and system partitioning to get the full results.

Most people understand that REST involves requesting and supplying application state of information resources through URLs via a small number of verbs. You retrieve information by issuing GET requests to URLs, you create or update via POST and PUT, and remove information via DELETE requests.

This summary is not incorrect, but it leaves too much out. The omissions yield degrees of freedom that unfortunately often allow people to make the wrong decisions. In this gap, people create URLs out of verbs which eliminates the benefit of having names for "things". They think REST is just about CRUD operations. They create magical, unrelated URLs that you have to know up front how to parse, losing the discoverability of the hypertext engine. Perhaps most unforgivably, they create URLs tied solely to particular data formats, making premature decisions for clients about the shape of the information.

Understanding the full implications of REST will help you avoid these problems; it will help you to develop powerful, flexible and scalable systems. But it is also the beginning of a new understanding of information and how it is used. Upon this foundation of Web architecture, the application of the remaining technologies of the Semantic Web will yield unprecedented power in how we interact with each other as individuals, governments, organizations and beyond. This is why we begin with a deeper dive into the parts of REST that many people do not understand and therefore do not discuss. These topics include the implications of:

  • URLs as identifiers
  • Freedom of Form
  • Logically-connected, Late-binding Systems
  • Hypertext as the Engine of State Transfer (HATEOS)

URLs as Identifiers

We have already established that most people know about URLs and REST. It seems clear that they understand that a URL is used for invoking a service, but it is not clear that they get the larger sense of a URL as a name for information. Names are how we identify people, places, things and concepts. If we lack the ability to identify, we lack the ability to signify. Imagine Abbott and Costello's infamous "Who's on First?" skit on a daily basis. Having names gives us the ability to disambiguate and identify something we care about within a context. Having a name and a common context allows us to make reference to named things out of that context.

The Uniform Resource Identifier (URI) is the parent scheme. It is a method for encoding other schemes depending on whether we want them to include resolution information or not. Librarians and other long-term data stewards like names that will not change. A Uniform Resource Name (URN) is a URI that has no location information in it; nothing but name is involved. The good news is that these names will never break. The bad news is that there is no resolution process for them. An example of a URN is an ISBN number for a book:

urn:isbn:0307346617

In order to find more information about this book, you would have to find a service that allows you to look up information based on the ISBN number.

If nothing about the context of our systems and information ever changed, we would probably always want to include resolution information in our resource names so we could resolve them. But anyone who has been handed a broken link knows we want longer-lived names for really important stuff. Looking at our history of using URLs, we have done some silly things when we created ones such as:

The problem with these URLs is that the technology used to produce a result is irrelevant to the consumer of information. There is no good reason to create URLs like that. The focus should be on the information, not the technology. Implementation technologies change over time. If you abandon them, for instance, any system that has a link to the Perl, Servlet or PHP-based URL will break. We will address some infrastructure to solve this problem in future articles, for now, we will just try to make careful choices in the names we give our information resources.

Despite being fragile, the URL scheme does allow us to disambiguate information references in a global context.

is distinct and distinguishable from

in ways that a decontextualized identifier like '123456' is not.

To ground the concept into a larger information systems framework, you can think of a URL as a primary key that is not specific to a particular database. We can make references to an item via its URL in dozens of different databases, documents, applications, etc. and know that we are referring to the same thing because we have a unique name in a global context. We will use this property in future discussions to describe and connect RESTful systems to other content and metadata.

The next aspect of URLs that bears discussion is their universal applicability. We have a common naming scheme that allows us to identify:

  • documents (reports, blogs, announcements)
  • data (results, instance information, metadata)
  • services (REST!)
  • concepts (people, organizations, domain-specific terms)

We do not need to come up with a different mechanism to refer to each different category of things. A careful application of some specific guidelines allows us to blur the distinctions between these things which brings us to the last point for now about URLs. Not only are these names useful in order to refer to information we care about, but systems that receive these references can simply ask for them. The 'L' in URL (locator) gives us the capacity to resolve the thing, not knowing anything else about it. We can usually invoke the same basic operations on everything we can name. Issuing a GET request to a URL representing a document, some data, a service to produce that data or an abstract, non-network-addressable concept all work fundamentally the same way. For those things we have the permission to manipulate, we can also create, modify or delete them using similar means.

Freedom of Form

Our experience of the Web has been somewhat passive with respect to the shape of information. When we click on a link, we expect the content to come back in a particular form, usually HTML. That is fine for many types of information, but the architecture supports a much more conversational style allowing clients to request information in a preferred form.

To understand why this is useful, consider a company's sales report. It is easy to imagine this being useful to executives, sales people, other employees, clients and investors as an indication of how a company is performing. A possible name for such a report could include the year and the quarter in the URL:

We might contrast this with a sales report for the month of March:

Both are good, logical names that are unlikely to break over time. It is a compelling vision that people could simply type such a URL into a browser and get the information they seek rendered as HTML. The reports could be bookmarked, e-mailed, linked to, etc.; all the things we love about the Web.

The problem is that the information is locked into its rendered form (until we introduce technologies like GRDDL and RDFa later in this series!). We used to try to scrape content from pages, but gave up in disgust. As the page layout changes, our scripts break.

If you were a programmer for this company and wanted to get to the information directly, you might like to request it as XML. You could get back raw, structured data that you could validate against a schema. HTTP and REST make this trivial as long as the server knows how to respond. By passing in an "Accept: application/xml" header to your request, you could indicate a preference (or requirement) for XML. On success, you will get back a byte-stream with a MIME type indicating that your request has been honored. On failure, the server will indicate via a 406 Error that it cannot help you. In that case, you might want to contact the department responsible for this information and request they add the support you need; something they can do without breaking any existing clients. If you were a business analyst, you might think that XML has sharp points and can hurt you, so you might like to request it back as a spreadsheet, a format that is easily incorporated into your existing workflows, tools and processes.

The point is that the logical name for the report is easily converted into various forms at the point it is requested. It is equally easy to run systems that accept modifications back in the various forms. The client has no visibility into how the information is actually stored, they just know that it works for them. This freedom is wholly underused by people building RESTful systems. When they stand up a service and decide that they will only return XML, they miss the potential value REST has to an organization.

Because many developers are either unaware of content negotiation or find it difficult to test in a browser, they define different URLs for the different formats:

This developer convenience becomes a limitation once you escape the confines of a particular use. In essence, we now have three information resources, not one that can be rendered in different forms. Not only does this fork the identity in the global context, it also prematurely commits other clients to a particular form. If you pass a reference to a URL as part of a workflow or orchestration you are robbing the upstream clients from the freedom to choose the form of the data.

There are several ways to test a proper RESTful service without using a browser, for example:

curl -H "Accept: application/xml" -O http://company1.com/report/sales/2009/qtr/3

using the popular curl program. Any reasonable HTTP client will provide similar capabilities.

The benefits of supporting a rich ecosystem of negotiable data forms may not be immediately obvious, but once you wrap your head around it, you will see it as a linchpin toward long-lived, flexible systems that favor the client, not the developer.

Logically-Connected, Late-Binding Systems

Once you commit to good, logical names for your information resources, you will discover some additional benefits that fall out of these decisions. Named references can safely and efficiently be passed back as results without returning actual data. This has strong implications for large and sensitive data sets, but it also makes possible technical and architectural migration.

For the same reasons pointers are useful in languages like C and C++, URLs as references to data are more compact and efficient to hand off to potential consumers of information. Large data sets such as financial transactions, satellite imagery, etc. can be referenced in workflows without requiring all participants to suffer the burden of handling the large content volume.

Any orchestration that touches actual data must consider the security implications of passing it on to other systems. It quickly becomes untenable to provide perfect knowledge of who is allowed to do what at every step of a process. If a reference is passed from step to step, it is up to the information source to enforce access. Some steps may not require access to the sensitive information and could therefore be excluded from receiving it when they resolve the reference.

This means the late-binding resolution can factor in the full context of the request. A particular user accessing a resource from one application might have a business need to see sensitive information. The same person using a different application might not have a business justification to the same data. A RESTful service could inspect session tokens and the like to enforce this access policy declaratively. This level of specificity is required to prevent internal fraud, often the biggest risk in systems that deal with sensitive content. The details of such a system are going to be implementation-specific and are largely orthogonal to the process of naming and resolving logically-named content.

Dependency on a logical connection allows clients to be protected against implementation changes. When popular websites shift from one technology to another, they are usually successful at hiding these changes from their users. RESTful services do the same thing. This gives us the freedom to wrap legacy systems with logical interfaces and leave them in place until there is a business reason to invest in a new implementation. When that happens, clients can be protected from being affected.

In addition to mediating technology changes, RESTful systems allow you to embrace a variant of Postel's Law: Be Conservative in what you do; be Liberal in what you accept from others. You can maintain strict content validation of what you accept and return. However, if you have an existing client base that is providing you content in a given form, you are free to allow other clients to provide different forms, different schemas, etc. without affecting the existing clients. Systems that closely associate a contract with an endpoint tend not to have this freedom which makes them more brittle and quickly fragmented.

Hypertext As the Engine of State Transfer (HATEOS)

As systems come across references to information resources, many people think there needs to be some sort of description language to indicate what is possible or should be done with it. The reality is that a well-considered RESTful system usually does not require this concept. This is difficult for SOAP developers to accept, but it has to do with the constraints of the architectural style. Because we treat information resources as things to manipulate through a uniform interface (the URL!) and restrict our efforts to a small set of verbs, there really is no need to describe the service.

If you find yourself confused on this point, it is probably an architectural smell that you are conflating manipulating resources with invoking arbitrary behavior. The REST verbs provide the full set of operations to apply to an information resource. Certainly, you need to know what information is being returned so you know how to process it, but that is what MIME types are for. While it is usually preferable to reuse known types (application/xml, image/png, etc.), many developers do not realize that they can create their own application-specific data types if necessary.

In the larger arc of this article series, we will address the problems of finding and binding arbitrary resources using rich metadata. For now, we will simply keep in mind Roy's underscoring of the importance of "hypertext as the engine of state transfer" (obliquely referred to as "HATEOS" by RESTafarians). This is perhaps the most misunderstood portion of the thesis. To get its full implication, we need to revisit how the Web works.

You type a URL into the browser and it issues an HTTP GET request for that resource. Invariably, the server responds with a bytestream, a response code (usually 200 on success) and a MIME type indicating that the response is HTML. The browser decides it knows how to handle this type and parses the result into a document model of some sort. Within that model, it finds references to other resources: links, images, scripts, style sheets, etc. It treats each one differently, but it discovers them in the process of resolving the original resource. There is no service description; the browser, as a client, simply knows how to parse the result.

The same mechanism should be employed for RESTful services. The URLs themselves should not be "magical". A client should not be required to know how to parse a URL or have any special knowledge of what one level in the hierarchy means over another one. RESTful clients should retrieve a resource, investigate the returned MIME type and parse the result. As such, a client should know how to parse the returned type.

For example, a client might receive a reference to the main RESTful service for the reporting service we described above:

If requested from a browser, it could return an HTML document that has references to:

which the user could click through to find a list of years to browse. The point is that the browser has no special knowledge of the URL structure, but it knows how to parse the result and present the content to the user in a way she can explore.

The same can be true of other MIME type responses. For example, requesting the 2009 quarterly reports as XML:

could yield:

<reports>  <description>2009 Quarterly Reports</description>  <report name="First Quarter" src="http://company1.com/reports/sales/2009/qtr/1"/>  <report name="Second Quarter" src="http://company1.com/reports/sales/2009/qtr/2"/>    <report name="Third Quarter" src="http://company1.com/reports/sales/2009/qtr/3"/>      </reports>  

You can think of the URL as a vector through an information space. Each level points you closer to the ultimate resource. Different paths can yield the same results. The client will have to know how to parse these results, but by giving the response an identifiable type, we can trigger the appropriate parser. The structure can be spidered by descending through the references, or presented to a user to browse through some kind of interface. A RESTful interface becomes a way for clients to ask for information based on what they know. They start from a known or discovered point and browse the information like you browse the Web.

This is what HATEOS refers to. The application state is transferred and discovered within the hypertext responses. Just like the browser needs to know about HTML, images, sound files, etc., a RESTful client will need to know how to parse the results of resolving a resource reference. However, the entire process is simple, constrained, scalable and flexible -- exactly the properties we want from a networked software system.

Many people build "RESTful" systems that require the clients to know beforehand what each level in a URL means. Should the information get reorganized on the server side, clients of those systems will break. Clients that truly embody HATEOS are more loosely-coupled from the servers they communicate with.

Looking Forward

We struggle daily to solve the problems of rapidly changing domains, technologies, customer demands and actionable knowledge. We spend too much time writing software to link what we learn to what we know. Objects and databases have not kept pace with the changes we experience. We need a new way of looking at the information we produce and consume that is extensible and less fragile than the solutions of the past. We need technology to help us form consensus. We should not have to achieve consensus in the form of common models before we can use our technologies.

In this article, we have introduced the series and have begun to look at how REST and Web technologies can serve as the basis of a new information-oriented architecture. We have established a naming scheme that allows us to unify references to all manner of content, services and documents. Clients can leverage the freedom to negotiate information into the form they want. As they resolve references, they can discover new content connected through new relationships.

This architectural style and the technologies surrounding the Semantic Web combine nicely to create powerful, scalable, flexible software systems. Their capacity to create Webs of Data will have as much impact on our lives as the Web has already had. This will be an information systems revolution that will turn much of what we know on its head. It will not only reduce the cost of data integration, but it will enable new business capabilities we can only begin to imagine.

We are moving into a world where information can be connected and used regardless of whether it is contained in documents, databases or is returned as the results of a RESTful service. We will be able to discover content and connect it to what we already know. We will be able to surface the data currently hidden behind databases, spreadsheets, reports and other silos. Not only will we gain access to this information, we will be able to consume it in the ways we want to.

This is one of the main, modest goals of the Semantic Web. Achieving it, as we are now able to do, is starting to change everything.

10 comments

Watch Thread Reply

Re: The Rest of REST by chris barrow Posted Dec 4, 2009 7:18 PM
Re: Should 'REST' clients be made to understand the structure of URIs? by Jamie Kirkpatrick Posted Dec 6, 2009 3:40 AM
Re: Should 'REST' clients be made to understand the structure of URIs? by Jean-Jacques Dubray Posted Dec 6, 2009 1:10 PM
Re: Should 'REST' clients be made to understand the structure of URIs? by Jean-Jacques Dubray Posted Dec 6, 2009 7:45 PM
Useful start to good discussion by Lawrence Winkler Posted Dec 9, 2009 1:19 AM
  1. Back to top

    Re: The Rest of REST

    Dec 4, 2009 7:18 PM by chris barrow

    A clear and concise introductory article on REST. Well worth the read.

    Reply

  • From what I have read, REST applications start with a root URI and then everything happens through HATEOS after that. Hypermedia URIs are either created by the server (or by the client in some generic manner).

    Asking service clients to understand the structure of URIs in order to access specific resources means one is exposing some kind of an information model and implicitly defining a contract. I don't believe this is REST.

    If there is an information model that clients should understand, then we can be explict about it as in Open Data Protocol or SOA.

    Reply

  • Sorry you have already pointed this out.

    REST applications should be HATEOS driven but that is not the case in the industry.

    I have not come across any significant examples of proper REST applications. Maybe proper REST is too hard or not practicle.

    REST has been around for a while but it seems to be vastly misunderstood and misapplied.

    Maybe we do need to be explicit about information models that services expose (such as in Open Data Protocol / SOA) as the practicle alternative for now.

    Reply

  • @Faisal:

    Agree with everything you say, and the issue as I see it is that really no-one out there is giving definitive practical examples of fully RESTful applications (or more interestingly clients). I have yet to see anyone explain clearly and concisely what the correct balance of media-types / relationships is (some people say you should be using custom media-types for example, and others say that this is a bad idea!), and additionally how those can be conveyed to a client in a way that is not "out-of-band". Lots of ideas floating around but no concrete standards out there when it comes to RESTful services.

    People hold up browsers as an example of a RESTful client but this misses the point for me: browsers only have to deal with a specific, well known set of media-types and relationships and those have been communicated "out-of-band" over many years to the point where there are standards and anyone can write a compliant browser. Show me some way of doing this for my own apps and we can talk...

    Reply

  • >> no-one out there is giving definitive practical examples of fully RESTful applications (or more
    >> interestingly clients).

    simply because REST is not a programming model and will never be. These examples don't exist and most likely will never exist. REST as a programming model is pure fiction.

    >> Show me some way of doing this for my own apps and we can talk...
    You bet

    That being said, there are good things you can do with HTTP, and REST, as defined by Roy, introduces very interesting patterns. Understanding how to take advantage of HTTP and these patterns as you built your connected systems is key. However, REST as a or even "the" key building block of information systems is a myth and that myth is gone today. I can safely predict no one will be able to build a significant information system (e.g. ERP, PLM, Policy & Claims Management, ...) in a RESTful way.

    Reply

  • You don't need to build RESTful ERP, PLM, or any other traditional Line-Of-Business Apps. REST is about building loosely coupled network interactions with purveyors of information (documents or resources).

    The whole Linked Data meme is about the application of REST to the age-old issue of platform independent Data Access; basically doing this job better than ODBC, JDBC, OLE-DB, ADO.NET etc..

    Fixing Data Access is a big deal since without fixing this you can never fix the bigger problem of Data Integration.


    Kingsley Idehen
    www.openlinksw.com/blog/~kidehen

    Reply

  • >> def: Purvey = to provide, furnish, or supply (esp. food or provisions) usually as a business or
    >> service.

    If you want to limit REST to "supply" information, I am fine. Though you run into the problem that REST couples access with identity.

    Now, if you claim that REST can fix Data Access, I think you are seriously mistaken. Don't you need the beginning of a query language? (i.e. not something ad hoc)

    Reply

  • Do we need a new name for what is actually being done?

    Clearly most are not doing REST as Roy Fielding intended.

    Yet, I have seen countless implementations using HTTP for data access being referred to as REST when none of the REST principles are in use (e.g. contract/rpc style of interface, no standard media types, no HATEOS, no 'discovery' of media type on the client, etc.).

    Some use atom as the envelope format (maybe atom is the new SOAP) but then have specific structure within atom that clients need to understand.

    Yet somehow they all claim the benefits on REST.

    Terms such as Web Oriented Architecture (WOA) and Resource Oriented Architecture (ROA) are in use but there is no consensus on what these mean exactly.

    Reply

  • Nice to see we're all coming to the same conclusion about REST Style not being actually implemented.
    I did mention before many people do twist their apps into horrible semantics just to complain with REST constrains. That is, the goal is to obtain the "REST brand" tag and not to improve the architecture.

    At the beginnings, I mentioned the so called RESTFull APIs were just Web APIs (WAPIS, please coin the term). Then there were REST Services (as opposed to SOAP services) which lead our friend Jean-Jacques to confusion in his posts.
    Then we have ROA and WOA. Names that make no sense at all, and let me explain why:
    1. Oriented Architecture means an architecture that follows the rules and behavior of a metaphor. In SOA, the metaphor is a business service.
    2. What's the metaphor in ROA and WOA? How does a Resource behaves? What are the rules upon it? Is Web a metaphor? Same questions to web.
    3. If the metaphor does not help or guides the definition and semantics of an architecture, then we are just making up names about what we use in the development to coin a term and make money talking about it. So, I can came up with some: Java oriented Architecture, Rails Oriented Architecture, RPC oriented Architecture.

    Cheers.

    William Martinez Pomares.

    Reply

  • Back to top

    Useful start to good discussion

    Dec 9, 2009 1:19 AM by Lawrence Winkler

    This article has the beginnings of the start of a useful discussion of SOA, ROA and the architecture required to handle the distributed nature of the web. Fieldings thesis and RESTful services is the initial and practical place to go. However, as important as Fieldings thesis is, I think it needs to be placed in a more theoretical context, then brought back into the practical world with a better understanding.

    It is far beyond my meager understanding, but my hunch is that the theoretical basis for the underlying discussion is Robin Milner's pi-calculus, where RESTful services and Resource Oriented Architecture is but a special case, and a practical implementation.

    In any case, that is how I will be reading this discussion. In answering whether clients should understand the structure of URIs, I have this feeling the answer is 'yes' in the pi-calculus framework, with part of the URI being a pi-calculus 'link', another part of the URI a value sent across the link, the GET/PUT/POST/DELETE a second value sent across the link, and the content-type a third value sent. The example of responses returning other URI's which can be used to get/find other resources fits nicely with the pi-calculus idea of transmitting links between agents.

    Reply

  • Posted via web from Does IT Matters?

    2009年12月2日 星期三

    InfoQ: Strategic Domain Driven Design with Context Mapping

    Posted via web from Does IT Matters?

    Walter, Sarah and the 5 Whys | Agile Blog: Scaling Software Agility

    Posted via web from Does IT Matters?

    2009年11月5日 星期四

    Wicked Code: Foiling Session Hijacking Attempts

    Posted via web from Does IT Matters?

    Theft On The Web: Theft On The Web: Prevent Session Hijacking

    Posted via web from Does IT Matters?

    Session fixation Vulnerability in Web-Base Applicaitons

    Posted via web from Does IT Matters?

    2009年10月29日 星期四

    Microsoft Releases Silverlight 3 Beta with Key New Features

    Posted via web from Does IT Matters?

    Pianotrappan - rolighetsteorin.se

    Bravo!!

    Posted via web from Whatsoever

    2009年10月28日 星期三

    Choosing the Right Social Media Tools for Your Business [Video]

    Posted via web from Does IT Matters?

    2009年10月22日 星期四

    InfoQ: A Guide to Claim-based Identity

    Posted via web from Does IT Matters?

    2009年10月14日 星期三

    First Google Wave Firefox Add-on is Here: Google Wave Notifier

    Posted via web from Does IT Matters?

    2009年10月12日 星期一

    Web Deployment Tool released to web (RTW) - Scott Forsyth's Blog

    Posted via web from CodeBetter

    2009年10月2日 星期五

    Becoming a Better Developer

    Posted via web from CodeBetter

    2009年9月20日 星期日

    BMW Vision EfficientDynamics | Fubiz™

    Posted via web from Whatsoever

    2009年9月8日 星期二

    Standardizing Service Endpoints

    Posted via web from CodeBetter

    Enterprise Abstraction: Service naming standards

    I've been doing some hunting to follow up on my previous posting regarding web service naming conventions and standards.  The pickings are slim.  Thomas Erl, a Canadian SOA expert and author, mentions some SOA naming conventions in an article he wrote for Oracle entitled Standardizing Service Endpoints

    He prescribes a practical approach, naming services based on the utility (verb), entity (noun) or task/function (verb-noun -- do something to something), dependant on the scope and context of the service.  He also warns about ensuring that operations within the service reflect appropriately the scope of the service, and to eliminate redundancy in operation names.

    From the article:

    • The utility-centric context is found in application services involving operations that encapsulate cross-cutting functions, such as event logging, exception handling, or notification. These reusable services need to be labeled according to a specific processing context, agnostic in terms of any particular solution environment. For example, a utility service might be named Notify.
    • An entity-centric context is established in a business service that represents a specific business entity, such as an invoice or a purchase order. The labeling of entity-centric business services is often predetermined by the entity name. For example, a service may simply be named Invoice or Customer.
    • Task-centric contexts are required for services modeled to encapsulate process logic. In this case, the thread that ties together the grouped operations is a specific activity being automated by the service logic. Therefore, the use of verbs in service names is common. For example, a task-centric service may be called GetProfile or ProfileRetrieval, if that accurately represents the task's scope.

    As with service names, labeling individual service operations is also a process that should be subject to standards and guidelines and for which there are already several best practices.

    For example, the naming of the service itself ought to influence how the individual operations are labeled. Because a good service name will already clearly establish a meaning and a context, operation names should be streamlined to avoid the use of redundant wording. Take an operation that retrieves invoice history data for a service named Invoice. This operation does not need to be labeled GetInvoiceHistory, because the invoice context is already established by the service name. GetHistory would be sufficient.

    Thomas really helped us move forward with our SOA initiative at CISTI both with a workshop to bootstrap our process, and through his books

    Posted via web from CodeBetter

    Why it's better to be lazy

    Musings on Language and Design
    Why it's better to be lazy
    by Jeremy Meyer
    June 8, 2008
    Summary
    Our parents were wrong when they told us not to be lazy. Laziness is a vital characteristic for success, and something we should strive for.

    Classifying People

    I have had recent to remember those 4 great classifications of people. Intelligent, Stupid, Active and Lazy.

    My father often used to tell me about these classifications which he attributed to the Duke of Wellington. I have since read articles which have attributed them originally to Buddha, or some Buddhist swami, but the most credible source seems to suggest that they are more likely to have come from Helmuth Karl Gernhard Graf von Moltke, a German Military leader and strategist. (see below).

    Actually it doesn't matter where they come from, the important thing is that they are an excellent insight into how and why people do things. If you haven't come across them before, they are very simple.

    Everyone can be loosely classified into 4 groups, which are permutations of either activeness or laziness and , intelligence or stupidity.

    Intelligent Lazy people, as my father would explain, are everyone's favourite. They do things in a smart way in order to expend the least effort. They don't rush into things, taking that little bit of extra time to think and find the shortest, best path. They tend to make what they do repeatable so they don't have to go through it all again. These people usually make good leaders, and they are good to have on teams.

    Intelligent Active people are useful, because they are smart, after all, but their intelligence can be slightly diluted or tempered by their activity. Where they don't have a perfect solution, they might act anyway, rather than sitting on their laurels, so useful people but not great leaders, and on a team, they can often put noses out of joint by acting too early and too fast.

    Stupid Lazy people have their place too, they are easy to manage, they generally don't act on their own initiative too much and, given tasks that are not beyond them, they will perform in a predictable, consistent manner. Usually they won't cause any harm on teams. Wellington, liked these people as foot soldiers.

    Stupid Active people are the dangerous ones. Their default behaviour is to act, and in the absence of skill or thought they can cause all types of trouble.

    Anecdotal Evidence

    Stupid Active people are definitely good for one thing, though, they make for great anecdotes! They are the exclusive recipients of the Darwin awards, after all. We all know one of two of these, I bet if you think about it right now, you can think of at least one person you work with who you could classify immediately as stupid and active.

    My own most recent amusing experience happened whilst on the management team for a large migration project. The team's task was to migrate UML Modelling projects from one version of UML to another, using Borland's Eclipse modelling tool, Together. In SCRUM tradition we had a daily call with our offshore team who were working on a backlog of many hundreds of projects that needed to be migrated. The task was fairly simple. Run the automated import facility, sanity check the project, and make any additional necessary changes to the UML model by hand.

    One of the team, let's call him "Fred", reported that his progress was blocked by strange behaviour in his migrated Eclipse project. Diagrams were disappearing and reappearing and something was wrong. I noticed from his screen capture that something was awry with his project icons. I asked him to show me the contents of his Eclipse .project file. It contained the line..

    <nature>uml14.uml14_nature</nature>

    This is the line in the project file that tells Eclipse what type of project it is, and it told me that his automated import had failed. Clearly it had aborted, unable to convert the project from one type to another, no doubt due to corrupted input. I asked him to clean up the original UML diagrams, and re-try the import.

    The following day, Fred reported that his icons were correct, but the project behaviour was still wrong. When I quizzed him on his approach, he explained that he had in fact edited the .project file by hand and changed the line above to:

    <nature>uml20.uml20_nature</nature>

    He had done this, he explained, because he had understood from what I had said that that particular line in the .project file was the problem. After much suppressed mirth, I patiently and politely explained that when changing the meta-model of one project to that of another, there was a great deal of work to be done, which is why it was automated, and why there was an import menu option for it. Manually changing the value of the "nature" tag in the project file didn’t change the nature of the project any more than wearing a baseball cap makes you a baseball player. To my astonishment, Fred defended himself with great verve. He stressed that he had "used his skills" in the best way he knew, to try and solve the problem. He seemed quite put out that I hadn't applauded his initiative. Not only was he actively stupid in his attempt to solve a problem, he was actively stupid in his attempt to justify it! Since he was my responsibility, but not my hire, I couldn't take what would have been my preferred action, firing him on the spot.

    Everybody can be Stupid

    Before I go on, I should say that Fred might well have been pretty smart in many ways. It has been my experience that you can't apply these classifications to people in general. There must be a context. You might be smart and lazy in your work, but stupid and active in the kitchen. I would like to believe that I am a smart, lazy software developer, but I am a very stupid, active DIY'er. Ask any of my friends who have been party to my crazy projects. My pond building exercise (where I cast my own bricks with moulds I made myself). Or my spontaneous tandoori oven, built from roof tiles at a holiday house in France (we ate cold, semi-raw chicken at 11pm that night). I am sure people do tend towards certain behaviours in all of their undertakings, but I think it is dangerous to apply the classifications generally. It is also hard to work with people whom you honestly believe are stupid in all walks of life. I have faith that there is something, somewhere that Fred does well and with careful consideration, but it certainly doesn't involve working with software tools.

    Safety Net for Lemmings

    My experience with Fred got me to thinking that when we create frameworks and even languages, we always try to cater for people like him. Some language designers feel this is their responsibility. Sometimes this is kind of helpful, like private methods and properties in a language, for example. Sometimes, it can be overly paternalistic. The old checked exception / unchecked exception debate springs to mind. C++ doesn't enforce the catching of an exception, Java does (with recent compromised made by Runtime exceptions). The question is, can you really defend yourself against active stupidity? Should you really try to defend yourself against it? Isn't it orthogonal to the actual intention of the effort, and just a bit like building safety nets on cliffs in case lemmings want to throw themselves off? (This is a metaphor, for more about the lemming myth, see the links below.) I was reviewing some code that looked like this, the other day:
       public void doStuff (int value) {  try {  applyCalculation();  } catch (Exception e) {  }  }    

    Ah, that old chestnut. A swallowed, unlogged, unreported exception. It was lucky that I picked it up in the code review. This is a fine example of active stupidity in programming. It is actually less work, (less typing, even), and smarter to write:

    	public void doStuff (int value) throws Exception {  		applyCalculation();  	}  

    .. clearly, having checked exceptions in your language is no defence against a developer who is this active.

    Should we try and drop all of these types of controls in language and architectures? Of course not, it is just that there is unlikely to be a linguistic construct or design approach which can prevent active stupidity without being so infuriating as to be almost unusable by someone whose approach is more lazy and intelligent. The acknowledgement of that should lead to a happy medium between choking restrictions and complete lack of structure.

    If you try to enforce exception handling, there will always be those who find a work-around for the construct. If you create a Singleton connection factory class to ensure a single point of connection there will always be someone who tries to hack their own independent connection to the server. If you try and enforce static type checking and make, say, a type-safe collection, there will always be someone who will explicitly typecast their Objects before they add them to make the code compile.. and so on.

    It's People who Write Programs

    Ultimately, until technology moves on significantly, it is people who are using programming languages and frameworks. The smart, lazy ones will be looking to reuse what they can and to find neat, idiomatic ways of achieving functionality. The active stupid people will be looking to "use their skills" like Fred did. And get stuff done.. Somehow.

    Training, documentation, teamwork, and feedback all help to make people smarter (if not less active) and that is where a great deal of effort needs to be applied.

    Too rigorous an amount of control in a language or framework doesn't do as much good as everyone thinks. It can often just create huge time overheads, as in the extra syntactic fluff needed to typecast because of Java's static type checking for example.

    Affordance

    An architecture or a syntax should provide a good context for creating idioms. It should make writing idiomatic code feel right without feeling that you have to jump through hoops. There should be an inherent affordance of the right thing to do.

    This puts a lot of faith in the user of the language/ framework or whatever, but there are very successful examples of this. Languages like Ruby and Python (and of course SmallTalk) which allow parametric polymorphism tend to be scary to Java developers, it is, after all, a bit unbridled and wild being able to send messages to any type, but hey, smart lazy people never seem to get into trouble with it.

    Perhaps a bit of judicious application of the 4 types would give us an idea who we should be looking out for in our designs and make us realise that some people don't need protection and others just can't be protected.

    Next week, why it is better to be rich than ugly.

    What do you think? Should we consider the importance of peoples' personalities when designing? What is your favourite anecdote of a stupid, active developer?

    I hope you enjoy classifying your collegues!

    Resources

    Bruce Eckel on The Checked Exception Debate:
    Checked Exception

    ..and The Static Typing Debate:
    Static Typing

    Helmuth Karl Bernhard Graf von Moltke
    Creators of the German Empire

    The Lemming Mass Suicide Myth
    The Lemming Myth

    Talk Back!

    Have an opinion? Readers have already posted 16 comments about this weblog entry. Why not add yours?

    RSS Feed

    If you'd like to be notified whenever Jeremy Meyer adds a new entry to his weblog, subscribe to his RSS feed.

    About the Blogger

    Jeremy has been designing and developing software for nearly 20 years, as well as teaching its mastery. He is fascinated by all aspects of architecture, design and development, the philosophical, the psychological and the aesthetic. He is currently a principal consultant for Borland Software in their modelling and design space.

    This weblog entry is Copyright © 2008 Jeremy Meyer. All rights reserved.

    Posted via web from CodeBetter

    Richard Dingwall » C# 3.0’s var keyword: Jeff Atwood gets it all wrong

    One of the new features of C# 3.0 is the var keyword, which can be used to implicitly declare a variable’s type. For example, instead of declaring the type, you can just write var instead, and the compiler will figure out what type name should be from the value assigned to it:

    1.// A variable explicitly declared as a certain type.
    2.string name = "Richard";
    3. 
    4.// A variable implicitly declared as the type being assigned to it.
    5.var name = "Richard";

    Note that a var isn’t a variant, so it’s quite different from say, a var in javascript. C# vars are strongly typed, so you can’t re-assign them with values of different types:

    1.var name = "Richard"
    2.name = 62; // error, can't assign an int to a string

    Vars were introduced to support the use of anonymous types, which don’t have type names. For example:

    1.var me = { Name: "Richard", Age: 22 };

    But there’s nothing to stop you from using vars with regular types. In a recent article on codinghorror.com, Jeff Atwood recommends using vars “whenever and wherever it makes [your] code more concise”. Guessing from his examples, this means everywhere you possibly can.

    The logic behind this is that it improves your code by eliminating the redundancy of having to write type names twice — once for the variable declaration, and again for a constructor.

    There’s always a tradeoff between verbosity and conciseness, but I have an awfully hard time defending the unnecessarily verbose way objects were typically declared in C# and Java.

    1.BufferedReader br = new BufferedReader (new FileReader(name));

    Who came up with this stuff?

    Is there really any doubt what type of the variable br is? Does it help anyone, ever, to require another BufferedReader on the front of that line? This has bothered me for years, but it was an itch I just couldn’t scratch. Until now.

    I don’t think he’s right on this one — my initial reaction is that using var everywhere demonstrates laziness by the programmer. And I don’t mean the good sort of laziness which works smarter, not harder, but the bad sort, which can’t be bothered writing proper variable declarations.

    Jeff is right though – writing the type name twice does seem a little excessive. However, as Nicholas Paldino notes, the correct way to eliminate this redundancy would be to make the type name on the right hand-side optional, not the left:

    While I agree with you that redundancy is not a good thing, the better way to solve this issue would have been to do something like the following:

    1.MyObject m = new();

    Or if you are passing parameters:

    1.Person p = new("FirstName", "LastName");

    Where in the creation of a new object, the compiler infers the type from the left-hand side, and not the right.

    Microsoft’s C# language reference page for var also warns about the consequences of using var everywhere.

    Overuse of var can make source code less readable for others. It is recommended to use var only when it is necessary, that is, when the variable will be used to store an anonymous type or a collection of anonymous types.

    In the following example, the balance variable could now theoretically contain an Int32, Int64, Single (float), Double, Decimal, or even a ‘Balance’ object instance, depending on how the GetBalance() method works.

    1.var balance = account.GetBalance();

    This is rather confusing. Plus, unless you explicitly down cast, vars are always the concrete type being constructed. Let’s go back to Jeff’s BufferedReader example, of which he asks, “is there really any doubt what type of the variable br is?”

    1.BufferedReader br = new BufferedReader (new FileReader(name));

    Actually, yes there is, because polymorphism is used quite extensively in .NET’s IO libraries. The fact that br is being implemented with a BufferedReader is most likely irrelevant. All we need is something that satisfies a Reader base class contract. So br might actually look like this:

    1.Reader br = new BufferedReader (new FileReader(name));

    Just because a language allows you to do something, doesn’t mean it’s a good idea to do so. Sometimes new features adapt well to solving problems they weren’t designed for, but this is not one of those situations. Stick to using vars for what they were designed for!

    June 21st, 2008 | 40 Comments

    Posted via web from CodeBetter

    Static Typing Where Possible, Dynamic Typing When Needed

    Instead of hammering on the differences between
    dynamically and statically typed languages, we should
    instead strive for a peaceful integration of static and dynamic
    aspect in the same language. Static typing where possible, dynamic
    typing when needed!

    Posted via web from CodeBetter

    2009年9月4日 星期五

    How to watch Hulu outside the USA

    Posted via web from Whatsoever

    再见,谷歌_李开复_新浪博客

       再见,谷歌

       李开复 

       时光荏苒,时光匆匆走过了一个四年,回望过去四年我在谷歌的职业生涯,所有的快乐、成就以及曾经面对的困难与挫折,所有的这一切如同一部电影在我的脑海里不断地闪过。在这离别之际,我不禁百感交集。在这四年时光里,谷歌中国从一个很小的雏形一直慢慢发展壮大,一直到今天,它成为了一家平稳,成熟,走上轨道的公司。

       在整整四年的时光里,我努力地把Google“平等、创新、快乐、无畏”的精神带到中国。这个过程并非一帆风顺,但是我们坚持着自己的信念与价值观,保持着超强的耐心精耕细作。

       我们压抑着做更酷、更炫的产品的欲望,努力耕耘最佳中文搜索。今天,谷歌中国的搜索质量已堪称最精确、最完整、最即时。优化中文搜索后,我们又开启了数十个产品,让谷歌中国的版图渐渐清晰。其中谷歌地图、谷歌手机地图、谷歌手机搜索、谷歌翻译都已经达到中国第一。另外,音乐搜索的推出,可以让网民首次享受到正版免费的音乐,创立了全球音乐下载的崭新模式。

       特别令我难忘的是我们热爱中国的员工面临雪灾、地震、风灾做出的及时产品和贡献,证实了谷歌中国人爱谷歌也爱中国,证实了谷歌中国人既能创新又有爱心。

       当我随意走进咖啡馆,看到年轻人在用谷歌的整合搜索查询信息,用地图查看实时交通流量,在iGoogle上挑选自己喜欢的“皮肤”(计算机界面),或者在用谷歌音乐听正版歌曲时,我都会露出发自内心的微笑。

       谷歌是一个伟大又可爱的公司,我非常感谢有这么一个千载难逢的机会,来从无到有地打造谷歌中国。在谷歌,我学到太多太多,无论是互联网技术、创新模式、价值观。

       对于谷歌,我现在已经没有遗憾,但我的人生还有一个缺憾没有实现,我想去弥补它。在过去的20年,我有幸在乔布斯、盖茨、施密特等身边学习成长,我有幸在PC时代历经苹果微软,我有幸在互联网时代历经谷歌,我有幸看到三个世界一流的公司的成长成功,我有幸在美国硅谷和中国的中关村崛起时,在这两个地方做过最有创意的工作。我拥有更多的是在科技领域的知识,更了解是企业成功的秘笈。这些职业经验才是我最有价值的资产,我非常希望能够把这些资产传授给中国青年。

       我的下一步就是和中国青年人一起打造新奇的技术奇迹,我想用自己的主动性做一个掌控全局的工作。我已经到了这个人生阶段,再不去做,我真的很怕来不及了。

       所以,尽管加州的山景城再次向我伸出了橄榄枝,希望我再续约四年,但是我却在此刻做出了发自内心的选择,我希望帮助年轻人圆梦的同时也圆自己的创业梦想。

       这个周末,我终于能够从业务发展、战略策划、离职宣布、工作交接中松一口气。这个周末,我会把我的思路理顺。下周,我会和大家分享的我的“从心选择”计划。

       每当我想到我将迈出的一步,我就会想起苹果创始人乔布斯的名言:

       “最重要的,拥有跟随内心与直觉的勇气,你的内心与直觉多少已经知道你真正想要成为什么样的人。任何其它事物都是次要的。”

    Posted via web from Does IT Matters?

    Robbers empty Apple store in 31 seconds

    Posted via web from Whatsoever

    Coding Horror: Get Your Database Under Version Control

    Posted via web from CodeBetter

    2009年9月3日 星期四

    Microsoft's grip on users is being lost in the 'clouds'

    Posted via web from Does IT Matters?

    2009年9月2日 星期三

    Key legal win for open source

    Posted via web from Does IT Matters?