1. Trang chủ
  2. » Công Nghệ Thông Tin

Lập trình .net 4.0 và visual studio 2010 part 1 docx

7 364 1

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 7
Dung lượng 187,05 KB

Nội dung

CHAPTER 1    1 Introduction These are exciting times to be a .NET developer, and Visual Studio 2010 (VS2010) and the .NET 4.0 framework have brought a bewildering number of changes. But fear not! In this book I will be getting you up to speed on these enhancements, and also taking a brief look at some of the important out-of-band releases, such as ASP.NET MVC, Silverlight, and WCF Data Services. There is some cool stuff in this release, and most of it is not that tricky (with the exception of variance and parallelization) to get to grips with. Versions Visual Studio 2010 is available in five main versions: • Express • Professional ($799) • Professional with MSDN ($1199 new or $799 renewal) • Premium with MSDN ($5,469 new or $2,299 renewal) • Ultimate with MSDN ($11,924 new or $3,841 renewal) Note that these editions also come with free Azure time (Chapter 16). It is likely that the Professional edition will fulfill most developers' needs, but to see what you are missing, I have summarized some of the additional functionality found in the Premium and Ultimate editions in Table 1-1. For a full comparison of features please consult: www.microsoft.com/visualstudio/ en-us/products/2010/default.mspx. Table 1-1. Simplified Comparison of Advanced Version Features It em Pr e miu m Ul ti m a te Code coverage X X Coded UI test X X Web performance testing and load testing X DB deployment, change management, unit testing, and test data generation X X (Continued) CHAPTER 1  INTRODUCTION 2 Table 1-1. Continued It em Pr e miu m Ul ti m a te Static code analysis X X Code metrics X X Profiling X X Intellitrace (historical debugger) X Test management X What Is .NET 4.0 and VS2010 All About? VS2010 and .NET 4.0 lay the foundations for the next epoch of .NET development and correct a number of omissions. I consider that we can divide the changes under four main headings: • Efficiency • Maturation of existing technologies • Extensibility • Influence of current trends Let’s take a whirlwind tour of these now. Efficiency One of the first things you will notice in VS2010 is the shiny new WPF-based IDE. The IDE contains some great features available previously only in add-on products such R# and Refactor (note there is already a VS2010 version of R#, yay!) IDE highlights include box selection, snippets, class stub creation, call hierarchy, and quick search; we will look at these features in Chapter 2. There are also some great language enhancements that can make code cleaner, such as optional and named parameters, dynamic functionality, and changes to variance that will be covered in Chapter 3. Some of these changes will also assist developers working with COM, who frankly need all the help they can get, poor guys and gals (a moment of respect, please). Maturation of Existing Technologies Many .NET-based technologies, such as ASP.NET, have been around for some time now and haven’t changed hugely in this release. Microsoft has, however, fixed a number of long-term omissions in ASP.NET and introduced some useful tweaks, which I will cover in Chapter 10. Toward the end of 2008, Microsoft announced that future versions of Visual Studio would include the popular JavaScript library, jQuery. Although not strictly a .NET change, jQuery is a very useful framework that you will defiantly want to make use of in your web applications. I cover it in Chapter 12. In Chapter 11 we’ll look at the enhancements to Microsoft’s own Ajax libraries, which make it very easy to bind to data with client script. CHAPTER 1  INTRODUCTION 3 Windows Workflow Foundation (WF) and Windows Communication Foundation (WCF) are much more closely integrated in this release. WF undergoes a radical overhaul with a much-improved designer, introduction of new activities, and easier customization (Chapter 6). WCF becomes simpler to use and also introduces new service discovery functionality that I will examine in Chapter 7. WPF has some great additions, with an improved designer, multi-touch, and Windows 7 task bar support that I will look into in Chapter 15. I will also be taking a quick look at Silverlight 3 in Chapter 15. Even through Silverlight is not a .NET 4.0 technology, I believe it is an important release. If you have never used Silverlight before, then take a look at Chapter 14, which contains a brief introduction to Silverlight. Entity Framework received much criticism when it was first released, and the team has attempted to address these criticisms in .NET 4.0. Find out if they have in Chapter 8. Extensibility VS2010 is your flexible and extensible friend. You may have already heard that much of the IDE is now written using WPF and can be customized with the Managed Extensibility Framework (MEF). I will look at IDE customization and MEF in Chapter 2. Influence of Current Trends Software is not developed in a vacuum, and certain trends have undoubtedly influenced VS2010 and Microsoft’s product line. Multicore Shift Due to various physical limitations, CPU manufacturers are now concentrating on releasing multicore processors. Writing programs to run in parallel is difficult, but fear not: VS2010 and .NET 4.0 have fantastic new parallelization constructs and debugging facilities, both of which will be covered in Chapter 5. Unit Testing and Test-Driven Development Unit testing and test-driven development are becoming increasingly popular in software development. VS2010 contains a number of IDE enhancements to assist with these strategies. I cover these in Chapter 2. Other related changes that may be of interest are the new dynamic features and the DLR (Chapter 3) and ASP.NET MVC (Chapter 13). OK, ASP.NET MVC isn’t .NET 4.0, but again it is an important interim release. Cloud Computing Cloud computing must win the buzzword of the year award for 2009. It is becoming an increasingly popular way to reduce costs and simplify management of infrastructure. Windows Azure is Microsoft’s entry to this area, and I take a look at its capabilities and potential uses in Chapter 16. Note that if you purchased Visual Studio with MSDN, you even receive free Azure time. CHAPTER 1  INTRODUCTION 4 What Do Others Think About .NET 4.0? Throughout this book I have tried to include interviews with developers and companies that are lucky enough to be developing with some of these new technologies to gain their insight into potential issues and opportunities. I asked a number of experts what they were excited about in VS2010 and .NET 4.0. Mike Ormond (Microsoft Evangelist) http://blogs.msdn.com/mikeormond/ What am I excited about? There’s a truckload of productivity enhancements in VS2010, like snippets for Visual Web Developer. At last, snippets for ASP.NET, HTML, and JavaScript! Reference highlighting and generating types from usage are two other productivity enhancements I’m looking forward to, as well as the Intellisense enhancements (I no longer need to remember the exact member name and the improved JavaScript support is awesome). I dabble in Office development from time to time and have a tendency toward C#, so I’m really pleased to see the language embrace the likes of optional and named parameters as well as the new dynamic type, which will make COM interop that much easier. Office development in C# is going to be a dream from now on! From a web perspective, I love the new features in Web Forms. Many of them are small, but they are crucially important enhancements to the platform, as well as the new kid on the block: ASP.NET MVC. Choice is always good, and ASP.NET now offers two great choices. Add into the mix the Microsoft Ajax enhancements such as client-side templates/databinding and jQuery integration, and you have a killer web application platform. And of course there’s the Web Deployment Tool and web.config transforms that allow you to automatically ready and package your applications for deployment.” Eric Nelson (Microsoft Evangelist) http://blogs.msdn.com/ericnel/ For me .NET 4.0 represents a turning point in how we will develop database applications in the future. With .NET 4.0 we get a great Object Relational Mapping (ORM) technology in the ADO.NET Entity Framework 4.0, which will significantly simplify the effort involved to work with RDBMS from .NET applications. I have been really impressed with how the product team listened to feedback from the community on the initial release of the Entity Framework and went on to deliver significant new functionality in version 4. Craig Murphy (MVP and developer community organizer) http://www.craigmurphy.com/blog/ Every so often the computing sector goes through a paradigm shift. Programmers have gone through many such shifts, many of which are the result of a change in design techniques or in some cases changes in the way we think. The leap from procedural programming to object-oriented programming is an example of a paradigm shift. More recently, with functional programming becoming part of the mainstream Visual Studio product, programmers are offered another shift. Advances in hardware has meant that even entry-level laptops are now being supplied with dual and multicore processors. This leap in hardware technology has positive implications for programmers. It also means another shift in the way programmers think about their applications; more so, it affects CHAPTER 1  INTRODUCTION 5 application design. Working with a single CPU in a multi-threaded fashion is no longer the challenge: working with a single CPU with 2 or more cores, each capable of performing a unit of work, is the new challenge. Writing applications that are capable of targeting the specific cores on a CPU presents programmers with the challenges associated with deadlocks, race conditions, scalability, lockout, and determinism. On the upside, applications that share their workload over manycore become more responsive and are more efficient. The Parallel Extensions and understanding manycore are other paradigm shifts for programmers. However, it’s a shift that doesn’t just affect programmers: the deep-reaching positive effects extend into application performance and user experience. A well-designed application that takes advantage of manycore may even result in your end user’s computer feeling more responsive: it’s a win-win situation. Visual Studio and .NET 4.0 offer programmers a solid framework for building .NET applications that target manycore. As far back as late 2007, Microsoft has been providing programmers with their Parallel Extensions, offering support for Parallel LINQ (PLINQ) and task parallelism via the Task Parallel Library. Programmers need to understand .NET 4.0; this book will give them an excellent understanding of how to use VS2010 to take advantage of the .NET 4.0 feature set, including the Parallel Extensions. Phil Whinstanley (ASP.NET MVP and author) weblogs.asp.net/Plip/ ASP.NET 4.0 has the benefit of hindsight. With the integration of both the Web Forms and MVC rendering engines, developers are free to express themselves as they choose while still benefiting from the underlying ASP.NET Platform. To support developers in the building of rich powerful ASP.NET applications, VS2010 has streamlined its approach and is focusing on those areas that matter to developers. Speed, efficiency and ease of use. Dave Sussman (MVP and author) www.ipona.com One of the things I love most about .NET and Visual Studio is the teams themselves and their openness to the community. Sure, they keep certain things hidden and have private betas, but much of what they do is public and open to comment, which makes the product improve in ways that we, the developers, need it to. Much of the talk is about MVC, a great platform that has brought in new users, but I’m excited by the changes to Web Forms, MVC’s mature elder brother. Web Forms are still supported and still being actively developed, and although the changes aren’t as radical as MVC, they are far reaching. Many ASP.NET controls in .NET 4.0 now emit clean HTML (the Menu being a great example), and along with the control of client IDs, we have a far better platform for building Ajax based sites. Couple that with features such as the client templates and support for jQuery, and the platform is re-energized; I'm loving the thought of building Web Form sites without having to jump though so many hoops to produce standards compliant HTML that can be easily styled with CSS. In Visual Studio itself the most exciting new feature is the potential that WPF brings. Using WPF for the code surface not only allows a UI refresh to make it look better, but opens up wonderful possibilities for tools to enhance the code editing experience. I think what we have now is just the tip of the iceberg in terms of what’s possible for editing support. CHAPTER 1  INTRODUCTION 6 Matt Lacey (Devevening.co.uk organizer) blog.mrlacey.co.uk www.devevening.co.uk I meet lots of developers, and most of them don’t have lots of time to learn new things or even an inclination to do so. For that reason I’m always excited to see features that need minimal training or explanation. Named and optional parameters are two such features. They’re easy to explain and understand. Plus, they can allow for a dramatic reduction in the amount of code needed for some tasks. Needing less code to perform a task should lead to fewer bugs and more time to test and implement new features. Everyone wins! The other feature I’m really excited to see is ASP.NET MVC. It’s important for two reasons. Firstly, it’s raising questions about the importance of having testable code. In turn this will lead to more developers using testing tools and techniques to improve their code. Secondly, it’s causing developers to ask why it’s needed and what’s wrong with ASP.NET Web Forms. One key difference with ASP.NET MVC is that it’s much harder to develop without having an understanding of HTTP. Whether using MVC or WebForms, having more web developers with a better understanding of HTTP can only be a good thing. Alex Mackey (Author of this book and MVP) simpleisbest.co.uk For me the best changes in this release are the simple ones that will be utilized every day. I’m talking about changes such as the new String.IsNullOrWhiteSpace() or Enum.TryParse(). As a web developer myself, the ASP.NET changes fix some long-term annoyances, and the integration of jQuery is a smart move. I don’t have to do much multithreaded work, but I really like the new Task model and find it much more intuitive to work with. Changes that make your applications run quicker without you having to do anything are always welcome, so am glad of the GC and threadpool enhancements in this release. I also really like the direction the security model is moving in, as I found the previous system overly complex. Perhaps one of the biggest surprises for me was how good Entity Framework now is, but I’m going to stop here as I have the rest of the book to tell you about all the great new features. Future Trends A big risk for software developers is learning and backing technologies that will quickly become obsolete. Of course, no one can know for certain what the future holds (no matter how much they claim to), but I think it can be useful to look at current recruitment trends when deciding on which areas to concentrate. I spoke to Jonathan Keen, head of search practice at a UK recruitment agency, Cognitive Group (cognitive-group.co.uk), about trends he was seeing in .net development. Keen shared the following: • Generally, companies are cutting back on new projects, so we are seeing less development roles. • The most popular and highest paid skills in London at the time of writing (October 2009) are Sharepoint, Dynamics AX, and Dynamics CRM. • There are many roles focusing on integration with existing applications such as Sharepoint and Dynamics suite. • More competition for job roles places increasing importance on distinguishing yourself. Prove your passion for development. Get out there to conferences, user groups, and blogs. (And buy Apress books about new releases of .NET! – author) CHAPTER 1  INTRODUCTION 7 • C#, ASP.NET, SQL Server remain core skills companies seek. • There is some interest in “Agile” skills and SCRUM but less in TDD. • Increasingly, WCF and WPF skills are expected on a developer's resume. • Many public sector projects are still using .NET 1.1. • There is an emphasis on web over desktop programming. • Silverlight and MVC are not yet in demand (note many developers I spoke to disagreed and felt Silverlight is the current hot area – author). • MVC has been used as hook to attract developers. • Technologies such as BizTalk have decreased drastically in popularity. My Own Subjective Opinion WPF certainly seems to be a growth area. The highest .NET contract rates appear to be for Silverlight currently. My own subjective experience of the job market has shown ASP.NET remains popular, and jQuery is becoming a must-have skill. It will be interesting to see if ASP.NET MVC becomes mainstream, although I suspect many companies have too much investment in ASP.NET now, and that ASP.NET MVC will be too big a change in thinking for many developers. The new parallelization functionality is interesting, but I suspect will not be utilized or needed in the majority of line of business applications. Developers skilled in threading and parallelization should always be able to command high salaries, so it will defiantly be worth looking into. Summary Enough of a high level overview, let’s get started with the new IDE functionality–bring on Chapter 2! static void Main(string[] args) { dynamic alexBook; alexBook.Run(); } . CHAPTER 1    1 Introduction These are exciting times to be a .NET developer, and Visual Studio 2 01 0 (VS 2 01 0) and the .NET 4. 0 framework have brought a bewildering. (historical debugger) X Test management X What Is .NET 4. 0 and VS 2 01 0 All About? VS 2 01 0 and .NET 4. 0 lay the foundations for the next epoch of .NET development and correct a number of omissions about in VS 2 01 0 and .NET 4. 0. Mike Ormond (Microsoft Evangelist) http://blogs.msdn.com/mikeormond/ What am I excited about? There’s a truckload of productivity enhancements in VS 2 01 0, like snippets

Ngày đăng: 01/07/2014, 21:20

TỪ KHÓA LIÊN QUAN