# Topical Examples and Practice Exercises

In order to provide a smooth, gradual appoach to learning how to program in a OOP-First approach, I've laid out a comprehensive set of code sample and practice questions organized in a topical fashion.

For programming tools, I recommend starting with Visual Studio Code. It's a simple-to-use (yet sophisticated and powerful) text editor. Read my quick overview for more information on your options for programming tools.

# OOP Essentials

I've long asserted that classes and objects are fundamental to programming in C#. In fact, if you treat objects as the most fundamental part (right up there with the notion of variables, values and data types, all the remaining fundamentals fall into their natural usage.

These first topics get the user into writing classes with fields, properties, constructors, and methods. After starting with static members in Topic A, we move quickly to instance members in topics B and C and what it means to "new up" an object based on a class.

  • A - Starting Classes ()
  • B - Starting Classes ()
  • C - Starting Classes ()

# Testing Your Code

Topic D introduces an approach to testing that doesn't rely on constantly creating drivers to perform manual testing. It's not that manual testing is "bad", but too much focus on these drivers often takes away from the real interesting parts of programming. In place of manual testing, I'll present to you automated unit tests as a better way to see if our code is working the way it's supposed to.

  • D - Testing and Debugging

# C# - In Context

The remaining fundamentals are covered in topics E through M. The focus here is mostly about "doing math" and flow-control statements, but additional concepts such as enumerations, composition, and arrays are also introduced. These examples present all the fundamentals within the context of working with objects, rather than being isolated and shown in a purely "procedural" fashion.

  • E - Expressions and Math
  • F - If/Else Structures
  • G - Raising Exceptions
  • H - Case Structures
  • I - Enumerations and Composition
  • J - Looping Structures
  • K - Looping and Collections
  • L - Arrays - Not Sorted
  • M - Sorting and Collections

# Other Fundamental Considerations

Once you have Classes/Objects and Flow-Control under your belt, it's time to take a look at building on those fundamentals. The role of modularization and utility classes, as well as performing file input/ouput and dealing with exceptions is explored with some simple examples.

  • N - Modularization and Utility Classes
  • O - File I/O
  • P - Exception Handling

# Algorithms and Building on OOP

  • Q - Simple Algorithms
  • R - Inheritance
  • S - Solid Principles
  • T - Other Types (struct, interface, delegate, Generics, Extension Methods)
  • U - Operator Overloading

# Class\Topic Chart

