SlideShare una empresa de Scribd logo
1 de 30
Object-Oriented Programming Using C#
Objectives


                In this session, you will learn to:
                   Handle exceptions
                   Implement the user-defined exceptions
                   Implement threads
                   Define the life cycle of a thread




     Ver. 1.0                        Session 14            Slide 1 of 30
Object-Oriented Programming Using C#
Handling Exceptions


                In exception handling, the application is divided into blocks
                of code.
                A block that shows the probability of raising an error
                contains one or more exception handlers.
                The exception handlers follow a control structure and a
                uniform way of handling the system level and application
                level errors.
                The blocks for exception-handling can be implemented
                using the following keywords:
                   try
                   catch
                   finally


                Let us look at each of these keywords in detail.

     Ver. 1.0                       Session 14                         Slide 2 of 30
Object-Oriented Programming Using C#
Handling Exceptions (Contd.)


                The try block:
                   The try block guards statements that may throw an exception.
                   Following is the syntax of try block statement:
                    try
                    {
                    //statements that may cause an exception
                    }

                   The try block governs statements that are enclosed within it
                   and defines the scope of the exception-handlers associated
                   with it.
                   A try block must have at least one catch block.




     Ver. 1.0                       Session 14                            Slide 3 of 30
Object-Oriented Programming Using C#
Handling Exceptions (Contd.)


                The catch block:
                   The catch statement of the catch block takes an object of the
                   exception class as a parameter, which refers to the raised
                   exception.
                   You can associate an exception-handler with the try block by
                   providing one or more catch handlers, immediately after the try
                   block:
                     try
                     {
                         //statements that may cause an exception
                     }
                     catch (…)
                     {
                       //error handling code
                     }

     Ver. 1.0                       Session 14                            Slide 4 of 30
Object-Oriented Programming Using C#
Handling Exceptions (Contd.)


                The finally block:
                   The finally block is used to execute a given set of statements,
                   whether an exception is thrown or not thrown:
                    try
                    {
                         //statements that may cause an exception
                    }
                    catch (…)
                    {
                      //error handling code
                    }
                    finally
                    {
                      //statements to be executed
                    }
     Ver. 1.0                        Session 14                            Slide 5 of 30
Object-Oriented Programming Using C#
Demo: Handling Exception for Arrays Beyond Limit


                Problem Statement:
                   David is working on a project where he is calculating the sum
                   of values in an integer array. David needs to handle the
                   exceptions, which can occur while he is working with the
                   arrays. If any exceptional condition is reached when David is
                   executing the application, the application needs to display an
                   exception message.
                   Help David to handle the exceptions.




     Ver. 1.0                       Session 14                             Slide 6 of 30
Object-Oriented Programming Using C#
Demo: Handling Exception for Arrays Beyond Limit (Contd.)


                Solution:
                   To develop a console-based application, David need to
                   perform the following tasks:
                    1. Create a console-based application.
                    2. Build and execute an application.




     Ver. 1.0                        Session 14                            Slide 7 of 30
Object-Oriented Programming Using C#
Implementing the User-Defined Exceptions


                In C#, you can create your own exception class. Such kinds
                of exceptions are known as user-defined exceptions.
                The Exception class is the base class for all the
                exceptions in C#.
                The user-defined exception classes must follow the
                hierarchy of either the exception class or of one of the
                standard inherited classes.




     Ver. 1.0                     Session 14                       Slide 8 of 30
Object-Oriented Programming Using C#
Implementing the User-Defined Exceptions (Contd.)


                User-defined exception classes are derived from the
                ApplicationException class.
                To implement user-defined exceptions, you need to:
                – Raise your exception: You can use the throw statement to
                  raise your own exceptions.
                – Throw an object: You can throw an object if the object is
                  either directly or indirectly derived from System.Exception.
                  You can use a throw statement in the catch block to throw the
                  present object, as shown in the following code:
                  catch(Exception caught)
                    {
                      . . .
                       throw caught
                    }


     Ver. 1.0                      Session 14                           Slide 9 of 30
Object-Oriented Programming Using C#
Implementing Threads


               A thread is defined as the execution path of a program.
               You can define a unique flow of a control in a program,
               using a thread.
               Threads are used to run applications that perform large and
               complex computations.
               A process that is executed using one thread is known as a
               single-threaded process, where the process is a running
               instance of a program.
               Single-threaded application can perform only one task at a
               time. You have to wait for one task to complete before
               another task can start.




    Ver. 1.0                      Session 14                       Slide 10 of 30
Object-Oriented Programming Using C#
Implementing Threads (Contd.)


                  The following figure shows a single-threaded process.




                • To execute more than one task at a time, you can create
                  multiple threads in a program.
                • A process that creates two or more threads is called a
                  multithreaded process.




     Ver. 1.0                        Session 14                      Slide 11 of 30
