T B H P N

CSE681 Course Summary

Topics with selected details

Synopsis:

A summary of course topics, with links to many of the most important details.
Topics:    Click on titles to expand, F5 or Ctrl r to refresh
  1. Software Architecture is an abstraction for a software part (System, Program, Package, Class) that focuses on users and uses, structure, issues, and risks.
    For the Collaboration System, shown in the figure to the right, users are developers, Quality Assurance, managers, and perhaps, customers. But also, each of the servers are users. The Client uses Repository, Repository uses Client and Build Server, ...
    Software Development Collaboration System
    The structure, shown here, focuses on process boundaries. Note, for example, it is entirely possible that we choose to run both Repository and Build servers on the same physical machine.
    If we design well, it will be straight-forward to scale-out by using more than one build machine or test harness machine.
    The primary risks for this system are performance under load and complexity. Scaling-out is an effective way to mitigate performance risk. For complexity, we choose to use message-passing communication, which simplifies a lot of the designs, and is very flexible, supporting functional changes and additions, as well as performance tuning.
  2. Communication Subsystem
    Software structure consists of:
    • Partitions: systems, packages, classes
    • Communication: how parts make requests, send notifications, and receive replies
    • Sharing: how data is shared between parts, e.g., via messages, access to shared data repositories, file systems, ...
    • Control: which parts affect the actions of other parts
    Software structure has several different views:
    • Logical structure: interfaces, classes, and class relationships
    • Package structure: dependency graph showing which packages depend on which others
    • Subsystem structure: major blocks of processing dedicated to specific roles, e.g., display, communication, ...
    • Execution structure: Executables, static and dynamic libraries, cooperating processes
    In the diagram, we show structure of a Windows Communication Foundation (WCF) message-passing system. Three communicating processes are shown, each with a Sender and a Receiver. The process on the right side of the diagram has been expanded to show how the communication Receiver service operates. The service hosts service objects, one for each active sender, The service object receives a message and enqueues it in a shared queue for subsequent processing.
    Each message contains source and destination addresses. A Sender, when presented with a message, sends it to the destination address. Any subsequent replies are sent, by the receiving process, to the original source address.
    Presentations:
    Code:
  3. A relatively simple programming language that compiles to managed code. It favors protecting users over enabling them.
    C# Language - Lecture #4
    • C# derives most of its language elements and structure from the Java programming language, which in turn, inherited those things from C++.
    • A class is a language construct that binds together member functions and data, providing access to users only to public member functions, not to its data. This encapsulation enables the class to make strong guarantees about validity of its data. Instances of all classes are reference types and live on the managed heap.
      ///////////////////////////////////////////////////////////////////////
      ///  Navigate.cs - Navigates a Directory Subtree, displaying files  ///
      ///  ver 1.3       and some of their properties                     ///
      ///                                                                 ///
      ///  Language:     Visual C#                                        ///
      ///  Platform:     Dell Dimension 8100, Windows Pro 2000, SP2       ///
      ///  Application:  CSE681 Example                                   ///
      ///  Author:       Jim Fawcett, CST 2-187, Syracuse Univ.           ///
      ///                (315) 443-3948, jfawcett@twcny.rr.com            ///
      ///////////////////////////////////////////////////////////////////////
      /*
       *  Module Operations:
       *  ==================
       *  Recursively displays the contents of a directory tree
       *  rooted at a specified path, with specified file pattern.
       *
       *  Maintenance History:
       *  ====================
       *    elided
       */
      
      using System;
      using System.IO;
      
      namespace Navigate
      {
        public class Navigate
        {
          private int fileCount_ = 0;
          public int fileCount {
            get { return fileCount_; }   // can add additional logic without
            set { fileCount_ = value; }  // changing user interface
          }
          public int dirCount { get; set; } = 0;  // equivalent to the above
      
          public void go(string path, string pattern)
          {
            path = Path.GetFullPath(path);
      
            // get all files in this directory and display them
      
            string [] files = Directory.GetFiles(path, pattern);
      
            if (files.Length > 0)   // show only dirs with files
            {
              Console.Write("\n\n  {0}", path);
            }
      
            foreach (string file in files)
            {
              ++fileCount;
              string name = Path.GetFileName(file);
              FileInfo fi = new FileInfo(file);
              DateTime dt = File.GetLastWriteTime(file);
              Console.Write("\n   {0,-50} {1,8} bytes  {2}",name,fi.Length,dt);
            }
            // for each subdirectory in this directory display its files
            // recursively
      
            string[] dirs = Directory.GetDirectories(path);
            foreach (string dir in dirs)
            {
              ++dirCount;
              go(dir, pattern);
            }
          }
        }
      }
      
      
      Class Navigate has two interger properties, fileCount and dirCount. Properties provide encapsulation of data while supporting direct access. Each property has a private integer field. It also provides two methods, get and set, which encapsulate that data. The fileCount property is provided an explicit definintion, as shown to the right. The definition provides a private int fileCount_ backing store, and getter and setter methods, shown explicitly. Either, or both, of these methods can have additional code that modifies the method behaviors. The dirCount property uses an implicit definition, where the compiler generates an anonymous backing store, and provides default implementations for get and set, which have the same contents as shown for the fileCount property. The benefit of using an implicit definition is that it is quick to write and easy to understand. Should, in the future, the class need to modify the behaviors of the get or set methods, the dirCount property definition can be expanded, just like the fileCount, and additional logic added. The important thing is, that making this change does not affect the user interface for the class. We haven't broken any client code by changing the property definition. That would not be the case for unencapsulated public data, a practice we discourage. The Navigate class uses the .Net System.IO namespace with very nicely designed File, FileInfo, Path, and Directory classes. It also uses the DateTime class provided in the System namespace. Finally, notice that the Navigate.go(path, pattern) method is used recursively. For each directory go finds, it calls itself on that discovered path, passing the existing patterns, so that lower level searches use the same search properties. Make sure you look at CodeSnap ClassDemo.

      ///////////////////////////////////////////////////////////////////////
      ///  Test.cs    -  Demonstrates use of System.IO classes            ///
      ///  ver 1.1                                                        ///
      ///                                                                 ///
      ///  Language:     Visual C#                                        ///
      ///  Platform:     Dell Dimension 8100, Windows Pro 2000, SP2       ///
      ///  Application:  CSE681 Example                                   ///
      ///  Author:       Jim Fawcett, CST 2-187, Syracuse Univ.           ///
      ///                (315) 443-3948, jfawcett@twcny.rr.com            ///
      ///////////////////////////////////////////////////////////////////////
      //
      //  Operations:
      // =============
      //  This is a test driver for Navigate.  It simply extracts a path
      //  from the command line and calls Navigate.go(path).
      
      using System;
      using System.IO;
      
      namespace Navigate
      {
        class Test
        {
          [STAThread]
          static void Main(string[] args)
          {
            Console.Write("\n  Demonstrate System.IO Classes ");
            Console.Write("\n ===============================");
      
            string path;
            if(args.Length > 0)
              path = args[0];
            else
              path = Directory.GetCurrentDirectory();
      
            Navigate nav = new Navigate();
            nav.go(path, "*.*");
      
            Console.Write
              (
                "\n\n  processed {0} files in {1} directories", 
                nav.fileCount, nav.dirCount
              );
            Console.Write("\n\n");
          }
        }
      }
      
      
      To the left you see the definition of the Test class, used while constructing Navigate and later to demonstrate its capabilities to prospective users. It starts by reading its command line, looking for a start path and patterns for file matching. Then, it creates an instance of Navigate, called nav, and invokes its go(path, pattern) method. When go completes its recursive walk through the directory tree rooted at path, Test displays the number of files and directories processed. Make sure you look at the CodeSnap Class Demo.

      More
      ///////////////////////////////////////////////////////////////////////
      // ClassDemo.cs - Illustrate basic class operations                  //
      //                                                                   //
      // Jim Fawcett, CSE681 - Software Modeling and Analysis, F2015       //
      ///////////////////////////////////////////////////////////////////////
      /*
       * A class definition does three important things for you:
       *   1. Pulls together data and all the methods that directly manipulate
       *      it into one logical entity, making that code easier to understand.
       *   2. Protects its data from being changed by any other code and so
       *      ensuring that the class data always stays in a valid state.
       *   3. Allows using code to make multiple instances of the data, all
       *      operated on by the same methods, while still ensuring protection
       *      of the data's integrity.
       */
      /*
       * Read Chap 3 in the class text.
       */
      using System;                             //     +--------+
      using System.Collections.Generic;         //     | Object |
      using System.Linq;                        //     +--------+
      using System.Text;                        //          ^
      using System.Threading.Tasks;             //          |
                                                //      +-------+
      namespace CSharpDemos                     //      | Basic |
      {                                         //      +-------+
        public class Basic
        {
          // class fields
          private double valueType_ = 3.1415927;
          private StringBuilder referenceType_ = new StringBuilder("a string");
      
          // class properties
          public double valueProperty { get; set; } = 3.2;
          public StringBuilder referenceProperty { get; set; } =
            new StringBuilder("will be converted to StringBuilder");
      
          // constructor
          public Basic(double d=1.0/3, string s="default string")
          {
            this.valueProperty = d;
            this.referenceProperty = new StringBuilder(s);
          }
      
          // destructor is really a finalizer, run by the garbage collector
          ~Basic()
          {
            Console.Write("\n  Basic instance is being finalized");
          }
      
          // member function
          public void showIdentity()
          {
            // "this" is a reference to instance of the class that invoked method,
            // e.g., basic1 and basic2, below.  The code of each nonstatic member
            // function needs to identify which instance to act upon.
      
            Console.Write("\n  instance identity is {0}", this.GetHashCode());
      
            // GetHashCode() is a method inherited from "Object" class from which
            // all reference types derive.
          }
      
          // member function
          public void showState()
          {
            showIdentity();
            Console.Write("\n          value field: {0}", valueType_);
            Console.Write("\n      reference field: {0}", referenceType_);
            Console.Write("\n       value property: {0}", valueProperty);
            Console.Write("\n   reference property: {0}", referenceProperty);
          }
        }
        // Extension methods are static methods of static classes that can be
        // applied to instances of target type as if they were member functions.
        // They can't access private or protected member data of target class
        // but can uses its public interface.
      
        static public class BasicExtensions
        {
          // the first argument type "this string" defines the target type
      
          static public void title(this string astring, char underline = '-')
          {
            Console.Write("\n  {0}", astring);
            Console.Write("\n {0}", new string(underline, astring.Length + 2));
          }
        }
      
        class ClassDemo
        {
          static void Main(string[] args)
          {
            "Demonstrating Basic Class".title();
      
            Basic basic1 = new Basic();
            Type t = basic1.GetType();
            foreach (var method in t.GetMethods())
              Console.Write("\n  method: {0}", method);
            Console.WriteLine();
      
            "basic1 state".title();
            basic1.showState();
            Console.WriteLine();
      
            "basic2 state".title();
            Basic basic2 = new Basic(2.0/3, "another string");
            basic2.showState();
            Console.WriteLine();
      
            "\n  assigning reference types: basic2 = basic1".title();
            basic2 = basic1;
      
            BasicExtensions.title("now here are the resulting states");  // note
            "basic1 state".title();
            basic1.showState();
            Console.WriteLine();
      
            "basic2 state".title();
            basic2.showState();     // now basic1 and basic2 handles refer to
            Console.Write("\n\n");  // same object
          }
        }
      }
      
      The source code to the left implements three classes. The first, "Basic" contains two private fields, and two public properties. It has methods:
      • Constructor Basic(...)
      • Destructor ~Basic()
      • showIdentity()
      • ShowState()
      The constructor re-initializes its two properties. The destructor provides code for a finalizer that runs when the .Net garbage collector disposes the class. Methods showIdentity() and showState() provide information about the class and its internal state. The second class, "BasicExtensions", illustrates an unusual capability. It creates a method, "title(...)", that appears to extend the class of its target, in this case, the string class. Without making any alterations to the string class, this method can be invoked from any string instance that has been compiled in the same assembly as the extension class. You can see it being used in the main method of the third class. The third class, "ClassDemo" implements a single method "Main(...)" that provides an entry point for the process, e.g., when executed, the process starts at the beginning of Main.

        Demonstrating Basic Class
       ---------------------------
        method: Double get_valueProperty()
        method: Void set_valueProperty(Double)
        method: System.Text.StringBuilder get_referenceProperty()
        method: Void set_referenceProperty(System.Text.StringBuilder)
        method: Void showIdentity()
        method: Void showState()
        method: System.String ToString()
        method: Boolean Equals(System.Object)
        method: Int32 GetHashCode()
        method: System.Type GetType()
      
        basic1 state
       --------------
        instance identity is 46104728
                value field: 3.1415927
            reference field: a string
             value property: 0.333333333333333
         reference property: default string
      
        basic2 state
       --------------
        instance identity is 12289376
                value field: 3.1415927
            reference field: a string
             value property: 0.666666666666667
         reference property: another string
      
      
        assigning reference types: basic2 = basic1
       -----------------------------------------------
        now here are the resulting states
       -----------------------------------
        basic1 state
       --------------
        instance identity is 46104728
                value field: 3.1415927
            reference field: a string
             value property: 0.333333333333333
         reference property: default string
      
        basic2 state
       --------------
        instance identity is 46104728
                value field: 3.1415927
            reference field: a string
             value property: 0.333333333333333
         reference property: default string
      
      
        Basic instance is being finalized
        Basic instance is being finalized
      
      Press any key to continue . . .
      
      
      The output from "ClassDemo" is show here. The first few lines show information about the methods of the "Basic" class, using reflection. Each .Net managed assembly contains metadata including detailed information about all the types in the assembly. Finally, we've shown the results of calling method "Basic.showState(). All .Net managed classes derive, either directly or indirectly, from a class called "Object". The entire .Net library system is a hierarchy of classes, rooted at this class. We've used the "GetType()" method, inherited from class "Object", to access the assembly's metadata, and used the "Type" class method, "GetMethods()" to generate the full name of "Basic"'s methods. Finally, we've shown the results of calling method "Basic.showState()". What we're doing here is to illustrate how a fairly simple C# class works, and some of the processing capability it inherits from the "System.Object" class. One last thing to note: making the assignment "basic2 = basic1", as we did near the end of "Main(...)", did not result in two instances with identical state. The assignment actually redirects the basic2 handle to refer to the basic1 instance. You can see that is what happened by observing that before the assignment they each had unique identities - as indicated by their hashcodes. After the assignment, they each have the same identity, e.g., the handles "basic1" and "basic2" refer to the same instance.
    • Generics are run time constructs that allow us to avoid writing a lot of nearly identical code for classes that could sensibly use any of several concrete types, perhaps as arguments to member functions or as instances of member data. Containers are a good example.
      ///////////////////////////////////////////////////////////////////////
      // CsGraph.cs - Generic node and directed graph classes              //
      // ver 1.1                                                           //
      // Jim Fawcett, CSE681 - Software Modeling and Analysis, Spring 2018 //
      ///////////////////////////////////////////////////////////////////////
      /*
       * Maintenance History:
       * --------------------
       * ver 1.1 : 23 Aug 2018
       * - changed definition of CsNode<V,E>
       * - changed logic and return type of CsGraph<V,E>::walk
       * ver 1,0 : 18 Aug 2018
       * - first release
       */
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      
      namespace CsGraph
      {
        /////////////////////////////////////////////////////////////////////
        // CsEdge<V,E> and CsNode<V,E> classes
      
        public class CsEdge<V, E> // has child node & instance of edge type E
        {
          public CsNode<V, E> targetNode { get; set; } = null;
          public E edgeValue { get; set; }
      
          public CsEdge(CsNode<V,E> node, E value)
          {
            targetNode = node;
            edgeValue = value;
          }
        };
      
        public class CsNode<V,E>
        {
          public V nodeValue { get; set; }
          public string name { get; set; }
          public List<CsEdge<V, E>> children { get; set; }
          public bool visited { get; set; }
      
          //----< construct a named node >-----------------------------------
      
          public CsNode(string nodeName)
          {
            name = nodeName;
            children = new List<CsEdge<V,E>>();
            visited = false;
          }
          //----< add child vertex and associated edge value to vertex >-----
      
          public void addChild(CsNode<V,E> childNode, E edgeVal)
          {
            children.Add(new CsEdge<V, E>(childNode, edgeVal));
          }
          //----< find the next unvisited child >----------------------------
      
          public CsEdge<V, E> getNextUnmarkedChild()
          {
            foreach (CsEdge<V, E> child in children)
            {
              if (!child.targetNode.visited)
              {
                child.targetNode.visited = true;
                return child;
              }
            }
            return null;
          }
          //----< has unvisited child? >-------------------------------------
      
          public bool hasUnmarkedChild()
          {
            foreach (CsEdge<V, E> child in children)
            {
              if (!child.targetNode.visited)
              {
                return true;
              }
            }
            return false;
          }
          public void unmark()
          {
            visited = false;
          }
          public override string ToString()
          {
            return name;
          }
        }
       
          Code for CsGraph<V,E> and a test class have been elided.
      }
      
      The class CsEdge<V,E> represents edges of a directed graph. The E parameter is a placeholder for a class the application provides to represent information held by an edge. Similarly, the V parameter is a placeholder for a class the application provides for information held by a vertex. Each edge holds its own instance of E, called edgeValue, and a reference to the vertex to which it points, called targetNode. Both of these are properties, so the edge's data is encapsulated, but can be accessed directly. The CsNode<V,E> class represents nodes, e.g., vertices, of a directed graph. Each node holds a is own instance of V, a nodeValue, a string name, a list of child edges, and a visited property, used to mark a node as visited during graph traversal. Without this marking, traversal could get locked into a cycle of nodes and never exit. So the traversal would iterate forever, without making any forward progress. The CsNode<V,E> class has methods for adding child nodes, each connected with an edge, for finding unvisited child nodes to aid traversal, and to test for existing unvisited children. You can find these classes along with a CsGraph<V,E> and demonstrations of traversals in the Generics CodeSnap.

    • Inheritance is a relationship between two classes, a base class and derived class. It represents an "is-a" relationship, e.g., the derived is a specialization of the base.
      /////////////////////////////////////////////////////////////////////
      // InheritanceDemo.cs - demonstrates basic inheritance             //
      //                                                                 //
      // Jim Fawcett, CSE681 - Software Modeling and Analysis, Fall 2017 //
      /////////////////////////////////////////////////////////////////////
      
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      
      namespace InheritanceDemo
      {
        ///////////////////////////////////////////////////////////////////
        // Person class is base for inheritance hierarchy
      
        public class Person
        {
          public string name { get; set; } = "basic person";
          public Action methodToExecute { get; set; }
      
          public virtual void eat()
          {
            Console.Write("\n    {0} is eating", name);
          }
          public virtual void sleep()
          {
            Console.Write("\n    {0} is sleeping", name);
          }
        }
        ///////////////////////////////////////////////////////////////////
        // Soldier is a Person and is base for Soldier hierarchy
      
        public class Soldier : Person
        {
          public Soldier(string myName = "soldier")
          {
            name = myName;
          }
          public List<string> gear { get; set; } = new List<string>();
          public virtual void salute()
          {
            Console.Write("\n    {0} saluting superior officer", name);
          }
          public virtual void inspection()
          {
            Console.Write("\n    {0} is participating in inspection", name);
          }
        }
        ///////////////////////////////////////////////////////////////////
        // Captain class - top rank Soldier for this example
      
        public class Captain : Soldier
        {
          public Captain(string myName)
          {
            name = myName;
          }
          public override void salute()
          {
            Console.Write("\n    casual salute");
          }
          public override void inspection()
          {
            Console.Write("\n    Captain {0} is inspecting platoon", name);
            salute();
          }
        }
        ///////////////////////////////////////////////////////////////////
        // Private is a lowly Soldier
      
        public class Private : Soldier
        {
          public Private(string myName)
          {
            name = myName;
          }
          public override void salute()
          {
            Console.Write("\n    snappy salute");
          }
          public override void inspection()
          {
            Console.Write("\n    {0} presents equipment for inspection:", name);
            salute();
      
            if (gear.Count > 0)
            {
              foreach(var item in gear)
              {
                Console.Write("\n      {0} presents {1}", name, item);
              }
            }
            else
            {
              Console.Write("\n      Sorry sir, I forgot my equipment");
            }
          }
        }
        ///////////////////////////////////////////////////////////////////
        // Sergeant is the Soldier that gets everything done
      
        public class Sergeant : Soldier
        {
          public Sergeant(string myName)
          {
            name = myName;
          }
          public override void salute()
          {
            Console.Write("\n    brisk salute");
          }
          public override void inspection()
          {
            Console.Write("\n    Sergeant {0} presents his platoon", name);
            salute();
          }
        }
      
      
      Inheritance represents an "is-a" relationship between a base class and its derived classes. In this example, the Person class is the base of an inheritance hierarchy. The class Soldier derives from Person, and so "is-a" Person. Soldier is the base for derived classes, Captain, Private, and Sergeant. All of these are sub-classes of the Soldier class, and so have an "is-a" relationship with Soldier, and, indirectly, with Person. Derived classes inherit all of the methods and data from their base class. They may, or may not be able to directly access that data, depending on its access qualification: private, protected, or public. Since properties, whether explicit or implicit, contain backing data and get and set methods, these are inherited as well. You will find these classes, a test class, and demonstration output, in the CodeSnap Inheritance.

    • Classes have four relationships:
      • Inheritance:
        A derived class inherits all it's base's members. Non-virtual base functions should not be redefined in the derived class. Virtual member functions may be redefined in the derived class. Abstract methods must be redefined.
      • Composition:
        Instances of value types declared as class data members are composed by the class, creating a strong owning relationship. Composed members are always constructed when the composer is constructed, and destroyed when the composer is destroyed.
      • Aggregation:
        Instances of all reference types, e.g., user defined types, are aggregated. A class aggregates a member when it holds a reference to the member instance on the managed heap. Creation of an instance of some type as local data in a member function is also considered to be aggregation. Aggregated instances are owned by the aggregator, but this is a weaker relationship than composition, as the aggregated instances do not exist until code in the aggregator creates them.
      • Using:
        A class uses an instance of some other class when it is passed a reference to the instance in one of its public member funtions. Using is a non-owning relationship and your classes should respect the owning code by doing nothing to invalidate the used instance.
      These four relationships are all that are needed to build Object Oriented programs.
    • Compound objects are instances of classes that use inheritance, composition, and aggregation of other classes to carry out their mission. We need to be careful, especially with initialization, to ensure they operate as expected. Here is a good example of the initialization and use of compound objects.
    • A delegate is a callable object that can be passed to, and returned from other functions. Delegates can refer to one or more methods, each with the same signature, and invoke them at some specified time.
      Here, we are binding a member function of some class to myDel, an instance of the MyDelegate type. Note that the Delegate type declaration defines the (only) method signature that the delegate will invoke. The methods may be either static or non-static members of some class.
        public delegate void MyDelegate();  // delegate type - could declare return type and argument types     
        public event MyDelegate myDel;      // delegate instance
      
        // building linked list of delegates declared in this class
      
        td.myDel += new MyDelegate(aClass.aNonStaticMethod);
        td.myDel += new MyDelegate(aClass.sStaticMethod);
        td.myDel.Invoke();
      
      
      Here's how the delegate is invoked:
        td.myDel();
          or 
        td.myDel.invoke();    
      
      
    • A lambda is an anonymous callable object that can be passed to, and returned from other functions. A lambda can be bound to an delegate with the same signature, e.g., return type and parameter sequence. A very useful feature of lambdas is their capture semantics. They can store data defined in their local scope, to be used later when they are invoked.
      Here, we are binding a lambda with no return type and no arguments to a predefined .Net Action delegate.
        string name = "Jim Fawcett";       // captured data
        string myClass = "CSE681 - SMA";   // more captured data
      
        Action act = () =>
        {
          Console.Write("\n  {0}'s class is {1}", name, myClass);    
        };
      
      
      Here's how the lambda is invoked:
        act.invoke();    
      
      
    • A callable object is any C# construct that can be invoked using parentheses, callable(...). Functions, delegates, and lambdas are all callable objects. Here's a function that accepts and invokes any callable object that takes no arguments. It works because delegates, like Action, will bind to functions, other delegates, and lambdas.
        public class InvokeCallable
        {
          public void invoke(Action act)    
          {
            act.Invoke();
          }
        }
                          
    • Exceptions are a language defined mechanism for handling errors. Exception handling uses instances of System.Exception and the key words throw, try, and catch.
    • A namespace defines a compile-time scope used to distinguish between two or more type or function names with the same value but that have distinct definitions in separate places in code for a single compilation unit. A namespace extends the name of a type, for example, by prepending the type name with the namespace name, i.e., MyNamespace.MyType.
    Online reference for the C# language: C# Reference - MSDN.
  4. A thread is a block of processing instructions, defined by a function passed to the operating system (OS), that executes in a processor core, and is started and stopped by the OS. A thread often runs in an environment containing many other threads that are sequenced in short time-slices by the OS to behave like concurrent processing. A thread may run continuously in a core if there are no other threads contending for that resource.
    Presentations:
    Code Examples:
  5. Windows Communication Foundation (WCF) is a very flexible, and well engineered, wrapper for socket-based network communication.
    A socket is an interface for network communication provided by a low-level library. The sockets we discuss are all stream-oriented, reading and writing sequences of bytes. Stream-oriented means that sockets do not provide you with a message structure. If you need that you will have to provide it. Enter WCF, which makes sending messages very straight-forward.
    In order to communicate sockets have to be connected. To connect, your code needs, on one end of the channel, a connecter socket and, on the other end, a socket listener, to listen for, and establish a connected channel. All of this is wrapped by WCF. You will be concerned with Service and Proxy defininitions, a much more abstract representation of the communication process than low-level sockets.
    Presentations:
    Code Examples:
    Remember that you have to run Visual Studio in Administrator mode to successfully run these demos.
  6. Windows Presentation Foundation (WPF) is a Graphical User Interface (GUI) framework that:
    • Builds interface windows using custom XML markup, called XAML, and C# or C++\CLI event handlers.
    • Has layout model similar to HTML.
    • Provides pervasive dependency relationships between graphical elements and bubbling of events.
    • Supports very complete designer control over the appearance and behavior of each window view.
    • Runs only on Windows, as a desktop application.
    The WPF programming model is a radical departure from traditional GUI frameworks, like MFC and WinForms. It's model is very close to that used by web browsers to render HTML.
    It is very powerful, very easy to use, and you can build reusable templates for view styles you find effective.
    Presentations:
    Code Examples:
  7. .Net provides, for C# and the other .Net languages1 a very well engineered set of standard libraries for I/O, managing data, using threads, and much more. We've focused on these namespaces: We would look at this if we had a bit more time. The following presentation, on XML, relates to the classes in System.Xml, and System.Linq:
    1. There are several languages in the .Net ecosystem, e.g., C#, C++\CLI, Visual Basic, F#, Iron Python, Iron Ruby, ... The compiler backends for these languages all generate Microsoft Intermediate Language (MSIL, usually abreviated to IL), a bytecode like language that runs in a virtual machine, the Common Language Runtime (CLR).
  8. These libraries are code that I've written, and hosted on the college server. They supplement the .Net Framework Libraries, providing functionality that does not exist there.
    Custom Libraries - other examples in Repository folder
  9. Links to almost all the presentations and code, ordered by topic.
    SMA Study Guide