SlideShare a Scribd company logo
1 of 45
CSE 136 - Lecture 5 Part 1
What is Business Logic Layer
What is Business Logic Layer 2
   Services
       exposing business logic to outside system
       GPA system can provide graduation status for students
   Entities
       Students taking courses. Courses have schedules and
        location.
       Courses are categorized by departments.
   Rules, Calculations
       Students can only register 20 units maximum per quarter
       CSE136 must be taken after CSE135, etc.
   Validation                           Cannot rely JavaScript for validation
       Is the social security # 9 digits?
       Is credit card all digits?
Business Layer Patterns
   Procedure Pattern           1980s

       Transcript Script pattern - A collection of procedures
        (steps of execution).
   Table Module Pattern        1990s

       similar to transaction script but operations are
        grouped by data (dataSet/dataTable)
   Object-based Pattern        21th century
     Interrelated & Interconnected objects.
     Active Record Pattern - record looks like data tables
      from the database with additional methods()
     Domain Model Pattern - not ER diagrams, but OOD
      diagrams
Procedure Pattern
   Map your business components directly onto
    required user actions.
   Best suited for simple scenarios and unlikely
    changing spec
   Simple and no start-up cost
   Can not handle large/complex specs
   As complexity grow, becomes more costly (not
    easily extended)
   CSE 136 will NOT use this design pattern
Table Module Pattern
   Remember DataSet
    in DAL (ADO.NET)        Built-in in ASP.NET
   Series of transaction
    grouped by Data
   Grouping the
    info/table by how
    data are related
   Good for quick
    presentation display
Table Module Pattern 2
   What's wrong with this
    Pattern?
   You must wait for SQL
    stored procedures to
    finish
   If SQL proc changes, it
    changes the BL
    structure
     remove a column
     changed a column
      name
     You can't catch this
      error through unit
Object-based Pattern - Active
Record Pattern
   Active Record Pattern is based on DataSet
    design but create class object for each
    DataTable.
   Duplication and quite a hassle
   Better than Table Module Pattern
     SQL   Proc changes won't affect outcome
   One step closer to Object Oriented Design, but
    not object-oriented yet
Object-based pattern - Active Record
Pattern ex
Object-Based Patterns - Domain Model
Pattern
   Domain Model is also known as Object-
    Oriented Design
   Define the entities and the relationships &
    flows between them
   Each Entity has data (variables) & behavior
    (methods)
   Consider the issues of “coupling” and
    “cohesion”. “Reuse”, “Maintainability”, and
    “Extensibility”
   A diagram can be really large (divide &
    conquer)
   More Object-oriented design using Design
Compare the Patterns
Domain Model to ER (DAL)
Class Objects Design - steps
   Start with use case diagram
   Run thru activity diagram to identify entities
    and high-level relationship
   Run thru sequence diagram again to identify
    attributes and methods for each entities.
     You   may skip this step for 136 to save time
UML Review 1
UML Review 2
Domain Model – class diagram
ex1



                Database ER diagram is hidden away
                From the Domain Model

                How many tables to store student
                info?
Domain Model – class diagram
ex2




         Review table in the database may have
         a order_id, but in Domain Model, it is not
         used.
Domain Model – class diagram
ex3




               Database ER diagram will have more
               tables to stored these information
               (vehicle, make, model, vendor, produc
               t, location, back_order, etc).
Domain Model – class diagram
ex4
Break Time
CSE 136 - Lecture 5 Part 2
Why use Design Patterns
   Provide a starting point for a solution
   Speed up productivity in a team
   Improves system and application design
   Carpenter: connector design pattern
Object-oriented Design Patterns
   Creational
     The creational patterns aim to separate a system from
      how its objects are created, composed, and
      represented
     They increase the system’s flexibility in terms of the
      what, who, how, and when of object creation
   Structural
       Structural patterns are concerned with how classes
        and objects are composed to form larger structures
   Behavioral
     Behavioral patterns identify common communication
      patterns between objects
     They increase flexibility in carrying out this
      communication
Creational Patterns
   Factory
   Singleton
   Prototype (skip)
   Abstract Factory (skip)
   Builder (skip)
Creational - Factory example
                        Logging C# example
                        available on class
                        homepage (136 project)




                        Polymorphism
Creational - Factory
Creational - Singleton
Creational - Singleton Code




                    C# interview question
Structural Design Patterns
   Decorator
   Proxy
   Adapter
   Facade
   Bridge (skip)
   Composite (skip)
   Flyweight (skip)