Object-Oriented Programming Using C#
Implementing Threads (Contd.)


                The following figure shows a multithreaded process.




     Ver. 1.0                     Session 14                          Slide 12 of 30
Object-Oriented Programming Using C#
The Thread Model in C#


                In single-threaded systems, an approach called event loop
                with polling is used.
                Polling is the process in which a single event is executed at
                a time.
                In the event loop with polling approach, a single thread runs
                in an infinite loop till its operation is completed.
                In a single-threaded application if the thread is suspended
                from execution because it is waiting for a system resource,
                the entire program stops executing.
                In multithreading, the time for which a thread waits for the
                CPU time can be utilized to perform another task.




     Ver. 1.0                      Session 14                        Slide 13 of 30
Object-Oriented Programming Using C#
The Thread Model in C#(Contd.)


                • In C#, you will use the Thread class to work with threads.
                • The System.Threading.Thread class is used to
                  construct and access individual threads in a multithreaded
                  application.




     Ver. 1.0                        Session 14                       Slide 14 of 30
Object-Oriented Programming Using C#
The Main Thread


                • The main thread is created automatically on the start up of a
                  C# program execution.
                • The threads which are created exclusively using the
                  Thread class are called as child threads, where the main
                  thread is called a parent thread or a primary thread.
                • You can access a thread using the CurrentThread
                  property of the Thread class.




     Ver. 1.0                         Session 14                       Slide 15 of 30
Object-Oriented Programming Using C#
Working with Threads


                • In C#, you create a thread by creating an object of type
                  Thread, giving its constructor a ThreadStart reference,
                  and calling the new thread’s Start() method.
                • The new thread starts executing asynchronously with an
                  invocation of the thread’s method.
                • There are various methods available with the Thread class.
                  Using these methods, you can control the execution of
                  threads. Few of these methods are:
                   – Start(): Starts a thread.
                   – Sleep(): Makes the thread to pause for a period of time.
                   – Abort(): Terminates the thread.
                   – Suspend(): Suspends a thread. If the thread is already
                     suspended it has no effect.
                   – Resume(): Resumes the suspended thread.


     Ver. 1.0                         Session 14                          Slide 16 of 30
Object-Oriented Programming Using C#
Creating Threads


                • You can create threads by extending the Thread class.
                • The extended thread class calls the Start() method to
                  begin the child thread execution. Following is an example of
                  creating threads:
                   ThreadStart ChildRef = new
                   ThreadStart(ChildThreadCall);
                   Thread ChildThread = new Thread(ChildRef);
                   ChildThread.Start();




     Ver. 1.0                         Session 14                      Slide 17 of 30
Object-Oriented Programming Using C#
Managing Threads


               •   There are many tasks you might need to perform to manage
                   the activity or life of a thread.
               •   You can manage all these tasks by using the various thread
                   methods available with the Thread class.
               •   The static Thread.Sleep() method calls the static
                   CurrentThread method, which then pauses that thread
                   for the specified amount of time.




    Ver. 1.0                         Session 14                      Slide 18 of 30
Object-Oriented Programming Using C#
Destroying Threads


                •   If the thread is required to be destroyed, the
                    Thread.Abort() method will allow you to accomplish the
                    task.
                •   The runtime aborts the thread by throwing a
                    ThreadAbortException. This exception cannot be
                    caught.
                •   If the finally block is present in the method, the runtime
                    will send the control to it.




     Ver. 1.0                         Session 14                       Slide 19 of 30
Object-Oriented Programming Using C#
Thread Life Cycle


                •   The lifecycle of a thread starts when an object of the
                    System.Threading.Thread class is created. The life
                    cycle of the thread ends with task execution.
                •   There are various states in the life cycle of a thread. These
                    states are:
                       The Unstarted state
                       The Runnable state
                       The Not Runnable state
                       The Dead state


                    Let us understand the life cycle of the thread with the help
                    of the following figure.



     Ver. 1.0                           Session 14                        Slide 20 of 30
Object-Oriented Programming Using C#




              Start()   Started




                        Work Completed   Stopped




   Ver. 1.0                 Session 14             Slide 21 of 30
Object-Oriented Programming Using C#




              Start()   Started                Suspend()   Suspended




                                                           Resume()




   Ver. 1.0                       Session 14                      Slide 22 of 30
Object-Oriented Programming Using C#



              Start()   Started




                                    Sleep()     Wait/Join
                                                Sleep




                                                Interrupt()



                                               Time Expires




   Ver. 1.0                       Session 14                  Slide 23 of 30
Object-Oriented Programming Using C#




              Start()   Started




                                                          Thread Responds to
                         Abort()           Stop Request   Stop Request




                                                               Stopped




   Ver. 1.0                        Session 14                         Slide 24 of 30
