专业英语第一章课件.ppt
Chapter 1 Programming and Mobile Development Platform,说 明:词汇后的1245等为相应词语释义词汇后的z1z2z3z4等为相应词汇背景知识注释带下划线的句子后面的iiiiiiiv等为对句子的译文(翻译),Chapter 1 Programming and Mobile Development Platform,Background Knowledge,本章讲述有关Microsoft Visual Studio.NET、C#编程语言以及手机操作系统Android的相关知识,节选自如下文献:Jesse Liberty.Programming C#,OReilly Press,2001:.17-20.Deitel,JAVA How to Program,the fourth Edition,2009:12-19.Ed Burnette.Hello AndroidIntroducting Googles Mobile Development Platform,2nd Edition,The Pragmatic Bookshelf,Texas,2009:10-26.,C#是一种安全的、稳定的、简单的、优雅的、由C和C+衍生出来的面向对象的编程语言。它在继承C和C+强大功能的同时去掉了一些它们的复杂特性(例如没有宏和模版,不允许多重继承)。C#综合了VB简单的可视化操作和C+的高运行效率,以其强大的操作能力、优雅的语法风格、创新的语言特性和便捷的面向组件编程的支持成为.NET开发的首选语言。JAVA是一种面向对象的程序设计语言,具有高性能、可移植性、简单、面向对象、解释性语言、结构中立、类装载、安全、多线性、分布式、动态等特性。它的执行过程是首先将源代码编译成字节码文件,然后在不同各种不同平台的虚拟机上执行字节码,从而实现“一次编译,到处执行”的跨平台特性。随着移动设备的普及,移动设备开发平台也日渐火热,目前常见的移动开发平台有塞班、iPhone以及当下正在逐步兴起的Android。学习和采用Android的理由主要有:Android系统是开源的,谷歌在推出Android的时候就将其定位于开源技术,所以Android也继承了开源技术的基本特征,即免费、安全、易于开发,并且系统应用的移植很容易实现。国外很多移动巨头都开始进行Android的开发,国内厂商可以借鉴其开发经验,更好地促进移动软件技术的开发与应用。学习本章时,注意体会C#、Java语言的不同;按照文中所述方法,在Eclipse上搭建起开发Android应用程序的平台。同时,注意长句的翻译。,Chapter 1 Programming and Mobile Development Platform,Text,In this chapter,we will present the coding knowledge and the popular mobile development platform.C#and the.NET framework will be present first,then the comparability among C#and Visual Basic.NET,Java,C+will be proposed.Java overview,including its history,its class libraries,its typical environment,will be present then.Android is a new open source software toolkit for mobile phones that was created by Google and the Open Handset Alliancez1.In a few years,its expected to be found in millions of cell phones and other mobile devices,making Android a major platform for application developers.z1开放手机联盟包括手机制造商、手机芯片厂商和移动运营商等,是谷歌公司于2007年11月宣布组建的一个全球性组织,它支持谷歌可能发布的手机操作系统或应用软件,共同开发名为Android的开放源代码的移动系统。,Chapter 1 Programming and Mobile Development Platform,Section1 C#and the.NET Framework,The goal of C#is to provide a simple,safe,modern,object-oriented,Internet-centric,highperformance language for.NET development.C#is a new language,but it draws on the lessons learned over the past three decades.In much the way that you can see in young children the features and personalities of their parents and grandparents,you can easily see in C#the influence of Java,C+,Visual Basic,and other languages.,The focus of this section is the C#language and its use as a tool for programming on the.NET platform.You learn C#specifically to create.NET applications.This section does not consider C#in a vacuum but places the language firmly in the context of Microsofts.NET platform and in the development of desktop and Internet applications.,(1)Overview of.NET,When Microsoft announced C#in July 2000,its unveiling1 was part of a much larger event:the announcement2 of the.NET platform.The.NET platform is,in essence,a new development framework that provides a fresh application programming interface(API)to the services and APIs of classic Windows operating systems,especially Windows 2000,while bringing together a number of disparate technologies that emerged from Microsoft during the late 1990si.1 unveiling:v.揭开面纱,显露2 announcement:n.,宣告i.NET平台是为Windows操作系统的API和服务提供全新的API的新的开发框架,特别是Windows2000。它同时还集中微软在20世纪90年代后期开发的各种独立的技术之大成。这里的disparate意为全异的,不同的。,Among the latter are COM+component services,the ASP web development framework,a commitment to XML and object-oriented design,support for new web services protocols such as SOAPz1,WSDLz2,and UDDIz3,and a focus on the Internet,all integrated within the DNA1 architecture.1 DNA:此处不是指脱氧核糖核酸,这是Distributed N Architexture的缩写,它是微软.Net架构的前身z1SOAP指简单对象访问协议Simple Object Access Protocol,是一种轻量的、简单的、基于XML的协议,允许Java对象和COM对象在分布式、分散的、基于Web的环境中彼此通话。更一般地,SOAP允许任何类型的对象(或代码)在任何平台上,以任何一种语言相互通信。z2WSDL是Web Services Description Language的缩写,是用来描述Web服务和说明如何与Web服务通信的XML语言,用于描述Web Service及其函数、参数和返回值。一些开发工具既能根据Web Service生成WSDL文档,又能导入WSDL文档,生成调用相应Web Service代码。z3UDDI是Universal Description Discovery and Integration的缩写,意为统一描述、发现和集成的协议,它使得商业实体能够彼此发现,定义它们怎样在Internet上互相作用并在一个全球的注册体系架构中共享信息。,Microsoft says it is devoting 80%of its research and development budget to.NET and its associated technologies.The results of this commitment to date are impressive1.For one thing,the scope of.NET is huge.The platform consists of four separate product groups:1 impressive:adj.印象深刻的,(1)A set of languages,including C#and Visual Basic.NET;a set of development tools,includingVisual Studio.NET;a comprehensive class library for building web services and web and Windows applications;as well as the Common Language Runtime(CLRz1)to execute objects built within this framework.z1CLR位于操作系统顶层,(2)A set of.NET Enterprise Servers,formerly known as SQL Server 2000,Exchange 2000,BizTalk 2000,and so on,that provide specialized functionality for relational data storage,email,B2B commerce,etc.(3)An offering of commercial web services,recently announced as Project Hailstorm;for a fee,developers can use these services in building applications that require knowledge of user identity,etc.(4)New.NET-enabled non-PC devices,from cell phones to game boxes.,(2)The.NET Framework,Microsoft.NET supports not only language independence,but also language integration.This means that you can inherit from classes,catch exceptions,and take advantage of polymorphism1 across different languages.The.NET Framework makes this possible with a specification2 called the Common Type System(CTS)that all.NET components must obey.For example,everything in.NET is an object of a specific class that derives from the root class called System.Object.The CTS supports the general concept of classes,interfaces,delegates(which support callbacks),reference types,and value types.1 polymorphism:adj.多态的2 specification:n.规范,说明书,Additionally,.NET includes a Common Language Specification(CLSz1),which provides a series of basic rules that are required for language integration.The CLS determines the minimum requirements for being a.NET language.Compilers that conform1 to the CLS create objects that can interoperate2 with one another.The entire Framework Class Library(FCLz2)can be used by any language that conforms to the CLS.1 conform:v.遵守2 interoperate:v.互操作z1公共语言规范CLS和通用类型系统一起确保语言的互操作性。CLS是一个最低标准集,所有面向.NET的编译器都必须支持它。z2框架类库FCL由很多相关互联的类库组成,支持Windows应用程序、Web服务和数据访问等开发。,The.NET Framework sits on top of the operating system,which can be any flavor1 of Windows,and consists of a number of components.Currently,the.NET Framework consists of:(1)Four official languages:C#,VB.NET,Managed C+,and JScript.NET.(2)The Common Language Runtime(CLRz1),an object-oriented platform for Windows and web development that all these languages share.(3)A number of related class libraries,collectively known as the Framework Class Library(FCLz2).1 flavor:n.特色z1CLR是公共语言运行时,用于把.NET的语言翻译为机器可以执行的语言,负责资源管理(内存分配和垃圾收集),并保证应用和底层操作系统之间必要的分离。z2FCL是.NET框架类库,不论在C#,J#,VB.NET或其他.NET开发语言中使用的.NET提供的类都是FCL中的类,就是说,.NET的开发其实是和语言无关的。不同语言编写的程序由于使用同一类库(等于被翻译成了同一种中间语言,Common Intermediate Language,CIL),使得各种不同语言写的程序集可以通用。,Figure 1 breaks down the.NET Framework into its system architectural components.,Figure1.NET Framework architecture,The most important component of the.NET Framework is the CLR,which provides the environment in which programs are executed.The CLR includes a virtual machine,analogous1 in many ways to the Java virtual machine.At a high level,the CLR activates objects,performs security checks on them,lays them out in memory,executes them,and garbage-collects them.(The Common Type System is also part of the CLR.)1 analogous:adj.类似的,相似的,In Figure 1,the layer on top of the CLR is a set of framework base classes,followed by an additional layer of data and XML classes,plus another layer of classes intended for Web Services,Web Forms,and Windows Forms.Collectively,these classes are known as the Framework Class Library(FCL),one of the largest class libraries in history and one that provides an object-oriented API to all the functionality that the.NET platform encapsulates1.With more than 5,000 classes,the FCL facilitates rapid development of desktop,client/server,and other web services and applications.1 encapsulates:v.形成胶囊,The set of framework base classes,the lowest level of the FCL,is similar to the set of classes in Java.These classes support rudimentary1 input and output,string manipulation,security management,network communication,thread management,text manipulation,reflection and collections functionality,etc.1 rudimentary:adj.根本的,Above this level is a tier of classes that extend the base classes to support data management and XML manipulation.The data classes support persistent management of data that is maintained on databases.These classes include the Structured Query Language(SQL)classes to let you manipulate persistent data stores through a standard SQL interface.Additionally,a set of classes called ADO.NET allows you to manipulate persistent data.The.NET Framework also supports a number of classes to let you manipulate XML data and perform XML searching and translations.,Extending the framework base classes and the data and XML classes is a tier of classes geared toward building applications using three different technologies:Web Services,Web Forms,and Windows Forms.Web Services include a number of classes that support the development of lightweight distributed components,which will work even in the face of firewalls and NATz1 software.Because Web Services employ standard HTTP and SOAP as underlying communications protocols,these components support plug-and-play across cyberspace.z1即“Network Address Translation”,是一个IETF(Internet Engineering Task Force,Internet工程任务组)的标准,允许一个整体机构以一个公用IP地址出现在Internet上,一种把内部私有网络IP地址翻译成合法网络IP地址的技术。即在局域网内部使用内部地址,而当内部节点要与外部网络进行通讯时就在网关将内部地址替换成公用地址,从而在外部公网上正常使用。NAT可以使多台计算机共享Internet连接,这一功能很好地解决了公共IP地址紧缺的问题。,Web Forms and Windows Forms allow you to apply rapid application development techniques to building web and windows applications.It usually means simply dragging and dropping controls onto your form,double-clicking a control,and writing the code to respond to the associated event.,(3)C#Language,The C#language is disarmingly simple1,with only about 80 keywords and a dozen built-in datatypes,but C#is highly expressive when it comes to implementing modern programming concepts.C#includes all the support for structured,component-based,object-oriented programming that one expects of a modern language built on the shoulders of C+and Java.1 disarmingly simple:使人倍感轻松,The C#language was developed by a small team led by two distinguished Microsoft engineers,Anders Hejlsberg and Scott Wiltamuth.Hejlsberg is also known for creating Turbo Pascal,a popular language for PC programming,and for leading the team that designed Borland Delphi,one of the first successful integrated development environments for client/server programming.,At the heart of any object-oriented language is its support for defining and working with classes.Classes define new types,allowing you to extend the language to better model the problem you are trying to solve.C#contains keywords for declaring new classes and their methods and properties,and for implementing encapsulation,inheritance,and polymorphism1,the three pillars2 of object-oriented programming.、1 encapsulation,inheritance,and polymorphism:封装,继承和多态2 pillars:n.柱子,支柱,In C#everything pertaining to1 a class declaration is found in the declaration itself.C#class definitions do not require separate header files or Interface Definition Language(IDL)files.Moreover,C#supports a new XML style of inline documentation that greatly simplifies the creation of online and print reference documentation for an application.1 pertaining to:与有关,C#also supports interfaces,a means of making a contract with a class for services that the interface stipulates1.In C#,a class can inherit from only a single parent,but a class can implement multiple interfaces.When it implements an interface,a C#class in effect promises2 to provide the functionality the interface specifies.1 stipulate:v.规定,保证2 promise:v.承诺,C#also provides support for structs,a concept whose meaning has changed significantly from C+.In C#,a struct is a restricted,lightweight type that,when instantiated,makes fewer demands on the operating system and on memory than a conventional class does.A struct cant inherit from a class or be inherited from,but a struct can implement an interface.,C#provides component-oriented features,such as properties,events,and declarative constructs(called attributes).Component-oriented programming is supported by the CLRs support for storing metadata with the code for the class.The metadata describes the class,including its methods and properties,as well as its security needs and other attributes,such as whether it can be serialized;the code contains the logic necessary to carry out its functions.,A compiled class is thus a self-contained unit;therefore,a hosting environment that knows how to read a class metadata and code needs no other information to make use of it.Using C#and the CLR,it is possible to add custom metadata to a class by creating custom attributes.Likewise,it is possible to read class metadata using CLR types that support reflection.,An assembly1 is a collection of files that appear to the programmer to be a single dynamic link library(DLL)or executable(EXE).In.NET,an assembly is the basic unit of reuse,versioning,security,and deployment.The CLR provides a number of classes for manipulating assemblies.1 assembly:n.程序集,(4)C#Versus Visual Basic.NET,The premise1 of the.NET Framework is that all languages are created equal.To paraphrase2 George Orwell,however,some languages are more equal than others.C#is an excellent language for.NET development.You will find it is an extremely versatile3,robust and well-designed language.It is also currently the language most often used in articles and tutorials about.NET programming.1 premise:n.前提2 paraphrase:n.解释3 versatile:adj.通用的,It is likely that many VB programmers will choose to learn C#,rather than upgrading their skills to VB.NET.This would not be surprising because the transition from VB6 to VB.NET is,arguably1,nearly as difficult as from VB6 to C#and,whether its fair or not,historically,C-family programmers have had higher earning potential than VB programmers.As a practical matter,VB programmers have never gotten the respect or compensation2 they deserve,and C#offers a wonderful chance to make a potentially lucrative3 transition.1 arguably:adv.可论证地2 compensation:n.补偿3 lucrative:adj.有利的,(5)C#Versus Java,Java programmers may look at C#with a mixture of trepidation,glee,and resentment1.It has been suggested that C#is somehow a rip-off of Java.I wont comment on the religious war between Microsoft and the anyone but Microsoft crowd except to acknowledge that C#certainly learned a great deal from Java.But then Java learned a great deal from C+,which owed its syntax to C,which in turn was built on lessons learned in other languages.We all stand on t