按键盘上方向键 ← 或 → 可快速上下翻页,按键盘上的 Enter 键可回到本书目录页,按键盘上方向键 ↑ 可回到本页顶部!
————未阅读完?加入书签已便下次继续阅读!
…………………………………………………………Page 48……………………………………………………………
26 CH AP T E R 2 ■ L E A R N IN G AB OU T 。 N E T N U M B E R A N D V A L U E T Y P E S
When defining the features; two major steps are involved:
o Gain an understanding of the features。 You can’t implement something that you don’t
understand。 To be able to write the source code for a feature; you need to know the whys
and whats of a feature。
o Describe the features using structured design methods。 Simply organizing your thoughts
may be enough if you are the only person working on a program; however; more often than
not; you will be part of a team。 You need to use a structured design method so that you and
your team members can municate the thoughts related to program development。
One mon structured design method is the Unified Modeling Language (UML)。 UML is
used to organize the features into units that correspond to programming language constructs;
such as classes。 Think of UML as software developer…specific lingo used to describe the various
aspects of a programming environment at a higher level of abstraction。 UML allows you to get
an overall understanding of the architecture without having to read the source code。 Think of
UML as the structured doodle on the napkin of software programming。
Along with UML; there are other ways of structuring your development process。 For example;
another technique is called agile software development。 The idea with agile software develop
ment is to use a whiteboard and develop your own structured munication mechanism。
The choice of UML; agile software development; or another structured design method is
up to you and your team members。 But you will need to organize your thoughts and have a
structured munication technique。 If you don’t; your software will be late; buggy; too
expensive; or inplete。 It is not an understatement to say that organization is half the battle。
In this chapter; I am going to give you a taste of a simplified structured development tech
nique; so that you at least have an idea of how structured development works。
Organizing the Calculator
To begin this chapter’s example; get a piece of paper and a pen or pencil; or you can use a tablet
PC for writing; if you have one。 Next; in the center of the paper (or virtual paper); draw a circle
and in it write the word Calculator。 Now stop and think about what a calculator means with
respect to the software that you will be writing。 Write those ideas on the paper surrounding the
circle。 My thoughts are shown in Figure 2…1。
Your thoughts and my thoughts may or may not be the same; but what our results will have
in mon is a hodgepodge of ideas everywhere。 Figure 2…1 illustrates that one of the biggest
problems software developers face is lack of focus and organization。 It is not that developers
can’t focus or organize; but that developers are bombarded by information; and it is a Herculean
task to keep track of; let alone organize; all of that information。 But software projects that are
successful must remain focused and organized。 Therefore; the next step is to focus and organize
your thoughts; which results in something like Figure 2…2。
In Figure 2…2; the ideas are organized by classification。 As this is book is about a program
ming language; the only relevant ideas are those related to source code functionality。 Roughly
speaking; in the source code category; each thought corresponds to a feature to implement。
…………………………………………………………Page 49……………………………………………………………
CH A PT E R 2 ■ L E A R N I N G A B OU T 。 N E T N U M B E R AN D V A L U E T Y P E S 27
Figure 2…1。 Brainstorming what the calculator application represents
Figure 2…2。 Focused and organized brainstorming
Focusing the Calculator
To implement a feature; you need source code; which means a file; project; and other program
ming techniques。 The following two levels of organization are defined in Visual Basic:
o File level: At the file level; you are organizing what kinds of projects and solutions you
will be creating。
o Source code level: At the source code level; you are organizing the namespaces; modules;
class names; and other identifiers that are referenced throughout the source code。
…………………………………………………………Page 50……………………………………………………………
28 CH AP T E R 2 ■ L E A R N IN G AB OU T 。 N E T N U M B E R A N D V A L U E T Y P E S
For the most part; Visual Basic developers do not concern themselves too much with the
file organization。 A mon practice is to consider a class or module as a single file。
When implementing an application; you will begin by deciding whether you will use a
console application; a Windows application; or a class library。
If the calculator were a Windows application; it could look like Figure 2…3。 A calculator
implemented as a Windows application allows users to perform calculations by clicking the
appropriate buttons。 For example; to add two numbers; the user clicks the appropriate buttons
to key in the first number; then an operation; then the second number; and finally; the equal
sign to perform the calculation。 The equal sign is a signal to the calculator application to process
the data that has b