17
Sun, Nov
2 New Articles

Microsoft Computing: Visual Studio .NET 2005 Programming

Microsoft
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Last month's article gave an overview of Visual Studio .NET 2005's new team environment capabilities, SQL Server 2005, and Microsoft's remarkable one-year pricing policy. This month, I cover some of the enhancements that Microsoft has made to the Visual Studio 2005 Interactive Development Environment (IDE). Many of the new capabilities of the Visual Studio IDE make it easier to produce good code and harder to make mistakes.

The Windows Developer Community

With Visual Studio .NET 2005, Microsoft has made a greater effort to establish a sense of "community" among Windows developers. Not only the coders that are part of a project team, but also the single programmers, working alone, are made to feel a part of a group of like-minded developers.

When you start Visual Studio 2005, you are greeted with an opening screen, called the Start Page, that is essentially an embedded HTML browser. This browser is pointed to a news source at the Microsoft Development Network (MSDN), where announcements of features, training, and tools are made. Therefore, each time we developers open the IDE, we all see the same news and announcements.

To further promote the sense of community, Microsoft has a new IDE menu, called Community, dedicated to such collaborative efforts as Ask a Question, Send Feedback (to answer a question), and Check Question Status. Another option, Developer Center, points the embedded browser to the MSDN main Web site.

The Visual Studio Codezone

While not entirely new, perhaps the most valuable Community resource is the Codezone, which is a collection of links to most of the major independent Windows development experts, individual contributors, user groups, community sites, and speakers, including C# Corner, CodeGuru, DevX, Code Project, and SQL Team. Hundreds of articles, code examples, tips, and practical applications are cataloged and available for research. Code examples covering practically every likely need are essentially available online, all the time. There is little need to carry any sort of hardcopy reference anymore.

Finally, VS 2005 gives you a hand in sorting through all this newfound community information with the new Community Search option. Community Search lets you look through the resources of the Codezone for templates, code snippets, code samples, starter kits, and custom controls. For example, a Codezone search for the term "exit()" and limited to the C# language yields about 20 articles on good coding practices, misuse examples, tricks, and workarounds. Further, all of the information resources may be searched at the same time. That means you can examine search results from the Codezone community, local help, MSDN online, and the Question and Answer knowledge base from a single consolidated screen, while making a single search request. You may also apply filters to restrict your search to a subset of VS languages (VB and C#, for example), to a specific technology (like MFC or .NET), or to a specific type of information (articles, code samples, etc.).

Testing Tools for Agile Software Engineers

In recent years, the software engineering methods have taken a turn away from the more established paradigms, like the Waterfall and Spiral methods, toward a more agile approach like Extreme Programming (called "XP" but not to be confused with the Windows operating system) or another similar method called Scrum. Engineering methods like XP and Scrum are less reliant on heavyweight documentation and milestones; they draw instead on "user stories" and very short iterative development cycles. Testing, therefore, is crucial to the success of an agile engineering process. In fact, some agile engineering enterprises construct the test for a given chunk of software before the given chunk is even designed. Into this trend springs Microsoft.

Visual Studio 2005 has many new features to bring testing as a concept into its own. Tests may be established in advance and independently of the components they're going to test. For example, suppose you are creating a Web application and you want to know what will happen when hundreds of requests come in to your server at the same time. You can create a Web test script to perform a set of recorded Web requests and then a load test to encapsulate the script and execute it as hundreds of virtual users, all making requests simultaneously. Results of the test may be captured and analyzed to determine where improvements to the code may be realized.

Unit testing, where the methods of a component are exercised, can be invoked with automatically generated initial code. Multiple unit tests may then be bundled into a battery of tests and invoked together. The results of the testing can be logged and reviewed, and the effectiveness of the software measured.

Refactoring

Source code refactoring is the practice of changing the internal arrangement of a program while leaving the external behavior unaltered. It's something programmers do all the time. For example, when you find that you have the same few lines of code duplicated several times around your program, you might decide to create a subroutine or procedure to contain the common code and then call the routine from those various places. The code becomes cleaner and easier to maintain.