Structural - Decorator example
Structural - Decorator




                         .NET libraries are
                         based on decorator
                         pattern
Structural - Proxy example
Structural - Proxy
Structural - Adapter example
Structural - Adapter
Structural - Facade
Behavioral Pattern
   Strategy
   Chain of Responsibility
   Iterator (skip - you have seen this in C#
    lecture “enumerator”)
   Skip:
    Observer, Command, Mediator, Memento, Stat
    e, others…
Behavioral - Strategy example




                       Polymorphism
Behavioral - Strategy




                        Polymorphism


     Client may come
     From GUI
Behavioral - Chain example




                  Polymorphism
Behavioral - Chain




                     Polymorphism
Review question
   Why does domain model a better pattern at the
    end?
   What are the three categories of OO design
    pattern?
   Why are inheritance and polymorphism the
    center of OO design pattern?
       Open/close principal, code flexibility.
Demo Code
   Business Logic Layer
   Domain Objects
   Error Logging implementation (factory pattern)
   Data Transfer Object
Your Assignment
   Due next Thursday
   Design and develop business layer based on
    UML
     UML  class diagram for Domain Object Model
     C# Domain Model classes
     C# Domain Business Logic
     Must use creational pattern for error-logging (log
      to db or file based on app.config)
     Must use asynchronous call for error-logging
     Validations (regular expression – cover in day6)

   Developing test cases for your business layer
References
   .NET : Architecting Applications for the
    Enterprise
   Design Patterns: Elements of Re-usable
    Object-Oriented Software
   C# Design Patterns

More Related Content

What's hot

Jdbc slide for beginers
Jdbc slide for beginersJdbc slide for beginers
Jdbc slide for beginersAmbarish Rai
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivityVaishali Modi
 
J2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenJ2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenlissa cidhi
 
Database and Java Database Connectivity
Database and Java Database ConnectivityDatabase and Java Database Connectivity
Database and Java Database ConnectivityGary Yeh
 
Jdbc in servlets
Jdbc in servletsJdbc in servlets
Jdbc in servletsNuha Noor
 
Java Database Connectivity
Java Database ConnectivityJava Database Connectivity
Java Database Connectivitybackdoor
 
SQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJSQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJDharita Chokshi
 
.NET Attributes and Reflection - What a Developer Needs to Know...
.NET Attributes and Reflection - What a Developer Needs to Know....NET Attributes and Reflection - What a Developer Needs to Know...
.NET Attributes and Reflection - What a Developer Needs to Know...Dan Douglas
 
Java- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionJava- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionMazenetsolution
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types pptkamal kotecha
 

What's hot (20)

Jdbc
JdbcJdbc
Jdbc
 
Jdbc slide for beginers
Jdbc slide for beginersJdbc slide for beginers
Jdbc slide for beginers
 
JDBC Tutorial
JDBC TutorialJDBC Tutorial
JDBC Tutorial
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
J2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for womenJ2EE PPT --CINTHIYA.M Krishnammal college for women
J2EE PPT --CINTHIYA.M Krishnammal college for women
 
Jdbc complete
Jdbc completeJdbc complete
Jdbc complete
 
Jdbc
JdbcJdbc
Jdbc
 
L04 base patterns
L04 base patternsL04 base patterns
L04 base patterns
 
Database and Java Database Connectivity
Database and Java Database ConnectivityDatabase and Java Database Connectivity
Database and Java Database Connectivity
 
Overview Of JDBC
Overview Of JDBCOverview Of JDBC
Overview Of JDBC
 
Jdbc in servlets
Jdbc in servletsJdbc in servlets
Jdbc in servlets
 
Jdbc
JdbcJdbc
Jdbc
 
Java Database Connectivity
Java Database ConnectivityJava Database Connectivity
Java Database Connectivity
 
SQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJSQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJ
 
.NET Attributes and Reflection - What a Developer Needs to Know...
.NET Attributes and Reflection - What a Developer Needs to Know....NET Attributes and Reflection - What a Developer Needs to Know...
.NET Attributes and Reflection - What a Developer Needs to Know...
 
Jdbc
JdbcJdbc
Jdbc
 
Java- JDBC- Mazenet Solution
Java- JDBC- Mazenet SolutionJava- JDBC- Mazenet Solution
Java- JDBC- Mazenet Solution
 
JDBC
JDBCJDBC
JDBC
 
