Advanced C#, Design Patterns and Best Practices

Course 511

  • Duration: 4 days
  • Labs: Yes
  • Language: English
  • Level: Advanced

Gain the skills needed to solve enterprise-level software programming problems to quickly deliver reliable applications that realize the value and quality goals of Agile development.

In part 1 you will identify and apply tactical design patterns to achieve SOLID results. This includes a cross section of patterns from lazy Singleton to delegate-based Strategy to leveraging the Task Parallel Library (TPL) using asynchronous adapters. Best practices include comprehensive coverage of automated Test-Driven Development (TDD) and modern techniques for paying down technical debt.

In part 2, strategic architectural patterns such as MVC and ORM are utilized to achieve "separation of concerns", an approach in which you will learn to write C# code that is much more maintainable, flexible and resilient. You will apply extended features, including definitive coverage Language Integrated Query (LINQ), to streamline the use of C# as both an object-oriented and a first-class data-manipulation language. This includes leveraging the Entity Framework (EF) in the highly portable and open .NET Core environment.

Throughout the course, advanced and less-used features of C# are introduced as needed including specialized C# keywords, advanced lambda expressions, extension methods, generic classes and delegates, universal functions, dynamic enumeration and anonymous types. In particular, to optimize data access, productivity, and overall application performance.

    .NET Training Delivery Methods

    • In-Person

    • Online

    • Upskill your whole team by bringing Private Team Training to your facility.

    .NET Training Course Information

    In this course, you will:

    • Solve complex programming problems using tactical and strategic design patterns
    • Deliver bug-free code using test-driven development (TDD)
    • Create layered architectures for reusability and to eliminate functional duplication
    • Apply the S.O.L.I.D. principles for better application design
    • Streamline data-centric applications with C# extended features and the Entity Framework
    • Exploit LINQ keywords and full-stack capabilities including queries, grouping and joins

    Prerequisites

    • Constructing, compiling, and executing C# applications using the Visual Studio integrated development environment.
    • Designing and implementing moderately complex programs in C#.
    • Applying fundamental object-oriented development techniques, such as encapsulation, inheritance, interfaces, and polymorphism.
    • Developing applications that leverage key components of the .NET framework library.

    .NET Course Outline

    Module 1: Simplifying Complex Programming with Proven Design Patterns

    Applying simple interfaces to intricate algorithms

    • Unifying interfaces from subsystems for ease of use and reusability
    • Implementing the Façade, Observer and thread-safe lazy Singleton patterns

    Module 2: Automated Test-Driven Development

    Automating unit testing

    • Shortening development cycles with automated tests
    • Eliminating regression errors with reusable tests

    Integrating testing and coding

    • Applying the test–first programming practice
    • Generating immediate red–green feedback for increased code quality and shortened feature development cycles
    • Organizing, coordinating and running test cases
    • Isolating dependencies with the Mock–Object pattern for reliable and repeatable testing

    Refactoring code to improve design

    • Improving design while ensuring correct behavior is preserved
    • Eliminating code duplication by refactoring using the Template Methods pattern and the Hollywood principle

    Module 3: Applying SOLID Principles

    Design by Interface

    • Identifying objects by behavior, not type
    • Organizing state–rich applications with the State pattern
    • Refactoring to achieve the Single Responsibility Principle
    • Maintaining the Open-Closed Principle during development

    Inheritance vs. Aggregation

    • Adhering to Interface Segregation for code design
    • Applying the Liskov Substitutability Principle to ensure correct inheritance
    • Changing algorithms dynamically at run-time using the Strategy Pattern
    • Dependency injection vs. Dependency Inversion
    • Deploying run-time Factory Patterns
    • Template Methods and the Hollywood Principle

    Module 4: Threading and Concurrency

    Organizing long-running business logic

    • Capabilities of Task Parallel Library (Parallel.For and Parallel.Foreach)
    • Asynchronous C# keywords
    • Coding using the Awaitable-Awaiter Pattern

    Module 5: Separation of Concerns (Business Logic – Data)

    Object-Relational Mapping (ORM)

    • Creating an effective Data Access Layer
    • Reducing User Interface code with Data Binding
    • Centralizing data access using the lazy Repository pattern
    • Determining when to force eager loading

    Easing data access code with the Entity Framework

    • Maintaining data context automatically
    • Reducing database access code by exploiting Entity Navigation Properties
    • Eliminating database update code with Entity change tracking

    Module 6: Separation of Concerns (View - Business Logic)

    Strategic (Architectural) Design Patterns

    • Designing with MVC, MVP and MVVM
    • Simplifying complex highly-stateful logic with the State Pattern
    • Coding controller objects for use with auto-generated entity objects

    Module 7: Harnessing Lesser-Used C# Language Features

    Language shortcuts

    • Applying auto-implemented and lambda generated properties
    • Benefiting from dynamic and implied-type declaration

    Streamlining program logic

    • Instantiating entity objects
    • Simplifying construction with object initializers

    Filtering and ordering data with lambda expressions

    • Passing lambda expressions to methods (behavior vs. data)
    • Calling Count, Reverse, Union, Except and other extension methods

    Applying extended features

    • Making code more flexible with delegates
    • Parameterizing delegates and lambda expressions
    • Streamlining code with Func<T,R> generic delegates

    Module 8: Leveraging LINQ Query Keywords

    Syntax and semantics

    • Coding LINQ queries
    • Filtering with from, whereorderby and group
    • Performing inner and outer joins
    • Generating anonymous types

    Iterating collections

    • Interfacing between C# and LINQ using IEnumerable<T> and IQueryable<T>
    • Issuing queries on entity and spatial types

    Connecting to and reading from a database

    • Inheriting DbContext objects
    • Correlating entity classes and data tables
    • Executing stored procedures and table-valued functions

    Object Relational Mapping

    • Employing code-first and database first mapping to generate entity classes
    • Optimizing complex mapping including many to many and database inheritance

    Updating a database

    • Inserting, updating and deleting data when Core is integrated with .NET Framework
    • Error handling and exceptions
    • Committing and rolling back transactions

    Module 9: Enumerations and Generic Classes

    Dynamic Enumeration

    • Comparing IEnumerable<T> and IEnumerator<T>
    • The yield keyword

    Module 10: Processing Data with LINQ Queries

    Advanced LINQ techniques

    • Creating anonymous query results
    • Retrieving composite views using nested from clauses

    Referential Integrity and Concurrency

    • First-wins, Last-wins and everyone wins scenarios
    • Protecting concurrency data corruption
    • Concurrency detection and recovery
    • Transaction Processing
    • Recovering from Data Exceptions

     

    Need Help Finding The Right Training Solution?

    Our training advisors are here for you.

    .NET Course FAQs

    Design Patterns in .NET vary from lazy singletons to asynchronous adapters that quickly deliver reliable applications that realize the quality goals of Agile development.

    • .NET is used in this course through the C# language.
    • This course uses Visual Studio 2019 but is useful to those using an earlier version.

    Yes! We know your busy work schedule may prevent you from getting to one of our classrooms which is why we offer convenient online training to meet your needs wherever you want. This course is available in class and live online.

    Chat With Us