IEG3080 Tutorial 11 Prepared by Ryan. Outline Enterprise Application Architecture Layering Structure Domain Logic C# Attribute Aspect Oriented Programming.

Slides:



Advertisements
Similar presentations
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
Advertisements

Attributes Programming in C# Attributes CSE 494R (proposed course for 459 Programming in C#) Prof. Roger Crawfis.
2 Object-Oriented Analysis and Design with the Unified Process Objectives  Explain how statecharts can be used to describe system behaviors  Use statecharts.
Chapter Object-Oriented Practices. Agenda Object-Oriented Concepts Terminology Object-Oriented Modeling Tips Object-Oriented Data Models and DBMSs.
Enterprise Applications & Java/J2EE Technologies Dr. Douglas C. Schmidt Professor of EECS.
IEG3080 Tutorial 7 Prepared by Ryan.
Designing a Database Unleashing the Power of Relational Database Design.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Chapter 11 Data Management Layer Design
II. Middleware for Distributed Systems
AspectJ2EE/Clasa Israel Institute of Technology The Computer Science department Itay Maman.
11/5/01OO Design1 Design Object-Oriented Design. 11/5/01OO Design2 Object-Oriented Design  The process of determining the architecture, and specifying.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Client/Server Software Architectures Yonglei Tao.
UNIT-V The MVC architecture and Struts Framework.
OOP Languages: Java vs C++
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
Introduction To System Analysis and design
Programming Languages and Paradigms Object-Oriented Programming.
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
Chapter 4 The Relational Model.
Systems analysis and design, 6th edition Dennis, wixom, and roth
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
Data Access Patterns Some of the problems with data access from OO programs: 1.Data source and OO program use different data modelling concepts 2.Decoupling.
Geog 495 GIS Database Design Midterm review. Outlines 1.Database Concepts 2.Relational Database 3.Object-oriented Database 4.Entity-Relationship Diagram.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Aspect Oriented Programming (AOP) in.NET Brent Krueger 12/20/13.
Shaowen Wang CyberInfrastructure and Geospatial Information Laboratory (CIGI) Department of Geography and National Center for Supercomputing Applications.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
1 Another group of Patterns Architectural Patterns.
Object Oriented Design Jerry KotubaSYST Object Oriented Methodologies1.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
Object Persistence Design Chapter 13. Key Definitions Object persistence involves the selection of a storage format and optimization for performance.
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
Object-to-Relational Mapping: The Crossing Chasms Pattern and Implementation Considerations Use of Meta Data in the Java Persistence Layer Presented by.
Hibernate Persistence. What is Persistence Persist data to database or other storage.  In OO world, persistence means persist object to external storage.
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
1 Mapping to Relational Databases Presented by Ramona Su.
Pertemuan 10 Enterprise Application Patterns Mata kuliah: T0144 – Advanced Topics in Software Engineering Tahun: 2010.
Domain and Persistence Patterns. Fundamental Pattern Types Design Patterns Business Logic Patterns.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Chapter 38 Persistence Framework with Patterns 1CS6359 Fall 2011 John Cole.
Domain Driven Web Development With WebJinn Sergei Kojarski College of Computer & Information Science Northeastern University joint work with David H. Lorenz.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Oct * Brad Tutterow. VS 2008.NET 3.5LINQ Entity Framework  The ADO.NET Entity Framework is part of Microsoft’s next generation of.NET technologies.
Kal Bugrara, Ph.DSoftware Engineering Northeastern University Fundamentals Of Software Engineering Lecture V.
Module 14: Attributes. Overview Overview of Attributes Defining Custom Attributes Retrieving Attribute Values.
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
University of Toronto at Scarborough © Kersti Wain-Bantin CSCC40 system architecture 1 after designing to meet functional requirements, design the system.
Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Object Oriented Database By Ashish Kaul References from Professor Lee’s presentations and the Web.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Elaboration Iteration 3 – Part 3 - Persistence Framework -
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Bruno Cabral “Reflection, Code Generation and Instrumentation in the.NET platform” University of Coimbra.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
L’origine dei mali: le dipendenze tra componenti Stefano Leli 14° Workshop DotNetMarche Venerdì 16 aprile
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
POOL persistency framework for LHC
Ch > 28.4.
Enterprise Architecture Patterns
Object Relational Mapping Tools
INHERITANCE.
Presentation transcript:

IEG3080 Tutorial 11 Prepared by Ryan

Outline Enterprise Application Architecture Layering Structure Domain Logic C# Attribute Aspect Oriented Programming (AOP)

Enterprise Application Architecture Complex systems always break down into layers e.g. Networking – OSI 7 layers Model Pros Working on a single layer without knowing much about other layers Minimizing dependencies between layers Con Transforming from layers harming performance

Enterprise Application Architecture Enterprise Application Architecture – 3-layer Presentation Layer Display of information e.g. GUI windows, webpage Handling user commands Domain Logic Layer Business logic (Core) Data Source Layer Communication with database, messaging systems

Enterprise Application Architecture Domain Logic Patterns Domain Model An object model of the domain that incorporates both behavior and data  Solving the problem in object-oriented way Pro – Handling complex logic in a well-organized way Con – “Impedance mismatch” between OO model and relational database

Enterprise Application Architecture O/R Mapping Problems – Identity Problem OO – Different objects referenced by different pointers Database – Different rows identified by primary key Solutions Identity Field Team IDTeam Name public class Team { int TeamID; string TeamName; } Key Identity Field

Enterprise Application Architecture O/R Mapping Problems – Identity Problem Solutions (Cont’d) Foreign Key Mapping Team Team ID Team Name Player Player ID Player Name Player IDTeam IDPlayer Name Team IDTeam Name * 1 Foreign Key Mapping

Enterprise Application Architecture O/R Mapping Problems – Inheritance Student Name School University Student Department Secondary Student Class CUHK Student College How to do mapping?

Enterprise Application Architecture O/R Mapping Problems – Inheritance Single Table Inheritance Wasting space – many null columns Concrete Table Inheritance Changing the superclass  altering all the subclasses’ tables NameSchoolClassDepartmentCollege NameSchoolClass NameSchoolDepartment NameSchoolDepartmentCollege

Enterprise Application Architecture O/R Mapping Problems – Inheritance Class Table Inheritance Requiring multiple joins to rebuild an object NameSchool Class Department College

Enterprise Application Architecture Solutions OO databases Not common (relational databases are widely adopted) Tight coupling with the domain model Automated O/R mapping tools Not prefect (may solve 80% of the problems) Expensive

Enterprise Application Architecture Other Domain Logic Patterns Transaction Scripts Organizes business logic by procedures where each procedure handles a single request from the presentation  Server page (php, jsp), CGI scripts Table Module A single instance that handles the business logic for all rows in a database table or view  Commonly use in.NET development platform

C# Attribute Embedding information in C# code Placed in square brackets [ ], above an Attribute Target (e.g. class, field or method) Reflection Querying information at run-time Dynamically invoking methods [serializable] public class Test { … }

C# Attribute Intrinsic Attribute Built-in attributes in.NET Common Library Runtime (CLR) Examples In your assignment 1  [assembly: AssemblyVersion(“ ”)] [serializable] [STAThread]

C# Attribute Custom Attribute Create your custom attribute // Set what kinds of elements can use this custom attribute [AttributeUsage(AttributeTargets.All)] public class MyAttribute : Attribute { // Define your own attribute string myName; public MyAttribute(string name) { myName = name; } public string Name { get { return myName; } } Use your custom attribute [MyAttribute("MyClass")] public class Test { [MyAttribute("MyMethod")] public void Print { Console.WriteLine("Test Program"); }

C# Attribute Reflection – Querying information public class MyProgram { public static void Main() { Type type = Type.GetType("Test"); foreach (Attribute attr in type.GetCustomAttributes(false)) { // Retrieve attributes for the class MyAttribute myattr = attr as MyAttribute; if (myattr != null) Console.WriteLine(attr.Name); } foreach(MethodInfo method in type.GetMethods()) { foreach (Attribute attr in method.GetCustomAttributes(false)) { // Retrieve attributes for the method MyAttribute myattr = attr as MyAttribute; if (myattr != null) Console.WriteLine(“Method: {0} with Attribute: {1}”, method, attr.Name); } Output MyClass Method: Void Print() with Attribute: MyMethod

C# Attribute Reflection – Invoking methods public class MyProgram2 { public static void Main() { Type type = Type.GetType("Test"); Object o = Activator.CreateInstance(type); // Create a “type” object MethodInfo mi = type.GetMethod("Print"); mi.Invoke(o, null); // Invoke method - “mi” } Output Test Program

Aspect Oriented Programming OOP Breaking down a complex system into modules Encapsulating responsibilities into different objects Problems Some tasks cut across multiple modules (crosscutting concern)  Logging  Authentication Solution: Aspect Oriented Programming (AOP)

Aspect Oriented Programming AOP in C# Non-AOP Implementation public class Test { public void TestMethod() { Log log = new Log(); log.Print("Enter"); // Log when entering this method Console.WriteLine("Test Method"); log.Print("Leave"); // Log with leaving this method } AOP Implementation [AttributeUsage(AttributeTargets.Class)] public class LogAttribute : ContextAttribute { // Code Here } public class LogProperty : IContextProperty, IContributeObjectSink { // Code Here } public class LogAspect : IMessageSink { // Code Here } [Log] public class Test : ContextBoundObject { public void TestMethod() { Console.WriteLine("Test Method"); }

Aspect Oriented Programming How does it work in C# “ContextAttribute” and “ContextBoundObject” Intercepting the calls(Interception) ClientYourObject ClientYourObject Transparent Proxy Message Sink Without Interception With Interception Intercepted by.NET

References Enterprise Application Architecture M. Fowler, “Patterns of Enterprise Application Architecture”, Addison Wesley C# Attribute /ch18.html /ch18.html Aspect Oriented Programming (AOP) /AOP/ /AOP/