Visual Studio 2005 now has tools to help with many refactoring tasks. For instance, suppose you want to rename a variable that is used in a function. Yes, I know "find and replace" has been available all along, but the VS 2005 refactoring tools are more intelligent than that. Let's say the goal is to rename the variable sWork to sWork1, but this cannot be done properly with "find and Replace" because there are other variables that begin with sWork (sWork2, sWork3, etc.), and these field names will be changed, too. Well, we're in luck because the Visual Studio refactoring tool knows the difference.

In Figure 1, the refactoring dialog for "rename" is shown. In the top panel, all of the references to the variable sWork are displayed. Note that references to sWork2, sWork3, etc. are not included and will not be altered when the changes are applied.


http://www.mcpressonline.com/articles/images/2002/Microsoft-VS2005ProgrammingV4--01250600.jpg

Figure 1: The refactoring dialog for "rename" displays all of the references to the variable sWork.

Other new refactoring tools help you with these tasks:

  • Encapsulate a class variable into a class property
  • Extract some code from one area of a program and turn the code into a method or an interface (something that would have been handy in the above example of creating a subroutine from duplicate code)
  • Promote a local variable to a method parameter
  • Remove parameters
  • Reorder parameters

In most of these cases, Visual Studio will perform some error checking as you go to make sure your refactoring changes will compile and run as expected. For example, when promoting a variable to a method parameter, VS checks to see that the variable gets an initial value before it's referenced. Further, renaming a control, like a button or text box, after a great deal of code has been written that references that code, will invoke a more intelligent search for references to the control and make most of the changes that would be required.

Some Nice Touches

Naturally, with over 400 enhancements to the IDE, different features will appeal to different programmers. These are some of the improvements that I find most helpful:

  • The "Surround with..." feature allows you to select some code and then surround it with any one of several types of expansions (like #region...#endregion, do...while, or if {}). This tool can be very helpful in keeping nested levels in their proper places.
  • New security features, particularly for developing ASP.NET Web applications, allow you to, for example, write a Web application that requires only partial permissions because the new Permissions Calculator scans your code and determines which specific permissions are required.
  • Error conditions within the IDE are easier to detect, even without benefit of a compile.
  • The Intellisense displays of methods and properties are more informative. As object references are displayed, a new tool tip shows the usage for each property, method, or event (Figure 2).


http://www.mcpressonline.com/articles/images/2002/Microsoft-VS2005ProgrammingV4--01250601.jpg

Figure 2: The new Intellisense tool tip displays the usage for each property, method, or event.

  • New options for creating mobile computing applications include the ability to set device environment parameters to see how an application will perform under different device configurations.
  • New visual guides help you align components on a form. In Figure 3, the Exit button is selected and is being positioned. The blue and purple lines appear as the button is aligned with other components or even with the text within another control (as is the case with the OK button shown).


http://www.mcpressonline.com/articles/images/2002/Microsoft-VS2005ProgrammingV4--01250602.jpg

Figure 3: New visual guides help you align components on a form.

Good Work, Microsoft

While most of the attention surrounding the release of Visual Studio 2005 is aimed at the new team development features and the new release of SQL Server, I find that praise for the Microsoft VS IDE development team is in order. They have, in my opinion, produced yet another fine program development system release.

Chris Peters has 26 years of experience in the IBM midrange and PC platforms. Chris is president of Evergreen Interactive Systems, a software development firm and creators of the iSeries Report Downloader. Chris is the author of The i5/OS and Microsoft Office Integration Handbook, The AS/400 TCP/IP Handbook, AS/400 Client/Server Programming with Visual Basic, and Peer Networking on the AS/400 (MC Press). He is also a nationally recognized seminar instructor and a graduate instructor at Eastern Washington University. Chris can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

Chris Peters has 32 years of experience with IBM midrange and PC platforms. Chris is president of Evergreen Interactive Systems, a software development firm and creators of the iSeries Report Downloader. Chris is the author of i5/OS and Microsoft Office Integration Handbook, AS/400 TCP/IP Handbook, AS/400 Client/Server Programming with Visual Basic, and Peer Networking on the AS/400. He is also a nationally recognized seminar instructor and a lecturer in the Computer Science department at Eastern Washington University. Chris can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..


MC Press books written by Chris Peters available now on the MC Press Bookstore.

i5/OS and Microsoft Office Integration Handbook i5/OS and Microsoft Office Integration Handbook
Harness the power of Office while exploiting the i5/iSeries database.
List Price $79.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: