2. Agenda About SSWand Presenters Student Introduction Course Overview .NET Overview VS. Net Overview/ Demo Design Patterns Hands on lab
3. SSW Consulting has 18 years development / consulting experience. Adam Cogan is the Chief Software Architect at SSW 1of 3 Microsoft Regional Directors in Australia About SSW
4. SSA @ SSW Loves C# and .NET (Java not anymore) Specializes in Windows Forms ASP.NET TFS testing Automated tests Silverlight Peter Gfader
5. Attendance Please initial the sheet next to your name Hands On Lab Please get Peter to initial sheet Homework Certificate At end of 10 sessions Admin Stuff
6. Name Company Experience IT Programming .NET C# / VB Database Goals for the course Anything else after 9PM Introductions
7. http://www.ssw.com.au/ssw/Events/2010UTSNET/ Part 1: .NET WinForms Overview of .NET & C# basics C# Advanced + Data in Forms Usability - Rules to Better Windows Forms Deployment and Security of Windows Forms Web Services and Threading The 10 Sessions
9. What is .NET? What is C#? Language Differences VB + C# Review of OOP N-Tier Solution Design Demo: Creating WinForms Session 1: Overview
10. .NET is the Microsoft Web services strategy to connect information, people, systems, and devices through software Microsoft, beginning 2000 What is .NET?
11. What is .NET? An application development platform from Microsoft Runtime (Virtual machine) Tools Languages, IDE, … Rapidly develop secure and robust software Web and Windows Full support for object-oriented programming
12. Compiles to MSIL Represents codeindependent from src Executes MSIL
13. What is .NET? Language Independence VB C# F# C++ IronPython Any language that supports the Common Language Runtime (CLR) Specification
16. 2002 - .Net 1.0 / Visual Studio.NET 2003 - .Net 1.1 / Visual Studio 2003 2005 - .Net 2.0 / Visual Studio 2005 2007 - .Net 3.5 / Visual Studio 2008 2008 - .Net 3.5sp1 (added EDMX) 2010 - .Net 4.0/ VS.Net 2010 Details on http://shrinkster.com/1cu8 History of .NET and Visual Studio
17. Interoperability Common Runtime Engine (CLR) Language Independence Base Class Library Simplified Deployment Security Portability Principal Design Features
18. Over 4500 classes that provides features such as: Data access and connectivity (ADO.NET) User Interfaces (WinForms, WPF) Web Applications (ASP.NET, Silverlight) Network Communication (WCF) Workflow (WF) What is the .NET Framework?
19. Evolution The whole .NET FX 3.5 http://shrinkster.com/1515 Only new types in .NET 4 http://shrinkster.com/1cu9 .NET Framework
20. Allows for language independence Memory Management (allocation and de-allocation of memory) Performs automatic garbage collection with the elimination of pointers No more memory leaks (in theory at least!) Exception Handling Security (sandbox from the OS– cannot run malicious code) Converts the IL byte code into runtime code CLR =Common Language Runtime
21. Main programming language for .NET framework Based on C Object Oriented Built with hindsight Java Very similar to Java C++ Very similar to C++ A ‘modern language’ that did not inherit the ‘junk’ from C++ (eg header files, syntax) C# ?
23. C# 1.0 – First Version C# 2.0 – Everything that didn’t fit in 1.0 C# 3.0 – LINQ, functional influence C# 4.0 – Dynamic Programming C# 5.0 … History C# - Anders Hejlsberg
24. Base Class Library Highly structured via Namespaces: System.Data System.Web System.Windows System.Xml See VS.NET/.NET Framework help for complete breakdown
31. Properties Changeable features of objects Eg. „Color“ of a car Methods Actions on an object Eg. Car has a method „Accelerate“ Events Let other objects know about an action Eg. Car has an event „DoorOpened“ Terms
38. var shapes = new List<IShapes>() { new Square(“Red"), new Rectangle(“Blue"), new Triangle(“Red") }; foreach (var shape in shapes) { Console.WriteLine(shape.Color + ": " + shape.CalcSize()); } #3 Polymorphism
53. Methods Language Differences 'VB Public Function GetName () As String Public Sub DoSomething() //C# public string GetName() {} public void DoSomething() {}
55. VB Properties Language Differences PublicPropertyFirstName() AsString Get ReturnpFirstName EndGet Set(ByVal value AsString) pFirstName = value EndSet EndProperty
56. C# Properties Language Differences private string firstName; public StringFirstName{ get { returnfirstName } set { firstName= value; } }
57. Automatic Properties Feature public StringFirstName{ get; set;} Notice no internal variable was declared? It is created by the compiler Saves typing and makes code neater Properties since C# 3.0
58. Auto Implemented Properties Collection Initializers Named parameters Optional parameters Lambdas Can span statements across multiple lines Auto Implemented Properties Collection Initializers (limited) Named parameters Optional parameters Lambdas (limited) Can span statements across multiple lines .NET 3.5
59. Auto Implemented Properties Collection Initializers Named parameters Optional parameters Lambdas Can span statements across multiple lines Auto Implemented Properties Collection Initializers Named parameters Optional parameters Lambdas Can span statements across multiple lines .NET 4
66. Most controls have events Examples Clicked TextChanged Closing Event Handlers Can’t control the order the event gets handled Events
67. "Programming" Able to code in that language "Understanding .NET“ Understanding the .NET Framework and technology "Architecture“ Knowing when and what do and why Architecture vs. Programming
72. A design pattern is a general repeatable solution to a commonly occurring problem in software design. Referred to as GoF (Gang of Four, after their authors). Considered the foundation for all other software patterns. This concepts are incorporated in the .Net Framework (eg. The Iterator pattern) Design Patterns
73. Gang of Four Patterns Creational Patterns Abstract Factory Creates an instance of several families of classes Builder Separates object construction from its representation Factory Method Creates an instance of several derived classes Prototype A fully initialized instance to be copied or cloned Singleton A class of which only a single instance can exist
74. Gang of Four Patterns Behavioral Patterns Chain of Resp. A way of passing a request between a chain of objects Command Encapsulate a command request as an object Interpreter A way to include language elements in a program Iterator Sequentially access the elements of a collection Mediator Defines simplified communication between classes Memento Capture and restore an object's internal state Observer A way of notifying change to a number of classes State Alter an object's behaviour when its state changes Strategy Encapsulates an algorithm inside a class Template Method Defer the exact steps of an algorithm to a subclass Visitor Defines a new operation to a class without change
75. Gang of Four Patterns Structural Patterns Adapter Match interfaces of different classes Bridge Separates an object’s interface from its implementation Composite A tree structure of simple and composite objects Decorator Add responsibilities to objects dynamically Facade A single class that represents an entire subsystem Flyweight A fine-grained instance used for efficient sharing Proxy An object representing another object
76. Enterprise Architecture Patterns Design Patterns representing an entire system/software application Logical layers Areas of concern Gang of Four Patterns
78. Separate logic and data access from presentation Easier to maintain code Low-coupling Modularity/Re-use business logic Easily add a different UI Web UI Smart Phone UI Team Development Why n-tier?
82. Windows Presentation Foundation Rich Windows Applications Great Architecture + Great Graphics Rapid Prototyping 2D, 3D, Vector, Document Flow, Layouts, Composition, etc. WPF in a nutshell
83. User interface (UI) components. User interface components provide a way for users to interact with the application. They render and format data for display to users, and acquire and validate data that users enter. User process components. To help synchronize and orchestrate these user interactions, it can be useful to drive the process using separate user process components. This avoids hard-coding the process flow and state-management logic in the UI elements themselves, and the same basic user interaction patterns can be reused by multiple UIs. Business components. Business components implement the business logic of the application. Regardless of whether a business process consists of a single step or an orchestrated workflow, your application will probably require components that implement business rules and perform business tasks. Rich Client App Architecture
84. Business workflows. After the required data is collected by a user process, the data can be used to perform a business process. Many business processes involve multiple steps that must be performed in the correct order and orchestrated. Business workflows define and coordinate long-running, multi-step business processes, and they can be implemented using business process management tools. Business entity components. Business entities are used to pass data between components. The data represents real-world business entities, such as products or orders. The business entities that are used internally in the application are usually data structures, such as DataSets, DataReaders, or Extensible Markup Language (XML) streams, but they can be implemented as custom object-oriented classes that represent the real-world entities your application has to work with, such as a product or an order. Rich Client App Architecture
85. Application façade (optional). A façade is used to combine multiple business operations into single message-based operation. You might access the application façade from the presentation layer by using a range of communication technologies. Data access logic components. Data access components abstract the logic necessary to access your underlying data stores. Doing so centralizes data access functionality and makes it easier to configure and maintain. Data Helpers/utilities. Implement data helpers for centralizing generic data access functionality such as managing database connections and caching data. You can design data source–specific helper components to abstract the complexity of accessing the database. Avoid adding any business logic to the helper components. Service agents. When a business component must use functionality provided in an external service, you might need to provide some code to manage the semantics of communicating with that particular service. Service agents isolate the idiosyncrasies of calling diverse services from your application, and can provide additional services such as basic mapping between the format of the data exposed by the service and the format your application requires. Rich Client App Architecture
86. The 10 Sessions Overview of .NET OOP Language Differences n-Tier Application Architecture Demo: Creating WinForms (C#) Summary
87. Creating a Windows Form Application Opening forms Menus Event handlers User controls Hands ON LAB
88. The C# tutorialhttp://www.csharp-station.com/Tutorial.aspx Online videos and traininghttp://channel9.msdn.com/learn/courses/VS2010/ Nice video to OOPhttp://msdn.microsoft.com/en-us/beginner/cc963989.aspx More on OOPhttp://en.wikipedia.org/wiki/Object-oriented_programming Resources 1/2
89. Design patterns in C#http://www.dofactory.com/Patterns/Patterns.aspx Winforms tips and trickshttp://peitor.blogspot.com/search/label/winforms Use controls in Windows Forms! http://www.telerik.com http://www.devexpress.com http://www.infragistics.com Beginner Developer Learning Centerhttp://msdn.microsoft.com/en-us/beginner/default.aspx Resources 2/2
91. Thank You! Gateway Court Suite 10 81 - 91 Military Road Neutral Bay, Sydney NSW 2089 AUSTRALIA ABN: 21 069 371 900 Phone: + 61 2 9953 3000 Fax: + 61 2 9953 3105 info@ssw.com.auwww.ssw.com.au
Notas do Editor
Click to add notesPeter Gfader Developing Windows and Web applications
implementing best of breed solutions that improve your operating efficiency and competitive advantage. We deliver scalable and extensible custom solutions on top of the latest Microsoft technologiesand one of three Microsoft Regional Directors in Australia
Java current version 1.6 Update 171.7 released next year 2010Dynamic languages Parallel computingMaybe closures
Make sure that seat allocation is ready for Adam and SumeshAlso inform them that the UTS environment needs some additional software installedAsk for USB devices so it can be copied for their installationPPT and Doc viewer + labs + PPT
Ask for people in the class who they are and backgroundPreferred nameShow booksShow training kits
This was the original description of .Net from around 2000 when it was announced.It is a consistent framework, tools, languages, runtime, and technologies that are structured in a coherent wayCompare to Java/ J2EE
2002 v1.0 of .netfw
MSIL Independent from source languageFrom machine running onOpen notepadpublic class MyConsoleApp{ public static void Main() {System.Console.WriteLine("Hallo Welt"); }}Run csc filename.txtShow filesRun .exeIldasm .exe
The image is an old image from the early days of .Net :J# is depreciated and not used.J# was microsofts implementations of Java, and then Microsoft and Sun had a falling out
Examplepublic class SendHelloWorld{ public static void Main() {System.Console.WriteLine("Hallo Welt"); }}On command line „Csc helloworld.cs“ Run "helloworld.exe"
22nd march
Principal design featuresInteroperability Because interaction between new and older applications is commonly required, the .NET Framework provides means to access functionality that is implemented in programs that execute outside the .NET environment. Access to COM components is provided in the System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework; access to other functionality is provided using the P/Invoke feature. Common Runtime Engine The Common Language Runtime (CLR) is the virtual machine component of the .NET framework. All .NET programs execute under the supervision of the CLR, guaranteeing certain properties and behaviors in the areas of memory management, security, and exception handling. Language Independence The .NET Framework introduces a Common Type System, or CTS. The CTS specification defines all possible datatypes and programming constructs supported by the CLR and how they may or may not interact with each other. Because of this feature, the .NET Framework supports the exchange of instances of types between programs written in any of the .NET languages. This is discussed in more detail in Microsoft .NET Languages. Base Class Library The Base Class Library (BCL), part of the Framework Class Library (FCL), is a library of functionality available to all languages using the .NET Framework. The BCL provides classes which encapsulate a number of common functions, including file reading and writing, graphic rendering, database interaction and XML document manipulation. Simplified Deployment The .NET framework includes design features and tools that help manage the installation of computer software to ensure that it does not interfere with previously installed software, and that it conforms to security requirements. Security The design is meant to address some of the vulnerabilities, such as buffer overflows, that have been exploited by malicious software. Additionally, .NET provides a common security model for all applications. Portability The design of the .NET Framework allows it to theoretically be platform agnostic, and thus cross-platform compatible. That is, a program written to use the framework should run without change on any type of system for which the framework is implemented. Microsoft's commercial implementations of the framework cover Windows, Windows CE, and the Xbox 360.[4] In addition, Microsoft submits the specifications for the Common Language Infrastructure (which includes the core class libraries, Common Type System, and the Common Intermediate Language),[5][6][7] the C# language,[8] and the C++/CLI language[9] to both ECMA and the ISO, making them available as open standards. This makes it possible for third parties to create compatible implementations of the framework and its languages on other platforms.
Consolidated many different technologies and concepts under one consistant framework and platformRegular expressions (Regex)Cryptography
“in theory at least” – poor coding and lack of understanding can lead to bad software still!
Story about Anders:Delphi was better than vb,So microsoft bought anders, but his contract wouldn’t allow him to work straight away, so they paid him to sit on a beach for a year..net platform is the next quantum leap from delphiIt effectively killed borlandbuilt with the hindsight of many languages, but most notably Java and C++. It was co-authored by Anders Hejlsberg (who is famous for the design of the Delphi language), and Scott Wiltamuth.