Object-Oriented Programming Using C#
The Unstarted State


                • When an instance of the Thread class is created, the
                  thread enters the unstarted state.
                • A new thread is an empty object of the Thread class, and
                  no system resources such as memory are allocated to it.




     Ver. 1.0                        Session 14                     Slide 25 of 30
Object-Oriented Programming Using C#
The Runnable State


                • The thread remains in the unstarted state until the program
                  calls the Start() method of the Thread class, which
                  places the thread in the runnable state and immediately
                  returns control to the calling thread.
                • This state is also called as the ready or started state.
                • The newly started thread and any other threads in the
                  program execute concurrently.




     Ver. 1.0                         Session 14                      Slide 26 of 30
Object-Oriented Programming Using C#
The Not Runnable State


                A thread is not in the runnable state if it is:
                   Sleeping
                   Waiting
                   Blocked




     Ver. 1.0                        Session 14                   Slide 27 of 30
Object-Oriented Programming Using C#
The Dead State


                • A running thread enters the dead state when the statements
                  of the threads method are complete. This state is also called
                  the terminated state.
                • A program can force a thread into the dead state by calling
                  the Abort() method of the Thread class on the
                  appropriate thread object.




     Ver. 1.0                         Session 14                       Slide 28 of 30
Object-Oriented Programming Using C#
Summary


               In this session, you learned that:
                  Exception handling is implemented using the following
                  keywords:
                    • try
                    • catch
                    • finally
                – Exception-handling provides a structured and uniform way of
                  handling system-level and application-level errors.
                – Exception handling is the process of providing an alternative
                  path to be executed when an application is not able to execute
                  in the desired.
                – In addition to handling pre-defined exceptions, users can
                  create their own exceptions by deriving an exception class
                  from the ApplicationException class.



    Ver. 1.0                        Session 14                            Slide 29 of 30
Object-Oriented Programming Using C#
Summary (Contd.)


               – You can only throw an object if the types of objects either
                 directly or indirectly derives from System.Exception.
               – You can use the throw statement to raise your own
                 exceptions.
               – A thread is defined as the path of execution of a program. It is
                 a sequence of instructions that is executed to define a unique
                 flow of control.
               – A program that creates two or more threads is called a
                 multithreaded program.
               – The System.Threading class is used to construct and
                 access individual threads in a multithreaded application.
               – The various states in the life cycle of a thread are:
                      Unstarted state
                      Runnable state
                      Not Runnable state
                      Dead state

    Ver. 1.0                       Session 14                            Slide 30 of 30

Más contenido relacionado

La actualidad más candente

08 iec t1_s1_oo_ps_session_11
08 iec t1_s1_oo_ps_session_1108 iec t1_s1_oo_ps_session_11
08 iec t1_s1_oo_ps_session_11Niit Care
 
09 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_1309 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_13Niit Care
 
03 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_0403 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_04Niit Care
 
02 iec t1_s1_plt_session_02
02 iec t1_s1_plt_session_0202 iec t1_s1_plt_session_02
02 iec t1_s1_plt_session_02Niit Care
 
Java session02
Java session02Java session02
Java session02Niit Care
 
Java session01
Java session01Java session01
Java session01Niit Care
 
Java session11
Java session11Java session11
Java session11Niit Care
 
Oop02 6
Oop02 6Oop02 6
Oop02 6schwaa
 
03 iec t1_s1_plt_session_03
03 iec t1_s1_plt_session_0303 iec t1_s1_plt_session_03
03 iec t1_s1_plt_session_03Niit Care
 
Oop04 6
Oop04 6Oop04 6
Oop04 6schwaa
 
Write native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTWrite native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTAtit Patumvan
 
4.class diagramsusinguml
4.class diagramsusinguml4.class diagramsusinguml
4.class diagramsusingumlAPU
 
Evolution of Patterns
Evolution of PatternsEvolution of Patterns
Evolution of PatternsChris Eargle
 
Win32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework ReconstructionWin32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework ReconstructionAlex Matrosov
 
01 iec t1_s1_plt_session_01
01 iec t1_s1_plt_session_0101 iec t1_s1_plt_session_01
01 iec t1_s1_plt_session_01Niit Care
 

La actualidad más candente (20)

08 iec t1_s1_oo_ps_session_11
08 iec t1_s1_oo_ps_session_1108 iec t1_s1_oo_ps_session_11
08 iec t1_s1_oo_ps_session_11
 
09 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_1309 iec t1_s1_oo_ps_session_13
09 iec t1_s1_oo_ps_session_13
 
03 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_0403 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_04
 
01 gui 01
01 gui 0101 gui 01
01 gui 01
 
