CHAPTER 5 PERMUTATIONS PATTERN 117 Understanding Why (Web design service)
CHAPTER 5 PERMUTATIONS PATTERN 117 Understanding Why the Resource Is Separated from the Representation The need to separate the resource from the representation has not been adequately explained, and some developers may wonder why it is necessary at all. After all, many websites work well and nobody has complained too loudly. The reason why many websites work well is because they have probably implemented the separation of resource from representation. And those that have not done so have received complaints. Separating the resource from the representation is not complicated, but it is associated with quite a bit of grunt work. What makes matters more complicated is that many of today s web application frameworks get it completely wrong as they bind resource with representation. It s not that today s web application technologies cannot manage resources and representations properly, but the fact is that they don t do it. To illustrate the separation of resource from representation, consider the following C# code: interface IBase { void Method(); } class Implementation1 : IBase { public void Method() { } } class Implementation2 : IBase { public void Method() { } } The interface IBase defines a method and is implemented by two classes, Implementation1 and Implementation2. This is called interface-driven development because when the client uses either of the implementations, the client doesn t use the implementations but the interface of the implementations, as illustrated by the following source code: class Factory { public static IBase Instantiate() { return new Implementation1(); } } class UseIt { public void Method() { IBase obj = Factory.Instantiate(); // … } }
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.