Coming Soon: Alpha-testing vue component to process json list of data types used in the code examples and practices. There are 103 data types registered.
  • Account - Examples: BCDEFGIL - Practice: BCG
  • AccountType - Examples: IL - Practice:
  • Address - Examples: I - Practice:
  • Aggregator - Examples: J - Practice: J
  • Ampere - Examples: T - Practice:
  • Angle - Examples: EF - Practice:
  • Answer - Examples: KL - Practice:
  • AnsweringMachine - Examples: - Practice: AB
  • ArrayFullException - Examples: L - Practice:
  • BahamaLetterGrade - Examples: - Practice: HI
  • BankStatement - Examples: KLM - Practice:
  • BankTransaction - Examples: L - Practice:
  • BankTransactionDateComparer - Examples: L - Practice:
  • Base16 - Examples: F - Practice:
  • Book - Examples: - Practice: K
  • BookBag - Examples: - Practice: KL
  • BookFileAdapter - Examples: O - Practice:
  • BranchVault - Examples: M - Practice:
  • BulkItem - Examples: - Practice: EG
  • Calculator - Examples: E - Practice: E
  • CanadianAddress - Examples: - Practice: BCDII
  • Candela - Examples: T - Practice:
  • CardSuit - Examples: KL - Practice: K
  • CardValue - Examples: KL - Practice: K
  • CD - Examples: N - Practice: L
  • CDLibrary - Examples: - Practice: M
  • Circle - Examples: EG - Practice:
  • ClassCode - Examples: - Practice: I
  • ClassList - Examples: KLM - Practice:
  • Coin - Examples: I - Practice:
  • CoinFace - Examples: I - Practice:
  • Color - Examples: F - Practice:
  • Comments - Examples: AB - Practice:
  • Company - Examples: CD - Practice: I
  • Cone - Examples: - Practice: EG
  • Coordinate - Examples: - Practice: E
  • Course - Examples: - Practice: BCDG
  • CurrencyCalculator - Examples: - Practice: EF
  • Customer - Examples: K - Practice:
  • Cylinder - Examples: - Practice: EG
  • DeckOfCards - Examples: KL - Practice: KL
  • Die - Examples: EG - Practice: E
  • ElapsedTime - Examples: E - Practice:
  • Employee - Examples: BD - Practice: I
  • ExamResult - Examples: - Practice: BCDG
  • Feedback - Examples: - Practice: H
  • Fraction - Examples: EFGJ - Practice: E
  • GenderType - Examples: I - Practice:
  • GenericRoundingCalculator - Examples: - Practice: E
  • GravityCalculator - Examples: - Practice: EF
  • GuessingGame - Examples: J - Practice: J
  • HazardousMaterial - Examples: - Practice: FGHI
  • HelloWorld - Examples: A - Practice:
  • Humanizer - Examples: - Practice: N
  • ImproperFraction - Examples: I - Practice:
  • Kelvin - Examples: T - Practice:
  • Kilogram - Examples: T - Practice:
  • LabResult - Examples: - Practice: BCDG
  • LetterGrade - Examples: HI - Practice: I
  • Mark - Examples: K - Practice:
  • Math - Examples: JKL - Practice: J
  • Measure - Examples: T - Practice:
  • MemoryAddress - Examples: F - Practice:
  • Meter - Examples: T - Practice:
  • MixedNumber - Examples: I - Practice:
  • Mole - Examples: T - Practice:
  • Month - Examples: - Practice: I
  • MultipleChoice - Examples: KL - Practice:
  • MultipleChoiceMarker - Examples: KL - Practice:
  • MusicInfoFormatter - Examples: N - Practice: N
  • Nothingness - Examples: A - Practice:
  • PaintEstimator - Examples: - Practice: E
  • ParkingCounter - Examples: EFG - Practice:
  • PeopleCounter - Examples: - Practice: EG
  • Person - Examples: BCDEFG - Practice: CD
  • PersonFileAdapter - Examples: - Practice: O
  • PhoneBook - Examples: KLM - Practice: KLM
  • PhoneNumber - Examples: KL - Practice: K
  • PhoneNumberFileAdapter - Examples: O - Practice:
  • PlayingCard - Examples: KL - Practice:
  • Program - Examples: - Practice: K
  • ProperFraction - Examples: I - Practice:
  • Province - Examples: - Practice: III
  • QuadraticEquation - Examples: E - Practice:
  • QuebecLetterGrade - Examples: I - Practice:
  • Rating - Examples: H - Practice:
  • Rectangle - Examples: - Practice: FG
  • Registrar - Examples: - Practice: KLM
  • ResolveExpressions - Examples: E - Practice:
  • RoundingCalculator - Examples: - Practice: E
  • RunningTime - Examples: N - Practice:
  • SafetyDepositBox - Examples: O - Practice:
  • SafetyDepositBoxFileAdapter - Examples: O - Practice:
  • Salutation - Examples: B - Practice: A
  • ScoreCard - Examples: - Practice: E
  • Second - Examples: T - Practice:
  • Song - Examples: - Practice: L
  • SongFileAdapter - Examples: - Practice: O
  • Square - Examples: EG - Practice: E
  • StockItem - Examples: EFG - Practice:
  • Student - Examples: BCDGIKL - Practice: IK
  • StudentFileAdapter - Examples: O - Practice:
  • TextFormatter - Examples: N - Practice:

In the following table, E stands for a code Example and P stands for a Practice problem that you can attempt on your own.

# Class Fundamentals

Class \ Topic A B C D
Account E/P E/P E
AnsweringMachine P P
CanadianAddress P P P
Comments E E
Company E E E
Course P P P
Employee E E E
ExamResult P P P
HelloWorld E
LabResult P P P
Nothingness E
OuterSpace P
Person E E/P E/P
Salutation P E
Student E E E

# Math and Decision Structures

Class \ Topic E F G H
Account
Calculator
Person
ElapsedTime
ResolveExpressions
Circle
Square
Fraction
Angle
StockItem

# Enums & Looping Structures

Class \ Topic I J K

# Arrays

Class \ Topic L M
Last updated on: 10/10/2019, 1:35:05 PM