02 iec t1_s1_plt_session_02
02 iec t1_s1_plt_session_0202 iec t1_s1_plt_session_02
02 iec t1_s1_plt_session_02
 
Java session02
Java session02Java session02
Java session02
 
Java session01
Java session01Java session01
Java session01
 
Java session11
Java session11Java session11
Java session11
 
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 
Oop02 6
Oop02 6Oop02 6
Oop02 6
 
Fudcon D programming
Fudcon D programmingFudcon D programming
Fudcon D programming
 
Dacj 1-2 a
Dacj 1-2 aDacj 1-2 a
Dacj 1-2 a
 
03 iec t1_s1_plt_session_03
03 iec t1_s1_plt_session_0303 iec t1_s1_plt_session_03
03 iec t1_s1_plt_session_03
 
Oop04 6
Oop04 6Oop04 6
Oop04 6
 
Write native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTWrite native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDT
 
4.class diagramsusinguml
4.class diagramsusinguml4.class diagramsusinguml
4.class diagramsusinguml
 
Evolution of Patterns
Evolution of PatternsEvolution of Patterns
Evolution of Patterns
 
Win32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework ReconstructionWin32/Flamer: Reverse Engineering and Framework Reconstruction
Win32/Flamer: Reverse Engineering and Framework Reconstruction
 
01 iec t1_s1_plt_session_01
01 iec t1_s1_plt_session_0101 iec t1_s1_plt_session_01
01 iec t1_s1_plt_session_01
 

Destacado

02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_0202 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02Pooja Gupta
 
02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_0202 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02Niit Care
 
C# Advanced L04-Threading
C# Advanced L04-ThreadingC# Advanced L04-Threading
C# Advanced L04-ThreadingMohammad Shaker
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threadsrchakra
 
Threading in c#
Threading in c#Threading in c#
Threading in c#gohsiauken
 

Destacado (7)

02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_0202 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02
 
02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_0202 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02
 
C# Advanced L04-Threading
C# Advanced L04-ThreadingC# Advanced L04-Threading
C# Advanced L04-Threading
 
Threads c sharp
Threads c sharpThreads c sharp
Threads c sharp
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threads
 
Threading in C#
Threading in C#Threading in C#
Threading in C#
 
Threading in c#
Threading in c#Threading in c#
Threading in c#
 

Similar a 10 iec t1_s1_oo_ps_session_14

Exception Handling in C#
Exception Handling in C#Exception Handling in C#
Exception Handling in C#Abid Kohistani
 
Aae oop xp_13
Aae oop xp_13Aae oop xp_13
Aae oop xp_13Niit Care
 
Exception handling, Stream Classes, Multithread Programming
Exception handling, Stream Classes, Multithread ProgrammingException handling, Stream Classes, Multithread Programming
Exception handling, Stream Classes, Multithread ProgrammingPrabu U
 
25 java tough interview questions
25 java tough interview questions25 java tough interview questions
25 java tough interview questionsArun Banotra
 
Introduction of exception in vb.net
Introduction of exception in vb.netIntroduction of exception in vb.net
Introduction of exception in vb.netsuraj pandey
 
Lecture 1 Try Throw Catch.pptx
Lecture 1 Try Throw Catch.pptxLecture 1 Try Throw Catch.pptx
Lecture 1 Try Throw Catch.pptxVishuSaini22
 
1.4 core programming [understand error handling]
1.4 core programming [understand error handling]1.4 core programming [understand error handling]
1.4 core programming [understand error handling]tototo147
 
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)Unity Technologies Japan K.K.
 
Templates and Exception Handling in C++
Templates and Exception Handling in C++Templates and Exception Handling in C++
Templates and Exception Handling in C++Nimrita Koul
 
Lecture 3.1.1 Try Throw Catch.pptx
Lecture 3.1.1 Try Throw Catch.pptxLecture 3.1.1 Try Throw Catch.pptx
Lecture 3.1.1 Try Throw Catch.pptxsunilsoni446112
 
Exceptions
ExceptionsExceptions
Exceptionsmotthu18
 
Multi catch statement
Multi catch statementMulti catch statement
Multi catch statementmyrajendra
 

Similar a 10 iec t1_s1_oo_ps_session_14 (20)

Presentation1
Presentation1Presentation1
Presentation1
 
6-Error Handling.pptx
6-Error Handling.pptx6-Error Handling.pptx
6-Error Handling.pptx
 
Exception Handling in C#
Exception Handling in C#Exception Handling in C#
Exception Handling in C#
 
Aae oop xp_13
Aae oop xp_13Aae oop xp_13
Aae oop xp_13
 
Exception handling, Stream Classes, Multithread Programming
Exception handling, Stream Classes, Multithread ProgrammingException handling, Stream Classes, Multithread Programming
Exception handling, Stream Classes, Multithread Programming
 
