Your SlideShare is downloading. ×
DotNet Introduction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

DotNet Introduction

6,239
views

Published on

Published in: Technology

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,239
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
190
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. William
  • 2. Survey
    • 听说过 DotNet, C# ( 1 )
    • 知道什么是 C#, DotNet Framework ( 2 )
    • 知道如何命令行编译 C# ( 1 )
    • 编写过 C# 或者 VB.Net 程序 ( 2 )
    • 知道什么是 CLR ( 2 )
    • 知道什么是 Rails , ASP.NET MVC ( 2 )
    • 知道什么是 Ruby, Python (1)
    • 知道什么是 GC , LINQ ( 2 )
    • 知道什么是 Functional Programming , Lambda ( 3 )
    • 知道什么是 UI Automation MSTest MSBuild ( 2 )
    • 知道什么是 Dynamic language in DotNet ( 2 )
  • 3. What’s Framework? http://en.wikipedia.org/wiki/Software_framework Framework is an abstraction in which common code providing generic functionality can be selectively overridden or specialized by user code providing specific functionality. Frameworks are a special case of software libraries in that they are reusable abstractions of code wrapped in a well-defined API , yet they contain some key distinguishing features that separate them from normal libraries. Frameworks have these distinguishing features that separate them from libraries or normal user applications: 1. inversion of control - In a framework, unlike in libraries or normal user applications, the overall program's flow of control is not dictated by the caller, but by the framework. 2. default behavior - A framework has a default behavior. This default behavior must actually be some useful behavior and not a series of no-ops. 3. extensibility - A framework can be extended by the user usually by selective overriding or specialized by user code providing specific functionality 4. non-modifiable framework code - The framework code, in general, is not allowed to be modified. Users can extend the framework, but not modify its code.
  • 4. Quiz
    • Is DotNet framework a real framework?
    • “ Conversion over Configuration”?
  • 5. http://msdn.microsoft.com/zh-cn/netframework/default.aspx
  • 6. DotNet FAQ
    • http://msdn.microsoft.com/en-us/library/ms973850.aspx
  • 7.
    • 工具也是 .Net 的一部分?
    • COM VisualStudio.Net Ado.Net Windows.Net ASP.NET 囧 微软,你该找个起名大师了!
    • Information , Service, Communication, Connection, too many BIG concepts !
    • 新瓶装旧酒。 MVC 哪一年提出的概念? Garbage Collection 哪一年? FP 哪一年?(参考 Wiki )
    • 从务虚到务实
  • 8.  
  • 9.  
  • 10. http://java.sun.com/javase/6/docs/
  • 11.  
  • 12.  
  • 13.  
  • 14.  
  • 15. Quiz
    • What is DotNet Framework?
    • Why Microsoft design the DotNet?
    • Why Microsoft didn’t use DotNet in OS?
    • Why design C#?
    • Why not C++?
  • 16.
    • 下午 CSDN 记者参加了 Windows Phone 团队 Charles Kindle 对开发平台的演讲。值得开发者注意的是, Windows Phone 对第三方开放的开发框架就是两种:针对普通应用的 Silverlight ,针对游戏的 XNA ,不再支持原生应用 。
    • 总而言之, Silverlight 就是 Windows Phone 7 Series 的应用开发平台(高性能游戏则可通过 XNA 框架进行开发),但 Windows Phone 7 Series 首先支持的不是最新的 Silverlight 4 , 而是 Silverlight 3 加上些手机特性的支持,比如位置服务、加速度传感器、推送提醒、手机电话等。
  • 17.  
  • 18. http://channel9.msdn.com/tags/
  • 19. Quiz
    • Why we need to learn and use DotNet?
  • 20. Why we need to use it? ****
    • 1 New main tech in future, must learn it.
      • Windows Phone7, Windows7, etc.
    • 2 Easy to use
    • 3 New develop method (TDD)
    • 4 Different view point, different design idea
  • 21.
    • The common language runtime (CLR) is the execution engine for .NET Framework applications.
    • It provides a number of services, including the following:
      • Code management (loading and execution)
      • Application memory isolation
      • Verification of type safety
      • Conversion of IL to native code
      • Access to metadata (enhanced type information)
      • Managing memory for managed objects
      • Enforcement of code access security
      • Exception handling, including cross-language exceptions
      • Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data)
      • Automation of object layout
      • Support for developer services (profiling, debugging, and so on)
  • 22. MSDN .NET Framework http://msdn.microsoft.com/en-us/library/system.io%28VS.100%29.aspx http://en.wikipedia.org/wiki/.NET_Framework http://zh.wikipedia.org/wiki/.NET%E6%A1%86%E6%9E%B6 http://msdn.microsoft.com/zh-cn/library/w0x726c2%28v=vs.90%29.aspx
  • 23. .NET Framework Class Library
    • The .NET Framework class library is a library of classes, interfaces, and value types that provides access to system functionality and is designed to be the foundation on which .NET Framework applications, components, and controls are built.
  • 24. The Base Class Library (BCL) includes a small subset of the entire class library and is the core set of classes that serve as the basic API of the Common Language Runtime . [9] The classes in mscorlib.dll and some of the classes in System.dll and System.core.dll are considered to be a part of the BCL. The BCL classes are available in both .NET Framework as well as its alternative implementations including .NET Compact Framework , Microsoft Silverlight and Mono . The Framework Class Library (FCL) is a superset of the BCL classes and refers to the entire class library that ships with .NET Framework. It includes an expanded set of libraries, including WinForms , ADO.NET , ASP.NET , Language Integrated Query , WPF , WCF among others. The FCL is much larger in scope than standard libraries for languages like C++ , and comparable in scope to the standard libraries of Java .
  • 25.
    • using System;
    • using System.IO;
    • namespace ConsoleApplication1
    • {
    • class Program
    • {
    • public static long DirSize(DirectoryInfo d)
    • {
    • long Size = 0;
    • FileInfo[] fis = d.GetFiles();
    • foreach (FileInfo fi in fis)
    • {
    • Size += fi.Length;
    • }
    • DirectoryInfo[] dis = d.GetDirectories();
    • foreach (DirectoryInfo di in dis)
    • {
    • Size += DirSize(di);
    • }
    • return (Size);
    • }
    • static void Main(string[] args)
    • {
    • System.String dirName = "c:emp";
    • DirectoryInfo d = new DirectoryInfo(dirName);
    • Console.WriteLine("The size of {0} and its subdirectories is {1} bytes.", d, DirSize(d));
    • }
    • }
    • }
  • 26.
    • import java.io.*;
    • import java.util.*;
    • public class DirUtils {
    • public static List recurseDir(String dir) {
    • String result, _result[];
    • result = RecurseDirFrom(dir);
    • _result = result.split("");
    • return Arrays.asList(_result);
    • }
    • private static String RecurseDirFrom(String dirItem) {
    • File file;
    • String list[], result;
    • result = dirItem;
    • file = new File(dirItem);
    • if ( file.isDirectory( )) {
    • list = file.list();
    • for (int i = 0; i < list.length; i++)
    • result = result + &quot;|&quot; + RecurseDirFrom(dirItem + File.separatorChar + list[i]);
    • }
    • return result;
    • }
    • public static void main(String arg[]) {
    • if (arg.length > 0) {
    • System.out.println(&quot;recursive Dirs from &quot; + arg[0]);
    • System.out.println( DirUtils.recurseDir(arg[0]) );
    • }
    • }
    • }
  • 27. Best practice
    • 处理异常的最佳做法
    • 开发全球通用应用程序的最佳做法
    • System.Net 类的最佳做法
    • 托管线程处理的最佳做法
    http://msdn.microsoft.com/zh-cn/library/ms184411%28v=vs.90%29.aspx
  • 28. Examples
    • 添加和移除内存压力应用程序示例
    • 压缩应用程序示例
    • 字数统计应用程序示例
    • .NET 客户端 Stopwatch 应用程序示例
    • CLR 版本检测技术示例
    • 组件服务示例
    • 垃圾回收技术示例
    • COM 互操作性示例
    • 本地化示例
    • 网络连接示例
    • 反射示例
    • 远程处理示例
    • 序列化示例
    • 线程示例
    • 值和枚举类型技术示例
    • Windows 窗体控件示例
  • 29. VB.net vs C#.net
    • Complete Comparison for VB.NET and C#
    • Google “vb c# translate”
    • http://support.microsoft.com/kb/308470
    • http://www.harding.edu/fmccown/vbnet_csharp_comparison.html
  • 30. C# Programming Tools
    • http://msdn.microsoft.com/zh-cn/vcsharp/default.aspx CSharp Development Center
    • http://msdn.microsoft.com/en-us/magazine/cc300497.aspx Ten Must-Have Tools Every Developer Should Download
    • http://www.codeplex.com
  • 31.  
  • 32. http://www.microsoft.com/china/msdn/events/webcasts/shared/Webcast/MSDNWebCast.aspx Use iReaper to download
  • 33.  
  • 34. http://channel9.msdn.com/tags/CSharp/
  • 35. http://msdn.microsoft.com/zh-cn/practices/default.aspx
  • 36. http://code.msdn.microsoft.com/Project/ProjectDirectory.aspx?TagName=C%23
  • 37. DotNet internal
    • http://mono-project.com/
    • http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx
    • http://netmassdownloader.codeplex.com
    • Shared Source Common Language Infrastructure 2.0 Release
  • 38. Copy and Clone
    • DotNet Platform copy Java Platform
    • WCF(Odata) copy XMLRPC
    • WPF copy RIA (Flash, Flex, Html5, JavaFx)
    • C# language copy Java language
    • Azure copy Amazon S3 (Google cp it too)
    • Team system copy 持续集成
    • Win7 copy MacOSX
  • 39.  
  • 40. Why we say “platform”
    • Dynamic language
      • IronPython, IronRuby, Lua
    • Functional Programming
      • Fsharp
    • You need to know more
      • JavaScript ( www.jquery.com ) for asp.net
      • Web development, html, css
      • Front dev, server-side dev, do we need desktop?
  • 41. IronPython Demo
    • Used in: Desktop application, small utility.
    • http://www.ironpython.info/index.php/Contents#Windows_Forms
  • 42.
    • # http://www.ironpython.info/index.php/Interacting_with_Excel
    • # ref: Excel 2003 VBA Language Reference
    • import clr
    • from System import Array
    • from System import DateTime
    • clr.AddReference(&quot;Microsoft.Office.Interop.Excel&quot;)
    • import Microsoft.Office.Interop.Excel as Excel
    • excel = Excel.ApplicationClass()
    • excel.Visible = True
    • workbook = excel.Workbooks.Add()
    • worksheet = workbook.Worksheets.Add()
    • worksheet.Name = &quot;aaaaa&quot;
    • cell1 = worksheet.Range[&quot;A2&quot;]
    • cell1.Value2 = 42
    • xlrange = worksheet.Range[&quot;A3&quot;, &quot;b4“]
    • arr1 = Array.CreateInstance(object, 2, 2)
    • arr1[0, 0] = DateTime.Now
    • arr1[0, 1] = 3
    • arr1[1, 0] = &quot;hi Excel test.&quot;
    • arr1[1, 1] = &quot;hi there!&quot;
    • xlrange.Value2 = arr1
  • 43. IronRuby Demo
    • Used in: Quick dirty website.
    • Sinatra, Rails
    • ir, igem,
  • 44.
    • require 'rubygems'
    • require 'sinatra'
    • get '/hi' do
    • &quot;Hello World!“
    • end
    • get '/hi/:name' do
    • # matches &quot;GET /hello/foo&quot; and &quot;GET /hello/bar&quot;
    • # params[:name] is 'foo' or 'bar'
    • &quot;Hello #{params[:name]}! you come from /hi&quot;
    • end
  • 45. Quiz
    • Why we should learn and use dynamic language?
    • Which area is suitable for Ruby/Python?
  • 46. Survey
    • First gets 3, second gets 1, third gets 0, how about your rate?
    • Web develop, DotNet(C#) vs Ruby/Python vs Java
    • Desktop develop, DotNet(C#) vs Ruby/Python vs Java
    • Cross OperationSystem, DotNet(C#) vs Ruby/Python vs Java
    • Embedded (Phone), DotNet(C#) vs Ruby/Python vs Java
    • Game (Server) develop, DotNet(C#) vs Ruby/Python vs Java
  • 47. A New World – F#
    • Csharp:
    • int[] numbers = new int[7] { 0, 1, 2, 3, 4, 5, 6 };
    • var numQuery = from num in numbers
    • where (num % 2) == 0
    • select num;
    • foreach (int num in numQuery)
    • {
    • Console.Write(&quot;{0,1} &quot;, num);
    • }
    • Fsharp:
    • let listN = List.filter (fun n -> (n % 2) = 0) [0..6];;
    • printfn &quot;listN = %A&quot; listN
    http://msdn.microsoft.com/en-us/fsharp/default.aspx
  • 48.
    • let rec qsort L =
    • match L with
    • | [] -> []
    • | x::xs ->
    • let smaller = [for i in xs when i <= x -> i] in
    • let larger = [for i in xs when i > x -> i] in
    • qsort smaller @ [x] @ qsort larger;;
    • qsort [3;5;1;4;2];;
    • qsort [7;5;10;2;3;67;1;3];;
    • qsort [&quot;Hello&quot;; &quot;AA&quot;; &quot;hello&quot;; &quot;help&quot;; &quot;Aa&quot;; &quot;aa&quot;;];;
    http://www.gofsharp.com/FS/Translations/Hutton/Hutton.txt
  • 49. Fsharp Demo
    • http://research.microsoft.com/en-us/people/dsyme/
    • http://www.cnblogs.com/JeffreyZhao/tag/F%23/
    • *** Fsharp could do all work that Csharp could ***
  • 50. Quiz
    • Why we should learn/use Functional language?
    • Which area is suitable for Fsharp?
    • Concurrency?
    • Parallelism?
  • 51.
    • Concurrency (Erlang) and parallelism (Fsharp) are NOT the same thing. Two tasks T1 and T2 are concurrent if the order in which the two tasks are executed in time is not predetermined,
      • T1 may be executed and finished before T2,
      • T2 may be executed and finished before T1,
      • T1 and T2 may be executed simultaneously at the same instance of time (parallelism),
      • T1 and T2 may be executed alternatively,
    • If two concurrent threads are scheduled by the OS to run on one single-core non-SMT non-CMP processor, you may get concurrency but not parallelism. Parallelism is possible on multi-core, multi-processor or distributed systems.
    • Concurrency is often referred to as a property of a program, and is a concept more general than parallelism .
  • 52.
    • SliverLight more important
    • UIAutomation Test
    • Odata
    • Azure platform
    • ASP.net MVC
    • MVVM
  • 53.  
  • 54. Advance topic : Garbage Collection
    • Garbage Collection useful documents
      • http://www.ibm.com/developerworks/cn/java/j-jtp10283/
      • http://www.ibm.com/developerworks/cn/java/l-JavaMemoryLeak2/index.html
      • http://blogs.msdn.com/maoni/archive/2004/06/15/156626.aspx
      • http://msdn.microsoft.com/zh-cn/library/0xy59wtx.aspx
      • http://blogs.msdn.com/maoni/archive/2004/06/15/156626.aspx
      • http://blogs.msdn.com/maoni/archive/2004/09/25/234273.aspx
      • http://blogs.msdn.com/maoni/archive/2004/12/19/327149.aspx
      • http://blogs.msdn.com/maoni/archive/2005/05/06/415296.aspx
      • http://www.codeproject.com/KB/dotnet/garbagecollection.aspx
      • http://blogs.msdn.com/tess/archive/2006/09/06/net-memory-usage-a-restaurant-analogy.aspx
      • http://msdn.microsoft.com/en-us/library/ms973837.aspx
      • http://msdn.microsoft.com/en-us/library/f144e03t.aspx
  • 55. Quiz
    • How to design a garbage collection library?
  • 56. In DotNet, managed heap concept. http://www.codeguru.com/columns/dotnet/article.php/c6593
  • 57. GC 常用技术
    • 引用计数
      • COM , smart pointer
    • Tracing
      • Mark-Compact 此算法結合了“標記 - 清除”和“複製”兩個演算法的優點。也是分兩階段,第一 階段從根節點開始標記所有被引用物件,第二階段遍歷整個 heap ,把清除未標記物件並且把存活物件“壓縮”到 heap 的其中一塊,按順序排放。此演算法避免了“標記 - 清除”的碎片問題,同時也避免了“複製”算法的空間問題。
    http://pt.withy.org/publications/AMM.pdf http://www.cs.nctu.edu.tw/~kjji/GC.pptx http://moon.nju.edu.cn/twiki/pub/ICSatNJU/CourseOOT/04_Memory_Management.ppt http://www.cs.wustl.edu/~mdeters/doc/slides/rtgc-history.pdf http://lua-users.org/wiki/GarbageCollectionTutorial http://blog.csdn.net/akara/archive/2010/03/23/5408678.aspx http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29
  • 58. http://chaoticjava.com/posts/how-does-garbage-collection-work/
  • 59. Advance topic
    • Add-ins and Extensibility Describes how to develop add-in applications that extend a host application's functionality.
    • Asynchronous Programming Design Patterns Describes two design patterns available in the .NET Framework that are used to run threads separately from the main application thread.
    • Component Authoring for the Design Environment Provides links to information about creating your own components in the .NET Framework, customizing their behavior and display, and creating custom controls for the Windows Presentation Foundation (WPF).
    • Dynamic Source Code Generation and Compilation Discusses the Code Document Object Model (CodeDOM), which enables the output of source code in multiple programming languages.
    • Emitting Dynamic Methods and Assemblies Describes a set of managed types in the System.Reflection.Emit namespace that enable a compiler or tool to emit metadata and Microsoft intermediate language (MSIL) at run time and optionally generate a portable executable (PE) file on disk.
    • Expression Trees Introduces expression trees, which are tree-shaped data structures that can be used to represent language-level code in the form of data.
    • Garbage Collection Discusses how the garbage collector manages memory and how you can program to use memory more efficiently.
    • Hosting the Common Language Runtime Explains the concept of a runtime host, which loads the runtime into a process, creates the application domain in the process, and loads and executes user code.
    • Interoperability Describes services provided by the .NET Framework for interaction with COM components, COM+ services, external type libraries, and many operating system services.
    • .NET Remoting Discusses establishing communication between objects that run in different processes.
    • Network Programming Shows how to use Internet access classes to implement both Web- and Internet-based applications.
    • Reflection Explains how to obtain access to type information at run time by using reflection.
    • Reliability Discusses writing reliable code for any host that is executing in a .NET Framework environment.
    • Serialization Discusses the process of converting the state of an object into a form that can be persisted or transported.
    • Managed Threading Explains the runtime support for threading and how to program by using various synchronization techniques.
    • Writing Serviced Components Describes how to configure and register serviced components to access COM+ services.
  • 60. More questions?
    • MSDN
    • Codeproject.com
    • StackOverflow.com
    • Codeplex.com
    • Wiki
    • Blog search
    • MSDN forum
    • http://www.cnblogs.com
  • 61. DotNet shortcoming
    • YAGNI, too big, too over.
    • 新名词, Oh No ! ORZ !
    • 技术依赖强烈 Silverlight + WCF
    • 平台及工具 IDE 依赖强烈
    • 学习曲线陡峭
    • 变化剧烈 WinForm or WPF? Remoting or WCF?
    • 大而全?还是大而无当?
  • 62.
    • 重点学习” stable” and “Internal” knowledge ,新技术不过是它们的组合包装 . RPC, XML, HTTP, Socket, GC, Dynamic language, FP, UnitTest, CLR, API design, Framework design, String code, RE, DataStructure, Algorithm, Web framework pattern
    • 适当了解你需要的 DotNet Framework, WCF, WPF, Asp.net, Silverlight
    • 保持对技术的好奇心
    • 使用新版本 , Win7 + DotNet4 + VS2010
  • 63. Learn it, Use it, Share it!