470 likes | 497 Views
Explore how .NET Remoting and Windows Communication Foundation (WCF) optimize communication for distributed applications. Learn about building rich-client applications, services with WSDL interfaces, and more using these technologies.
E N D
Remoting,WCF, WPF, WF,MVC, LINQ,Multithreading,Task Parallel,IoT
Client 1 Proxy of Interface 2 UDDI Registry 2 SOAP UDDI Registry 1 Client 2 Proxy of Interface 1 SOAP Application 1 WSDL Interface 1 Application 2 WSDL Interface 2 WEB XML Web Services WS Class, Contract, Registry, Proxy. XML/HTML: inefficient communication, limited representation power.
Remoting • Remoting is for closely coupled applications with a tighter coupling of client and server. • Such applications have their own client programs and don’t depend on browsers to communicate with the servers. They are “rich-client” applications and distributed applications. • Better suited for two-way communication between clients and servers than are conventional Web applications. • Closely coupled applications utilize network bandwidth more efficiently because they can use lean binary protocols in lieu of HTTP. • “Rich-clients” can use Windows forms to better overcome the limitations of HTML. • Close coupling facilitates stateful connections between clients and servers, which in turn simplifies the task of building stateful applications. .
Remoting • Closely coupled applications building tools: • DCOM (Distributed Component Object Model), • CORBA (Common Object Request Broker Architecture), • Java RMI (Remote Method Invocation). • .NET Remoting: System.Runtime.Remoting is for building closely coupled rich-client applications without the hassles that come with COM programming—apartments, IDL (Interface Definition Language), reference counting, lack of exception handling, incompatible languages and data types, and so on. • .NET remoting is a better COM than COM. .
WCF: Windows Communication Foundation • For distributed applications. • Using service oriented architecture (SOA). • Clients can consume multiple services; Services can be consumed by multiple clients. (M:M) • Services have WSDL interface. • WCF examples: WSS (Web Services Security, extension to SOAP to apply security to web services), WS-Discovery (Web Services Dynamic Discovery, a multicast discovery protocol to locate services), • For building WS-based Multi-tier web application.
WCF: Windows Communication Foundation • Endpoints: client connects to a WCF service at an Endpoint, each service exposes its contract via endpoints. • End point ABC: address, binding, contract • WCF endpoints use SOAP envelope to communicate with clients (for platform independence). • Behaviors allow the developer to customize how the messages are handled.
WPF: Windows Presentation Foundation • Graphical subsystem. • Based on DirectX • 2D and 3D graphics, vector graphics and animation • Remote or standalone • Safe remote view with IE. • Uses XAML to define UI elements. • XAML: eXtensible Application Markup Language
WF: Windows Workflow Foundation • Workflow: a series of distinct programming steps. • An activity at each step. • Workflow Designer in Visual Studio. • Workflow Engine: scheduling, managing, tracking workflows. • To create applications that execute an ordered business process (UA curriculum proposal approval system).
Embedded SQL in C# as strings StringBuilder builder = new StringBuilder(); builder.Append ("select count(*) from users " + "whereusername = \'"); builder.Append (username); builder.Append ("\' and pwd = \'"); builder.Append (password); builder.Append ("\';"); MySqlCommand command = new MySqlCommand (builder.ToString (), connection); Int64 count = (Int64) command.ExecuteScalar ();
LINQ: Language Integrated Query var results = from c in SomeCollection wherec.SomeProperty < 10 select new {c.SomeProperty}; foreach (var result in results) Console.WriteLine(result);
DBMS / Database Server Application Server WEB S E R V E R WEB C L I E N T App User Interface VIEW Supporting Software User Interface Application Logic CONTROLLER Database Engine Database Database API MODEL Architecture of a Four-Tier Application Architecture of a Four-Tier Application
Multithreading Multithreading is a mechanism for performing two or more tasks concurrently. • In the managed world of the common language runtime, the fundamental unit of execution is the thread. • A managed application begins its life as a single thread but can spawn additional threads. • Threads running concurrently share the CPUs/GPUs by using scheduling algorithms provided by the system. • To an observer, it appears as if all the threads are running at once. .
Example using System; using System.Threading; class MyApp { static void Main () { for (int i=0; i<10; i++) { Thread thread = new Thread( new ThreadStart(ThreadFunc)); thread.Name = "My thread # " + i; thread.Start (); } }
Example static void ThreadFunc () { String name = Thread.CurrentThread.Name; for (int i=0; i<10; i++) { for( int j=0; j<100000000; j++); //work System.Console.WriteLine (name + " running at "+ DateTime.Now); } } }
Parallel Extensions • Managed concurrency library • TPL: Task Parallel Library • PLINQ: Parallel LINQ • Multithreading based. • Take advantages of muti-core (Intel) and many core (Nvidia GPU)
Microsoft Universal Windows Platform • Device independence • PCs, Surfaces, Smart Phones, Xboxes • Any language supported by .NET • Use XAML (eXtensible Application Markup Language) to define application
IoTInternet of ThingsConnecting everything over the Internet
Microsoft:https://www.microsoft.com/IoT • Can be connected to Microsoft Cloud (Azure) • Tim and Cory use IoT to connect to their RasberryPI to play video games • Will be taught in HCI (Human Computer Interaction) course in the summer.