JAVA PROGRAMMING- Exception handling - Multithreading
JAVA PROGRAMMING- Exception handling - MultithreadingJAVA PROGRAMMING- Exception handling - Multithreading
JAVA PROGRAMMING- Exception handling - Multithreading
 
Exception handling in ASP .NET
Exception handling in ASP .NETException handling in ASP .NET
Exception handling in ASP .NET
 
25 java tough interview questions
25 java tough interview questions25 java tough interview questions
25 java tough interview questions
 
Introduction of exception in vb.net
Introduction of exception in vb.netIntroduction of exception in vb.net
Introduction of exception in vb.net
 
Lecture 1 Try Throw Catch.pptx
Lecture 1 Try Throw Catch.pptxLecture 1 Try Throw Catch.pptx
Lecture 1 Try Throw Catch.pptx
 
1.4 core programming [understand error handling]
1.4 core programming [understand error handling]1.4 core programming [understand error handling]
1.4 core programming [understand error handling]
 
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
【Unite 2017 Tokyo】パフォーマンス向上のためのスクリプトのベストプラクティス(note付き)
 
Templates and Exception Handling in C++
Templates and Exception Handling in C++Templates and Exception Handling in C++
Templates and Exception Handling in C++
 
Lecture 3.1.1 Try Throw Catch.pptx
Lecture 3.1.1 Try Throw Catch.pptxLecture 3.1.1 Try Throw Catch.pptx
Lecture 3.1.1 Try Throw Catch.pptx
 
09 gui 13
09 gui 1309 gui 13
09 gui 13
 
C# Unit 2 notes
C# Unit 2 notesC# Unit 2 notes
C# Unit 2 notes
 
Exceptions
ExceptionsExceptions
Exceptions
 
Exceptions in java
Exceptions in javaExceptions in java
Exceptions in java
 
Multi catch statement
Multi catch statementMulti catch statement
Multi catch statement
 
Exception handling in .net
Exception handling in .netException handling in .net
Exception handling in .net
 

Más de Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 b
Dacj 1-3 bDacj 1-3 b
Dacj 1-3 b
 

Último

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
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
 

