.NET Mobile Application Development Distributed Application Design - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

.NET Mobile Application Development Distributed Application Design

Description:

In previous lectures we have examined. Characteristics of mobile and distributed applications ... a few chunky' interactions are better than many chatty' interactions ... – PowerPoint PPT presentation

Number of Views:141
Avg rating:3.0/5.0
Slides: 14
Provided by: www2Dcs
Category:

less

Transcript and Presenter's Notes

Title: .NET Mobile Application Development Distributed Application Design


1
.NET Mobile Application DevelopmentDistributed
Application Design
2
Introduction
  • In previous lectures we have examined
  • Characteristics of mobile and distributed
    applications
  • Contemporary mobile and distributed computing
    technologies
  • In this session we give an overview of
  • Distributed application design
  • Common distributed application software
    architectures

3
Technology Limitations
  • Design must take account of practicalities of
    existing distributed technologies
  • failure to do so may produce elegant but
    unworkable solutions
  • Current distributed technologies offer a
    compromise between networking technology and
    object-oriented design
  • Distributed components are not full partners in
    an OO design and should
  • not be perceived as abstractions of real-world
    entities
  • be considered as service providers which
    aggregate operations

4
Remote Objects Are Not Objects
  • Local and remote code are used (transparently) in
    the same way but should be designed differently
  • Local objects provide
  • an abstraction of a real-world entity
  • methods/properties that abstract real-world
    behaviour and may be used in conjunction with
    each other
  • Remote objects
  • involve network communication and delays
  • orders of magnitude slower than local interaction
  • should be designed as collection of utility
    functions
  • reduces network traffic and latencies and
    increases overall system performance

5
Example Transferring Funds
// Server code public class Account private
int _accountID private decimal _balance
public int AccountID get return _accountID
set _accountID value public decimal
Balance get return _balance set _balance
value public void Update() //
Update account record in database public void
Insert() // Inserts new record into database
public void Delete() // Deletes record
corresponding to this class public void
Fill() // Gets database record which matches
this class
// Client code void TransferFunds(decimal amount)
Account accA new Account() Account accB
new Account() // Retreive account
balances accA.AccountID 100 accA.Fill()
accB.AccountID 201 accB.Fill()
accA.Balance - amount accB.Balance
amount accA.Update() accB.Update()
6
A Service-Provider Solution
  • // Server code
  • public class AccountUtility
  • public void UpdateAccount(int accountID, decimal
    balance)
  • // Update account record in database
  • public void InsertAccount( int accountID,
    decimal balance)
  • // Inserts new account record into database
  • public void Delete(int accountID)
  • // Deletes corresponding database record
  • public void TransferFunds( int accountFromID,
  • int accountToID,
  • decimal balance)
  • // Uses database transaction to modify the two
    accounts

7
Remote Objects and State
  • Remote objects may be
  • Stateless retain no information between calls
  • Stateful - store state information in memory
    between calls
  • Stateful objects
  • use memory in storing state this works well with
    small number of clients but memory load increases
    drastically with large number of clients
  • are effectively bound to a single machine, making
    it hard to use load balancing for good
    distributed performance
  • Stateless objects are best design choice
  • XML Web Services are completely stateless
  • State can be maintained using session tracking
    but this is inefficient and not recommended

8
Design Guidelines for Distributed and Mobile
Applications
  • Design components with distributed architecture
    in mind
  • deploy them to separate computers only when
    required
  • Distributed architecture is needed
  • to support unmodifiable legacy apps or
    multi-platform 3rd party apps
  • if scalability issues are more important than
    small-scale performance
  • to support interaction from a mobile device
  • mobile devices have resource limitations (e.g.
    memory capacity, processing power) and it may be
    necessary to shift computation / data storage to
    another device in the network

9
Design Principles
  • The following principles are useful in designing
    distributed applications
  • Aim to reduce communication frequency
  • a few chunky interactions are better than many
    chatty interactions
  • Follow the principle of locality
  • interacting objects should be close together
  • Remote objects should be
  • be stateless wherever possible and designed as
    service providers
  • Successful distributed applications
  • guide clients towards proper usage
  • restrict performance limiting options

10
Layered Design
  • Layered design is sound software engineering
  • can be difficult to avoid!
  • 3-tier designs have
  • Presentation layer
  • user interface logic
  • typically the only role of a mobile client
  • Business logic layer
  • business-specific rules
  • Data logic layer
  • management of back-end data store

11
Business Rules
  • Strict 3-tier design requires business rules to
    be placed in the middle layer
  • This is not always practical early designs used
    stateful objects to achieve this and performance
    was dreadful
  • Some business rules belong in the user interface
  • e.g. validating user input should not require
    interaction with remote objects
  • Other business rules have to be in the data logic
    layer
  • e.g. verifying referential integrity requires
    access to other data already in the database
  • Performance gains can result from implementing
    business rules as stored database procedures
  • For maximum performance, aim for one stored
    procedure which performs all required operations
    on a single business object

12
Summary
  • In this session we have discussed
  • Design principles for distributed applications
  • Performance and scalability
  • Layered designs
  • In the next session we conclude our study of
    mobile devices in distributed applications by
    considering device and application security

13
Reading and Resources
  • Reading
  • Matthew MacDonald, Microsoft .NET Distributed
    Applications Integrating XML Web services and
    .NET Remoting, Microsoft Press, 2003
  • Chapter 10, pp 329 - 358
  • Resources
  • Microsoft Patterns and Practices
  • Enterprise Solution Patterns using Microsoft
    .NET, http//msdn.microsoft.com/architecture/patte
    rns/default.aspx?pull/library/en-us/dnpatterns/ht
    ml/Esp.asp
  • Application Architecture for .NET Designing
    Applications and Services, http//msdn.microsoft.c
    om/library/default.asp?url/library/en-us/dnbda/ht
    ml/distapp.asp
  • Yukon Basics, http//msdn.microsoft.com/msdnmag/is
    sues/04/02/YukonBasics/default.aspx
Write a Comment
User Comments (0)
About PowerShow.com