按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!
o You will want to use an IDE to manage your development cycle of coding; debugging;
and application execution。
o Among other things; IDEs manage the organization of your source code using projects
and solutions。
o In an IDE; keyboard shortcuts make it easier for you to perform operations that you will
do repeatedly。 For example; in Visual Basic Express; use Ctrl+S to save your work and
Ctrl+F5 to run your application without debugging。
o Visual Basic Express projects contain plain…vanilla files and specialized groupings。 When
dealing with specialized groupings; make sure that you understand how the groupings
function and modify only those files that you are meant to modify。
Some Things for You to Do
The following are some questions related to what you’ve learned in this chapter。 Answering
them will help you to get started developing your projects in the IDE。
■Note The answers/solutions to the questions/exercises included at the end of each chapter are available with
this book’s downloadable code; found in the Source Code/Download section of the Apress web site (http://
apress。)。 Additionally; you can send me an e…mail message at christianhgross@gmail。。
1。 In an IDE; solutions and projects are used to classify related pieces of functionality。 The
analogy I used talked about cars and car pieces。 Would you ever create a solution that
contained unrelated pieces of functionality? For example; would you create an airplane
solution that contained car pieces?
2。 Projects are based on templates created by Microsoft。 Can you think of a situation where
you would create your own template and add it to Visual Basic Express?
3。 In the Solution Explorer; each item in the tree control represents a single item (such as
a file; user interface control; and so on)。 If you were to double…click a 。vb file; you would
be manipulating a Visual Basic file that would contain Visual Basic code。 Should a single
Visual Basic file reference a single Visual Basic class or namespace? And if not; how
would you organize your Visual Basic code with respect to Visual Basic files?
4。 You have learned about how a application can generate an executable file。 Let’s
say that you take the generated application and execute it on another Windows
puter。 Will the generated application run? Let’s say that you take the executable file to a
Macintosh OS X or Linux puter; will the application run? Why will it run or not run?
…………………………………………………………Page 45……………………………………………………………
C H AP TE R 1 ■ R E AD Y ; ST E AD Y ; G O! 23
5。 You are not happy with the naming of the element TextBox1; and want to rename it to
TxtOutput。 How do you go about renaming TextBox1?
6。 ClassLibrary has embedded logic that assumes the caller of the method is a console
application。 Is it good to assume a specific application type or logic of the caller in a
library? If yes; why? If no; why not?
…………………………………………………………Page 46……………………………………………………………
…………………………………………………………Page 47……………………………………………………………
C H A P T E R 2
■ ■ ■
Learning About Number
and Value Types
In the previous chapter; you learned how to use Visual Basic Express; and what is in terms of
the CIL and CLR。 In this chapter; we are going to roll up our sleeves and begin writing real
Visual Basic code—specifically; a calculator。
A calculator is an ideal example to start with; because it allows you to focus on the applica
tion without having to deal with all the nasty details that are normally associated with programs。
In a programming language like Visual Basic; adding two numbers is trivial。 What is not trivial
is how to put the operation of adding two numbers into a program。
This chapter focuses on the mechanics of writing a program in Visual Basic—taking an
idea and converting it into a Visual Basic program that can execute your intentions。 You’ll learn
how to organize your development and implement a Visual Basic class library; as well as how
the CLR manages number types。
Focusing and Organizing Your Development
When you develop software; you will split your work into two main tasks: organizing and imple
menting。 Organizing your development involves figuring out what features and libraries you
are going to define; how many people are going to be developing the features; and so on。
Organizing your development is one of the most important tasks when writing code; and
it is also typically the most confusing for new developers。 Professional developers seem to
organize their work instinctively; but it only appears that way because they have done it so
many times that the process has bee automatic。
When developers are tasked with creating a program; they are asked to write software that
implements a set of features。 Features could include calculating daily interest payments; auto
matically generating letters indicating the acceptance or rejection of a loan; and so on。 A feature
always relates to performing some task that is determined by some process。 You could say that
feature implementation is the direct implementation of a task。
25
…………………………………………………………Page 48……………………………………………………………