Jdbc
JdbcJdbc
Jdbc
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
 

Similar to Day5

Third AssignmentDescribe in 100 – 200 words an application with .docx
Third AssignmentDescribe in 100 – 200 words an application with .docxThird AssignmentDescribe in 100 – 200 words an application with .docx
Third AssignmentDescribe in 100 – 200 words an application with .docxrandymartin91030
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfB.T.L.I.T
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptVGaneshKarthikeyan
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptVGaneshKarthikeyan
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptVGaneshKarthikeyan
 
Be a database professional
Be a database professionalBe a database professional
Be a database professionalSayed Ahmed
 
Be a database professional
Be a database professionalBe a database professional
Be a database professionalSayed Ahmed
 
Data modeling star schema
Data modeling star schemaData modeling star schema
Data modeling star schemaSayed Ahmed
 
Data Access Tech Ed India
Data Access   Tech Ed IndiaData Access   Tech Ed India
Data Access Tech Ed Indiarsnarayanan
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docx
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docxUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docx
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docxganeshkarthy
 
Object oriented methodologies
Object oriented methodologiesObject oriented methodologies
Object oriented methodologiesnaina-rani
 
New phase ii-2010
New  phase ii-2010New  phase ii-2010
New phase ii-2010vijet
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)David McCarter
 
No more Three Tier - A path to a better code for Cloud and Azure
No more Three Tier - A path to a better code for Cloud and AzureNo more Three Tier - A path to a better code for Cloud and Azure
No more Three Tier - A path to a better code for Cloud and AzureMarco Parenzan
 
Chapter 7 Design Architecture and Methodology1.docx
Chapter 7 Design Architecture and Methodology1.docxChapter 7 Design Architecture and Methodology1.docx
Chapter 7 Design Architecture and Methodology1.docxmccormicknadine86
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)David McCarter
 

Similar to Day5 (20)

Day1
Day1Day1
Day1
 
Third AssignmentDescribe in 100 – 200 words an application with .docx
Third AssignmentDescribe in 100 – 200 words an application with .docxThird AssignmentDescribe in 100 – 200 words an application with .docx
Third AssignmentDescribe in 100 – 200 words an application with .docx
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdf
 
Design engineering
Design engineeringDesign engineering
Design engineering
 
Design engineering
Design engineeringDesign engineering
Design engineering
 
Sw Software Design
Sw Software DesignSw Software Design
Sw Software Design
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.pptUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
 
Data modeling star schema
Data modeling star schemaData modeling star schema
Data modeling star schema
 
Data Access Tech Ed India
Data Access   Tech Ed IndiaData Access   Tech Ed India
Data Access Tech Ed India
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docx
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docxUNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docx
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.docx
 
Object oriented methodologies
Object oriented methodologiesObject oriented methodologies
Object oriented methodologies
 
New phase ii-2010
New  phase ii-2010New  phase ii-2010
New phase ii-2010
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)
 
No more Three Tier - A path to a better code for Cloud and Azure
No more Three Tier - A path to a better code for Cloud and AzureNo more Three Tier - A path to a better code for Cloud and Azure
No more Three Tier - A path to a better code for Cloud and Azure
 
