43238

Designing a system with a presentation layer and a web service-based API

Question:

We are designing a system that has functionality that is essentially the same at the presentation layer and the exposed API layer. My question is what technique / strategy to use so we can get the most reuse out of our code with performance in mind?

Here's a simplified example:

A user can add a <strong>Customer</strong> via a web form. This will fire the Customer.Create() method.

An API consumer / user can add a <strong>Customer</strong> via a SOAP / HTTP-POST to a web service which will call the Customer.Create() method.

Imagine these layers:

PRESENTATION | | WEB SERVICE API (Customer.Create() is available here | | FACADE Business Object Interface - Customer.Create() signature is here | | BUSINESS Business object - Customer.Create method() is fleshed out here | | DATA ACCESS - Writes data

The presentation layer SOAP calls the Create() web method, which calls the facade's Create() method which calls the business object's Create() method which wires via the data access layer.

<strong>Questions:</strong>

Is there a concern about performance in using the API's web services in our presentation layer, or are there alternatives to connect the presentation layer directly to the facade? If so, what technology to use (WCF, Remoting, Web Services, etc)?

Please let me know if you need any more clarification. I am having trouble finding out if it is common to consume your API in a presentation layer, or do you "go around it" for performance reasons.

Any other concerns that I may not be seeing?

Thanks!

Answer1:

Have a look at this question and answers given (one mine):

<a href="https://stackoverflow.com/questions/3867978/wcf-and-n-tier-architecture-and-serialization-performance" rel="nofollow">WCF and n-tier architecture and serialization performance</a>

I think your tiers are fine if they are all <strong>logical</strong> although I would personally not use Facade and instead I would use an ORM for connecting to database.

Regarding technologies, WCF and ASP.NET MVC are so much better choices over web services which is old and ineffecient now. Remoting was superceded by WCF and should never be used now.

Answer2:

Your Web Service API and the facade are redundant. I'm thinking if you implement the actual objects in each layer, I think you'll find that one or the other of those two layers's objects are just pass-through objects.

The business layer object for something as simple as a CreateCustomer() may seem redundant, also, but for more complex functions, you'll find the business layer brings several atomic calls under one transaction.

Recommend

  • OpenSubKey under HKLM\\Software returning null
  • Numberlink/Flow Game: How to spot NP-Complete problems?
  • SAS change date format
  • Why is this procedure generating two Emails?
  • spark in python: creating an rdd by loading binary data with numpy.fromfile
  • UITableView not scrollable but enough height
  • Don't understand rounding behavior in sql server when using division operator
  • Ternary Best Practice
  • Selenium 2 : finding web element locators programatically
  • What is the behavior of document.createElement when passed as an argument?
  • How to Enable Systemd service in openshift/jenkins-1-centos7 docker container?
  • Hive Metastore is not creating MYSQL or Derby Connection
  • Python: Why am I getting a UnicodeDecodeError?
  • How to customize marker colors and shapes in scatter plot?
  • Multiple JSliders reacting to each other to always equal 100 percent
  • How to create wsdl from xsd
  • configure openjpa on to spring boot
  • Corda: How to implement hierarchical relationships between state data persisted to H2
  • Disabling swipe gesture in Windows Phone 8.1 pivot control
  • Multiple canvases (pages) in Fabric.js
  • How to display content depending on dropdown menue user selection
  • Annotate objects in a queryset with next and previous object ids
  • How to define something in JavaScript [closed]
  • Ruby regex for matching simpliest Ruby's regexes
  • using maven pom while creating jar:test-jar some times it says JAR will be empty - no content was ma
  • How to split wav file into two or more parts using c#
  • Content-Type alternative in MQTT
  • Amazon Elastick BeanStalk error: Failed to create the AWS Elastic Beanstalk application version
  • How to specify generic type when the type is only known at runtime?
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • How to decleare char *const argv[] in swift [duplicate]
  • Did not understand process of initialize in swift programming
  • How to encrypt Connectionstring written in web.config from codebehind?
  • Grails - How to implement a foreign key relationship not using an id column?
  • Call Microservice from another Microservice within Docker
  • Running R's aov() mixed effects model from Python using rpy2
  • Time Complexity of Fibonacci Algorithm [duplicate]