Simple and Efficient Programming with C# : Skills to Build Applications with Visual Studio and .NET [2 ed.] 9781484287378, 9781484287361

Apply skills and approaches to your programming to build a real-world application in C# 11 using the latest editions of

385 129 10MB

English Pages 322 Year 2023

Report DMCA / Copyright

DOWNLOAD EPUB FILE

Table of contents :
Part I: Fundamentals
Chapter 1: Flexible Code Using Polymorphism
Recap of Polymorphism
Initial Program
Demonstration 1
Output
Analysis
Better Program
Demonstration 2
Analysis
Useful Notes
Summary
Chapter 2: Abstract Class or Interface?
Recap of Abstract Classes and Interfaces
Initial Program
Demonstration 1
Better Program
Demonstration 2
Output
Analysis
Summary
Chapter 3: Wise Use of Code Comments
Recap of Code Comments
Initial Program
Demonstration 1
Output
Analysis
Better Program
Demonstration 2
Analysis
Use the Power of C#
Demonstration 3
Analysis
Summary
Part II: Important Principles
Chapter 4: Know SOLID Principles
Single Responsibility Principle
Initial Program
Better Program
Open/Closed Principle
Initial Program
Better Program
Liskov Substitution Principle
Initial Program
Better Program
Analysis
Interface Segregation Principle
Initial Program
Better Program
Dependency Inversion Principle
Initial Program
Better Program
Summary
Chapter 5: Use the DRY Principle
Reasons for DRY
Initial Program
Demonstration 1
Output
Analysis
Better Program
Demonstration 2
Output
Analysis
Further Improvement
Demonstration 3
Output
Demonstration 4
Output
Summary
Part III: Make Efficient Applications
Chapter 6: Separate Changeable Code Using Factories
The Problem Statement
Initial Program
Demonstration 1
Output
Analysis
Better Program
Demonstration 2
Output
Analysis
A New Requirement
Demonstration 3
Output
Analysis
Demonstration 4
Output
Summary
Chapter 7: Add Features Using Wrappers
The Problem Statement
Initial Program (Using Subclassing)
Demonstration 1
Better Program (Using Object Composition)
Class Diagram
Demonstration 2
Output
Analysis
Summary
Chapter 8: Make Efficient Templates Using Hooks
The Problem Statement
Initial Program
Class Diagram
Demonstration 1
Output
Analysis
Enhanced Requirement
Demonstration 2
Output
Summary
Chapter 9: Simplify Complex Systems Using Facades
The Problem Statement
Initial Program
Demonstration 1
Output
Analysis
Better Program
Class Diagram
Demonstration 2
Output
Analysis
Summary
Part IV: Handling Surprises in a Better Way
Chapter 10: Organizing Exceptions
Recap of Exceptions
Case 1: Handling Different Exceptions in the Same Way
Initial Program
Better Program
Case 2: Handling the Same Exception in Different Ways
Initial Program
Better Program
Summary
Chapter 11: Special Attention to the Null Values
Initial Program
Demonstration 1
Output
Analysis
Better Programs
Demonstration 2
Output
Analysis
Demonstration 3
Analysis
Summary
Part V: The Road Ahead
Chapter 12: Memory Management
Overview
Stack Memory vs. Heap Memory
Q&A Session
The Garbage Collector in Action
Different Phases of Garbage Collection
Different Cases of Invoking the Garbage Collector
Demonstration 1
Output
Analysis
Q&A Session
Disposing of an Object
Finalize vs. Dispose
Demonstration 2
Output
Analysis
Q&A Session
Summary
Chapter 13: Analyzing Memory Leaks
Managed vs. Unmanaged Memory Leaks
Memory Leak Analysis
Demonstration
Snapshots from Diagnostic Tools
Summary
Chapter 14: More Tips
Learn Design Patterns
Brief History of Design Patterns
The Good News
Q&A Session
Avoid Anti-patterns
Brief History of Anti-patterns
Examples of Anti-patterns
Q&A Session
Final Suggestions
Decide Between a Static Method and an Instance Method
Know the Common Terminology
Accept Failures!
Q&A Session
Summary
Appendix A: Winning Notes
Appendix B: Resources
Index

Simple and Efficient Programming with C# : Skills to Build Applications with Visual Studio and .NET [2 ed.]
 9781484287378, 9781484287361

  • Commentary
  • true
  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
Recommend Papers