Lectures
You can download the lectures here (in PDF format). I will try to upload lectures prior to their corresponding classes.
-
Session 28 - Q&A
tl;dr: We spent the entire session for Q&A on topics varying from async/await, ThreadPool, IEnumerable/foreach/yield and Events to Enum Types and abstract methods and classes.
-
Session 27 - State Pattern
tl;dr: After answering questions and providing new examples for async/await and event based programming, we introduced and implemented the State Pattern.
-
Session 26 - MultiThreading, ThreadPool, Tasks, Async Pattern
tl;dr: We started off by demonstrating how much CPU usage one or more threads can take. Next we discussed the need for haveing thread synchronization through locks. We used ThreadPools and Tasks to get many jobs done asynchronously and we finally discussed the async/await pattern in C#.
-
Session 25 - Events and Threads
tl;dr: We went through delegate code samples from C# via CLR book. We then introduced events and went through the MailManager example also from C# via CLR book. We then discussed the concept of thread and processes and explored system processes and threads from Process Explorer tool from System Internals (link2). Finally, we introduced how you can create your own thread in C# and start it with with and without parameters. See link1 for complete source code from CLR via C#.
-
Session 24 - LINQ-Continued, Event Driven Programing
tl;dr: We introduced another example for LINQ to reinforce the concepts from last session. We then moved on to Event Driven Programming and introduced Multicast delegates and Events.
-
Session 23 - Delegate, Lambda Expression, Iterator Pattern, LINQ
tl;dr: We continued our discussion about the Iterator Pattern and LINQ. Using the Alchohol Life Time Abstainer data set we demonstrated the use of new LINQ operators like SelectMany, Min, Max, First, Aggregate and Join. We also introduced the Tuple and ValueTuple classes and their advanatages over anonymous classes.
-
Session 22 - Delegate, Lambda Expression, Iterator Pattern, LINQ
tl;dr: We introduced and motivated the concept of a delegate, lambda expressions and generic predefined Func and Action delegates. We then introduced an extension method for int[] to filter Odd, Dividable by 3, 5, ... numbers and became familiar with chaining multiple methods together. We then introdeuced the LINQ extension methods including the Enumerable class and the Select, Where, Skip, Take, OrderBy, OrderByDescending, GroupBy, ToList and ForEach extension methods while working with Life Expectency data from WHO to find countries with highest/lowest average life expectancy.
-
Session 21 - Inheritance - Abstract/Sealed - Extention Methods
tl;dr: We started this session with an implementation of a single Shape class that could draw a Circle, Triangle or Square and saw how the class quickly became complicated. We then defined different classes for each shape, all inheriting from the Shape class and saw how much simpler the class becomes. We then introduced the concept of abstract classes/methods and sealed classes/methods. Finally we introduced extention methods to finish our discussion on inheritance.
-
Session 20 - Inheritance
tl;dr: We introduced the concept of inheritance. What is it? Why we use it? and the C# syntax for it. We started from the C# Object and Exception classes which we had seen before. Next we implemented a Person and Student class separately and saw the overlap in definitions and code. We then had Student inherit from the Person class. We added more classes to the hierarchy by adding Employee who inherits from Person and Teacher who inherits from Employee. We talked about constructors and how base class constructors can/should be called. Next we introduced virtual/override/new methods and polymorphisim. At the end of the class we looked through Assignment 9 and gave some hints on how to approach it.
-
Session 19 - Error/Exception Handling - Continued
tl;dr: In this session after reviewing exception handling from last session, we provided examples on how the program behaves when exceptions occur. We then provided examples for how several .NET exceptions could occur or could be thrown. Finally we introduced the Finally block and its applications. For the last part of the class we showed a video on atomic habits and had a discussion about it afterwards. You can find the video at the link below.
-
Session 18 - Conversion Operator - Error/Exception Handling
tl;dr: We started this session by introducing the conversion operator and how to overload it for different types. We then motivated the use of exceptions by explaining how it can help us write cleaner code and not cloud our code and methods with error handling parameters. We explained the try/catch block, multiple catch statements and catching all exceptions along with exception filters. We also showed how the exception object contains different information including call stack, error message and error code. Finally we discussed best practices when handling exceptions, what an unhandled exception is and how and when to rethrow and exception.
-
Session 17 - Operator Overloading + Dictionary
tl;dr: In this session we started by demonstrating that Object.Equals doesn't work as expected for most objects. The operator == has the same problem. We overrided the Equals method for a new class to work as expected. We also overloaded the == operator. We demonstrated how null checking in the == operator can result in a StackOverflowException. We then introduced the generic Dictionary collection and how we can override the Object.GetHashCode method and implement the IEquatable interface to have Dictionary work correctly for a class as a key. We demonstrated a dictionary lookup can be much faster if a good hash code is selected. Finally, we introduced the +, -, ... operators in addition to the indexer
-
Session 16 - Generics and Interfaces Continued 2
tl;dr: In this session we continue our example of sorting different data types. We provide more examples on generic interfaces and constraints. We introduce the IComparable, generic IComparable, IEnumerable, generic IEnumerable interfaces along with the foreach/yield programming paradigm.
-
Session 15 - Generics and Interfaces Continued
tl;dr: In this session we continued our example of loading different data types using a generic method to sorting different data types through a generic sort method. In this session we introduced generic interfaces and constraints.
-
Session 14 - Interfaces and Generics
tl;dr: We started this session by introducing an IHasName interface. We then introduced a simple Generic for printing different types. We also introduced the IDisposable interface and mentioned the IComparable interface.