Último (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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 ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 

10 iec t1_s1_oo_ps_session_14

  • 1. Object-Oriented Programming Using C# Objectives In this session, you will learn to: Handle exceptions Implement the user-defined exceptions Implement threads Define the life cycle of a thread Ver. 1.0 Session 14 Slide 1 of 30
  • 2. Object-Oriented Programming Using C# Handling Exceptions In exception handling, the application is divided into blocks of code. A block that shows the probability of raising an error contains one or more exception handlers. The exception handlers follow a control structure and a uniform way of handling the system level and application level errors. The blocks for exception-handling can be implemented using the following keywords: try catch finally Let us look at each of these keywords in detail. Ver. 1.0 Session 14 Slide 2 of 30
  • 3. Object-Oriented Programming Using C# Handling Exceptions (Contd.) The try block: The try block guards statements that may throw an exception. Following is the syntax of try block statement: try { //statements that may cause an exception } The try block governs statements that are enclosed within it and defines the scope of the exception-handlers associated with it. A try block must have at least one catch block. Ver. 1.0 Session 14 Slide 3 of 30
  • 4. Object-Oriented Programming Using C# Handling Exceptions (Contd.) The catch block: The catch statement of the catch block takes an object of the exception class as a parameter, which refers to the raised exception. You can associate an exception-handler with the try block by providing one or more catch handlers, immediately after the try block: try { //statements that may cause an exception } catch (…) { //error handling code } Ver. 1.0 Session 14 Slide 4 of 30
  • 5. Object-Oriented Programming Using C# Handling Exceptions (Contd.) The finally block: The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown: try { //statements that may cause an exception } catch (…) { //error handling code } finally { //statements to be executed } Ver. 1.0 Session 14 Slide 5 of 30
  • 6. Object-Oriented Programming Using C# Demo: Handling Exception for Arrays Beyond Limit Problem Statement: David is working on a project where he is calculating the sum of values in an integer array. David needs to handle the exceptions, which can occur while he is working with the arrays. If any exceptional condition is reached when David is executing the application, the application needs to display an exception message. Help David to handle the exceptions. Ver. 1.0 Session 14 Slide 6 of 30
  • 7. Object-Oriented Programming Using C# Demo: Handling Exception for Arrays Beyond Limit (Contd.) Solution: To develop a console-based application, David need to perform the following tasks: 1. Create a console-based application. 2. Build and execute an application. Ver. 1.0 Session 14 Slide 7 of 30
  • 8. Object-Oriented Programming Using C# Implementing the User-Defined Exceptions In C#, you can create your own exception class. Such kinds of exceptions are known as user-defined exceptions. The Exception class is the base class for all the exceptions in C#. The user-defined exception classes must follow the hierarchy of either the exception class or of one of the standard inherited classes. Ver. 1.0 Session 14 Slide 8 of 30
  • 9. Object-Oriented Programming Using C# Implementing the User-Defined Exceptions (Contd.) User-defined exception classes are derived from the ApplicationException class. To implement user-defined exceptions, you need to: – Raise your exception: You can use the throw statement to raise your own exceptions. – Throw an object: You can throw an object if the object is either directly or indirectly derived from System.Exception. You can use a throw statement in the catch block to throw the present object, as shown in the following code: catch(Exception caught) { . . . throw caught } Ver. 1.0 Session 14 Slide 9 of 30
  • 10. Object-Oriented Programming Using C# Implementing Threads A thread is defined as the execution path of a program. You can define a unique flow of a control in a program, using a thread. Threads are used to run applications that perform large and complex computations. A process that is executed using one thread is known as a single-threaded process, where the process is a running instance of a program. Single-threaded application can perform only one task at a time. You have to wait for one task to complete before another task can start. Ver. 1.0 Session 14 Slide 10 of 30
  • 11. Object-Oriented Programming Using C# Implementing Threads (Contd.) The following figure shows a single-threaded process. • To execute more than one task at a time, you can create multiple threads in a program. • A process that creates two or more threads is called a multithreaded process. Ver. 1.0 Session 14 Slide 11 of 30
  • 12. Object-Oriented Programming Using C# Implementing Threads (Contd.) The following figure shows a multithreaded process. Ver. 1.0 Session 14 Slide 12 of 30
  • 13. Object-Oriented Programming Using C# The Thread Model in C# In single-threaded systems, an approach called event loop with polling is used. Polling is the process in which a single event is executed at a time. In the event loop with polling approach, a single thread runs in an infinite loop till its operation is completed. In a single-threaded application if the thread is suspended from execution because it is waiting for a system resource, the entire program stops executing. In multithreading, the time for which a thread waits for the CPU time can be utilized to perform another task. Ver. 1.0 Session 14 Slide 13 of 30
  • 14. Object-Oriented Programming Using C# The Thread Model in C#(Contd.) • In C#, you will use the Thread class to work with threads. • The System.Threading.Thread class is used to construct and access individual threads in a multithreaded application. Ver. 1.0 Session 14 Slide 14 of 30
  • 15. Object-Oriented Programming Using C# The Main Thread • The main thread is created automatically on the start up of a C# program execution. • The threads which are created exclusively using the Thread class are called as child threads, where the main thread is called a parent thread or a primary thread. • You can access a thread using the CurrentThread property of the Thread class. Ver. 1.0 Session 14 Slide 15 of 30
  • 16. Object-Oriented Programming Using C# Working with Threads • In C#, you create a thread by creating an object of type Thread, giving its constructor a ThreadStart reference, and calling the new thread’s Start() method. • The new thread starts executing asynchronously with an invocation of the thread’s method. • There are various methods available with the Thread class. Using these methods, you can control the execution of threads. Few of these methods are: – Start(): Starts a thread. – Sleep(): Makes the thread to pause for a period of time. – Abort(): Terminates the thread. – Suspend(): Suspends a thread. If the thread is already suspended it has no effect. – Resume(): Resumes the suspended thread. Ver. 1.0 Session 14 Slide 16 of 30
  • 17. Object-Oriented Programming Using C# Creating Threads • You can create threads by extending the Thread class. • The extended thread class calls the Start() method to begin the child thread execution. Following is an example of creating threads: ThreadStart ChildRef = new ThreadStart(ChildThreadCall); Thread ChildThread = new Thread(ChildRef); ChildThread.Start(); Ver. 1.0 Session 14 Slide 17 of 30
  • 18. Object-Oriented Programming Using C# Managing Threads • There are many tasks you might need to perform to manage the activity or life of a thread. • You can manage all these tasks by using the various thread methods available with the Thread class. • The static Thread.Sleep() method calls the static CurrentThread method, which then pauses that thread for the specified amount of time. Ver. 1.0 Session 14 Slide 18 of 30
  • 19. Object-Oriented Programming Using C# Destroying Threads • If the thread is required to be destroyed, the Thread.Abort() method will allow you to accomplish the task. • The runtime aborts the thread by throwing a ThreadAbortException. This exception cannot be caught. • If the finally block is present in the method, the runtime will send the control to it. Ver. 1.0 Session 14 Slide 19 of 30
  • 20. Object-Oriented Programming Using C# Thread Life Cycle • The lifecycle of a thread starts when an object of the System.Threading.Thread class is created. The life cycle of the thread ends with task execution. • There are various states in the life cycle of a thread. These states are: The Unstarted state The Runnable state The Not Runnable state The Dead state Let us understand the life cycle of the thread with the help of the following figure. Ver. 1.0 Session 14 Slide 20 of 30
  • 21. Object-Oriented Programming Using C# Start() Started Work Completed Stopped Ver. 1.0 Session 14 Slide 21 of 30
  • 22. Object-Oriented Programming Using C# Start() Started Suspend() Suspended Resume() Ver. 1.0 Session 14 Slide 22 of 30
  • 23. Object-Oriented Programming Using C# Start() Started Sleep() Wait/Join Sleep Interrupt() Time Expires Ver. 1.0 Session 14 Slide 23 of 30
  • 24. Object-Oriented Programming Using C# Start() Started Thread Responds to Abort() Stop Request Stop Request Stopped Ver. 1.0 Session 14 Slide 24 of 30
  • 25. Object-Oriented Programming Using C# The Unstarted State • When an instance of the Thread class is created, the thread enters the unstarted state. • A new thread is an empty object of the Thread class, and no system resources such as memory are allocated to it. Ver. 1.0 Session 14 Slide 25 of 30
  • 26. Object-Oriented Programming Using C# The Runnable State • The thread remains in the unstarted state until the program calls the Start() method of the Thread class, which places the thread in the runnable state and immediately returns control to the calling thread. • This state is also called as the ready or started state. • The newly started thread and any other threads in the program execute concurrently. Ver. 1.0 Session 14 Slide 26 of 30
  • 27. Object-Oriented Programming Using C# The Not Runnable State A thread is not in the runnable state if it is: Sleeping Waiting Blocked Ver. 1.0 Session 14 Slide 27 of 30
  • 28. Object-Oriented Programming Using C# The Dead State • A running thread enters the dead state when the statements of the threads method are complete. This state is also called the terminated state. • A program can force a thread into the dead state by calling the Abort() method of the Thread class on the appropriate thread object. Ver. 1.0 Session 14 Slide 28 of 30
  • 29. Object-Oriented Programming Using C# Summary In this session, you learned that: Exception handling is implemented using the following keywords: • try • catch • finally – Exception-handling provides a structured and uniform way of handling system-level and application-level errors. – Exception handling is the process of providing an alternative path to be executed when an application is not able to execute in the desired. – In addition to handling pre-defined exceptions, users can create their own exceptions by deriving an exception class from the ApplicationException class. Ver. 1.0 Session 14 Slide 29 of 30
  • 30. Object-Oriented Programming Using C# Summary (Contd.) – You can only throw an object if the types of objects either directly or indirectly derives from System.Exception. – You can use the throw statement to raise your own exceptions. – A thread is defined as the path of execution of a program. It is a sequence of instructions that is executed to define a unique flow of control. – A program that creates two or more threads is called a multithreaded program. – The System.Threading class is used to construct and access individual threads in a multithreaded application. – The various states in the life cycle of a thread are: Unstarted state Runnable state Not Runnable state Dead state Ver. 1.0 Session 14 Slide 30 of 30

Notas del editor

  1. Students have learnt the structure of different types of dimensions and the importance of surrogate keys in Module I. In this session, students will learn to load the data into the dimension tables after the data has been transformed in the transformation phase. In addition, students will also learn to update data into these dimension tables. Students already know about different types of dimension tables. Therefore, you can start the session by recapitulating the concepts. Initiate the class by asking the following questions: 1. What are the different types of dimensions? 2. Define flat dimension. 3. What are conformed dimension? 4. Define large dimension. 5. Define small dimension. 6. What is the importance of surrogate key in a dimension table? Students will learn the loading and update strategies theoretically in this session. The demonstration to load and update the data in the dimension table will be covered in next session.
  2. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  3. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  4. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  5. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  6. Students have learnt the structure of different types of dimensions and the importance of surrogate keys in Module I. In this session, students will learn to load the data into the dimension tables after the data has been transformed in the transformation phase. In addition, students will also learn to update data into these dimension tables. Students already know about different types of dimension tables. Therefore, you can start the session by recapitulating the concepts. Initiate the class by asking the following questions: 1. What are the different types of dimensions? 2. Define flat dimension. 3. What are conformed dimension? 4. Define large dimension. 5. Define small dimension. 6. What is the importance of surrogate key in a dimension table? Students will learn the loading and update strategies theoretically in this session. The demonstration to load and update the data in the dimension table will be covered in next session.
  7. Students have learnt the structure of different types of dimensions and the importance of surrogate keys in Module I. In this session, students will learn to load the data into the dimension tables after the data has been transformed in the transformation phase. In addition, students will also learn to update data into these dimension tables. Students already know about different types of dimension tables. Therefore, you can start the session by recapitulating the concepts. Initiate the class by asking the following questions: 1. What are the different types of dimensions? 2. Define flat dimension. 3. What are conformed dimension? 4. Define large dimension. 5. Define small dimension. 6. What is the importance of surrogate key in a dimension table? Students will learn the loading and update strategies theoretically in this session. The demonstration to load and update the data in the dimension table will be covered in next session.
  8. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  9. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  10. Students know the importance of surrogate keys. In this session students will learn the strategy to generate the surrogate key. Give an example to explain the strategy to generate the surrogate keys by concatenating the primary key of the source table with the date stamp. For example, data from a Product table has to be loaded into the Product_Dim dimension table on Feb 09, 2006. The product_code is the primary key column in the Product table. To insert the surrogate key values before loading the data into the dimension table, you can combine the primary key value with the date on which the data has to be loaded. In this case the surrogate key value can be product_code+09022006.
  11. Students know what is the structure of Flat dimension. You can initiate the session by asking the following questions: 1. What are flat dimension tables? 2. What is the structure of flat dimension? 3. Given examples of a flat dimension? Next, tell the strategy to load the data into the flat dimension table. You can explain the loading strategy with the help of the example given in SG. Continue this session by asking the following questions: 4. What are large flat dimension tables? 5. Give examples of large flat dimensions? Then, explain the strategy to load data into the large flat dimension table. Before explaining the strategy to load data into the small dimension table ask the following questions and the tell the strategy to load the data into the dimension table. 6. What are small flat dimension tables? 7. Give examples of small flat dimension tables. With the help of these questions, students will be able to recall about flat dimensions, they have learnt in Module I. Explain this topic with the help of an example given in SG.
  12. Students know what is the structure of Flat dimension. You can initiate the session by asking the following questions: 1. What are flat dimension tables? 2. What is the structure of flat dimension? 3. Given examples of a flat dimension? Next, tell the strategy to load the data into the flat dimension table. You can explain the loading strategy with the help of the example given in SG. Continue this session by asking the following questions: 4. What are large flat dimension tables? 5. Give examples of large flat dimensions? Then, explain the strategy to load data into the large flat dimension table. Before explaining the strategy to load data into the small dimension table ask the following questions and the tell the strategy to load the data into the dimension table. 6. What are small flat dimension tables? 7. Give examples of small flat dimension tables. With the help of these questions, students will be able to recall about flat dimensions, they have learnt in Module I. Explain this topic with the help of an example given in SG.
  13. Students know what is the structure of Flat dimension. You can initiate the session by asking the following questions: 1. What are flat dimension tables? 2. What is the structure of flat dimension? 3. Given examples of a flat dimension? Next, tell the strategy to load the data into the flat dimension table. You can explain the loading strategy with the help of the example given in SG. Continue this session by asking the following questions: 4. What are large flat dimension tables? 5. Give examples of large flat dimensions? Then, explain the strategy to load data into the large flat dimension table. Before explaining the strategy to load data into the small dimension table ask the following questions and the tell the strategy to load the data into the dimension table. 6. What are small flat dimension tables? 7. Give examples of small flat dimension tables. With the help of these questions, students will be able to recall about flat dimensions, they have learnt in Module I. Explain this topic with the help of an example given in SG.
  14. Students know what is the structure of Flat dimension. You can initiate the session by asking the following questions: 1. What are flat dimension tables? 2. What is the structure of flat dimension? 3. Given examples of a flat dimension? Next, tell the strategy to load the data into the flat dimension table. You can explain the loading strategy with the help of the example given in SG. Continue this session by asking the following questions: 4. What are large flat dimension tables? 5. Give examples of large flat dimensions? Then, explain the strategy to load data into the large flat dimension table. Before explaining the strategy to load data into the small dimension table ask the following questions and the tell the strategy to load the data into the dimension table. 6. What are small flat dimension tables? 7. Give examples of small flat dimension tables. With the help of these questions, students will be able to recall about flat dimensions, they have learnt in Module I. Explain this topic with the help of an example given in SG.
  15. Students know what is the structure of Flat dimension. You can initiate the session by asking the following questions: 1. What are flat dimension tables? 2. What is the structure of flat dimension? 3. Given examples of a flat dimension? Next, tell the strategy to load the data into the flat dimension table. You can explain the loading strategy with the help of the example given in SG. Continue this session by asking the following questions: 4. What are large flat dimension tables? 5. Give examples of large flat dimensions? Then, explain the strategy to load data into the large flat dimension table. Before explaining the strategy to load data into the small dimension table ask the following questions and the tell the strategy to load the data into the dimension table. 6. What are small flat dimension tables? 7. Give examples of small flat dimension tables. With the help of these questions, students will be able to recall about flat dimensions, they have learnt in Module I. Explain this topic with the help of an example given in SG.
  16. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  17. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  18. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  19. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.