Chapter 7 Design Architecture and Methodology1.docx
Chapter 7 Design Architecture and Methodology1.docxChapter 7 Design Architecture and Methodology1.docx
Chapter 7 Design Architecture and Methodology1.docx
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Day5

  • 1. CSE 136 - Lecture 5 Part 1
  • 2. What is Business Logic Layer
  • 3. What is Business Logic Layer 2  Services  exposing business logic to outside system  GPA system can provide graduation status for students  Entities  Students taking courses. Courses have schedules and location.  Courses are categorized by departments.  Rules, Calculations  Students can only register 20 units maximum per quarter  CSE136 must be taken after CSE135, etc.  Validation Cannot rely JavaScript for validation  Is the social security # 9 digits?  Is credit card all digits?
  • 4. Business Layer Patterns  Procedure Pattern 1980s  Transcript Script pattern - A collection of procedures (steps of execution).  Table Module Pattern 1990s  similar to transaction script but operations are grouped by data (dataSet/dataTable)  Object-based Pattern 21th century  Interrelated & Interconnected objects.  Active Record Pattern - record looks like data tables from the database with additional methods()  Domain Model Pattern - not ER diagrams, but OOD diagrams
  • 5. Procedure Pattern  Map your business components directly onto required user actions.  Best suited for simple scenarios and unlikely changing spec  Simple and no start-up cost  Can not handle large/complex specs  As complexity grow, becomes more costly (not easily extended)  CSE 136 will NOT use this design pattern
  • 6. Table Module Pattern  Remember DataSet in DAL (ADO.NET) Built-in in ASP.NET  Series of transaction grouped by Data  Grouping the info/table by how data are related  Good for quick presentation display
  • 7. Table Module Pattern 2  What's wrong with this Pattern?  You must wait for SQL stored procedures to finish  If SQL proc changes, it changes the BL structure  remove a column  changed a column name  You can't catch this error through unit
  • 8. Object-based Pattern - Active Record Pattern  Active Record Pattern is based on DataSet design but create class object for each DataTable.  Duplication and quite a hassle  Better than Table Module Pattern  SQL Proc changes won't affect outcome  One step closer to Object Oriented Design, but not object-oriented yet
  • 9. Object-based pattern - Active Record Pattern ex
  • 10. Object-Based Patterns - Domain Model Pattern  Domain Model is also known as Object- Oriented Design  Define the entities and the relationships & flows between them  Each Entity has data (variables) & behavior (methods)  Consider the issues of “coupling” and “cohesion”. “Reuse”, “Maintainability”, and “Extensibility”  A diagram can be really large (divide & conquer)  More Object-oriented design using Design
  • 12. Domain Model to ER (DAL)
  • 13. Class Objects Design - steps  Start with use case diagram  Run thru activity diagram to identify entities and high-level relationship  Run thru sequence diagram again to identify attributes and methods for each entities.  You may skip this step for 136 to save time
  • 16. Domain Model – class diagram ex1 Database ER diagram is hidden away From the Domain Model How many tables to store student info?
  • 17. Domain Model – class diagram ex2 Review table in the database may have a order_id, but in Domain Model, it is not used.
  • 18. Domain Model – class diagram ex3 Database ER diagram will have more tables to stored these information (vehicle, make, model, vendor, produc t, location, back_order, etc).
  • 19. Domain Model – class diagram ex4
  • 21. CSE 136 - Lecture 5 Part 2
  • 22. Why use Design Patterns  Provide a starting point for a solution  Speed up productivity in a team  Improves system and application design  Carpenter: connector design pattern
  • 23. Object-oriented Design Patterns  Creational  The creational patterns aim to separate a system from how its objects are created, composed, and represented  They increase the system’s flexibility in terms of the what, who, how, and when of object creation  Structural  Structural patterns are concerned with how classes and objects are composed to form larger structures  Behavioral  Behavioral patterns identify common communication patterns between objects  They increase flexibility in carrying out this communication
  • 24. Creational Patterns  Factory  Singleton  Prototype (skip)  Abstract Factory (skip)  Builder (skip)
  • 25. Creational - Factory example Logging C# example available on class homepage (136 project) Polymorphism
  • 28. Creational - Singleton Code C# interview question
  • 29. Structural Design Patterns  Decorator  Proxy  Adapter  Facade  Bridge (skip)  Composite (skip)  Flyweight (skip)
  • 31. Structural - Decorator .NET libraries are based on decorator pattern
  • 37. Behavioral Pattern  Strategy  Chain of Responsibility  Iterator (skip - you have seen this in C# lecture “enumerator”)  Skip: Observer, Command, Mediator, Memento, Stat e, others…
  • 38. Behavioral - Strategy example Polymorphism
  • 39. Behavioral - Strategy Polymorphism Client may come From GUI
  • 40. Behavioral - Chain example Polymorphism
  • 41. Behavioral - Chain Polymorphism
  • 42. Review question  Why does domain model a better pattern at the end?  What are the three categories of OO design pattern?  Why are inheritance and polymorphism the center of OO design pattern?  Open/close principal, code flexibility.
  • 43. Demo Code  Business Logic Layer  Domain Objects  Error Logging implementation (factory pattern)  Data Transfer Object
  • 44. Your Assignment  Due next Thursday  Design and develop business layer based on UML  UML class diagram for Domain Object Model  C# Domain Model classes  C# Domain Business Logic  Must use creational pattern for error-logging (log to db or file based on app.config)  Must use asynchronous call for error-logging  Validations (regular expression – cover in day6)  Developing test cases for your business layer
  • 45. References  .NET : Architecting Applications for the Enterprise  Design Patterns: Elements of Re-usable Object-Oriented Software  C# Design Patterns