Home > Store

Visual Basic Style Guide, The

Register your product to gain access to bonus material or receive a coupon.

Visual Basic Style Guide, The

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 2000
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-088361-1
  • ISBN-13: 978-0-13-088361-2

The essential companion for Visual Basic development teams and individuals.

  • Master effective practices to create crystal-clear, reusable code
  • Foster effective collaboration by maintaining reliable standards
  • Acquire the mindset of a professional developer
  • Use the comprehensive reference section to make your programs consistent and portable
  • Works with all flavors of Visual Basic
  • Professional best practices for programmers
  • Guidelines for standard structure and syntax
  • Foundational attitudes of quality development
  • Complete reference section for all flavors of Visual Basic

The essential companion for Visual Basic development teams and individuals.

All effective teamwork is based on clear communication. In the field of software development, this means using consistent, documented conventions that can be easily understood and built upon by teammates, now and in the future.

To meet this need, this handbook for Visual Basic programmers contains a comprehensive reference section covering nomenclature, instantiation, keywords, controls, user interfaces-every major VB concept, in all flavors of VB. And more than that, it promotes an attitude, an environment of the mind in which healthy Visual Basic programs are formed.

The winning philosophy of The Visual Basic Style Guide will help your team develop its programming power through discipline, documentation, and professionalism. Build your development skills through:

  • Application of proven and consistent style and user interface methodologies,
  • Grounding in the foundational attitudes of discipline, planning, and ethics, and
  • Getting to know the comprehensive, quick-access reference section.

Even programmers working on individual projects will benefit from the enhanced professionalism that comes from consistency. Whether you're a experienced programmer, a team leader, or a manager, you'll appreciate the thorough coverage and the rigorous standards provided in The Visual Basic Style Guide.

Sample Content

Downloadable Sample Chapter

Click here for a sample chapter for this book: 0130883611.pdf

Table of Contents

I. STRUCTURE.

1. Professional Programming as Style.

Goals of Professional Programming. Meeting the Needs of the User. Meeting the Needs of Your Employer. Meeting the Programmer's Needs. A System for Professional Programming. Structure. Foundation. Standards. Summary.

2. Using Declaration.

What Is Declaration? Why Declare? Clarity. Consistency. Expectations Fulfilled. Increased Recognition. Reduced Memory Usage. Visual Confirmation. How to Use Declaration. Variable Data Declaration. Constant Data Declaration. Other Declarations. Order of Code. Summary.

3. Commenting and Style.

What Are Commenting and Style? What Is Commenting? What Is Style? Why Use Commenting and Style? Why Include Comments? Description of Purpose. Readability. Second Memory. Logic Clarity. Identification. Code Reviews. Future Modifications. Why Use Style? Readability. Grouping of Logic. Guarantee of Program Flow. How to Comment. Who. What. Where. When. Why. How. How Many Comments? How to Employ Style. Indentation. Capitalization of Identifiers and Literal Strings. Use of Blank Lines within Code. Use of Parentheses around Conditions and Expressions. Use of Line Continuation Characters. Use of Multi-Statement Lines. Automatically Generated Source Code. Summary.

4. User Interface Consistency.

What Is User Interface Consistency? Consistency with the User. Consistency within the Application. Consistency with Other Applications. Why Maintain User Interface Consistency? Accomplishment of a Task. Access to Information. Increase in Productivity. Increase in Accuracy. Integration with Existing Workflow. How to Maintain User Interface Consistency. Consistency with the User. Consistency within the Application. Consistency with Other Applications. Summary.

5. Documentation.

What Is Documentation? Why Document? Technical Support. User Support. How to Document. Quality: Always Professional. Style: From General to Specific to General. Content: Types of Internal Documentation. Content: Types of External Documentation. Summary.

II. FOUNDATION.

6. Discipline.

What Is Discipline? Discipline Is Training. Discipline Corrects. Discipline Focuses. Discipline Perfects. Discipline Affects the Mental Faculties. Discipline Affects Moral Character. Why Be Disciplined? Discipline Results in Professional Programs. Discipline Reduces Development Pressures. Discipline Increases Application Satisfaction. Discipline Prepares You for Advanced Programming. Discipline Attracts the Admiration of Your Peers. How to Instill Discipline. Establishing a Routine. Improving Your Methods. Summary.

7. Planning.

What Is Planning? Taking the Problem Apart. Putting the Solution Together. Why Plan? Understanding the User's Needs. Standardization. Goals and Milestones. Anticipating Surprises and Risks. How to Plan. Understand What the User Needs. Determine the Project Scope. Organize the Project. Review the Project. Summary.

8. Ethics.

What Is Ethics? Ethics Is Part of a World-View. Ethics Deals with Right and Wrong Actions. Ethics Deals with Right and Wrong Attitudes. Why Have Ethics? How to Have Ethics. Honesty. Trust. Quality. Ownership. Humility. Summary.

III. STANDARDS.

9. Declaration Standards.

Nomenclature Standards. Nomenclature for Variables. Nomenclature for Constants. Nomenclature for User-Defined Types. Nomenclature for Enumerated Data Types. Nomenclature for Line Labels. Nomenclature for Procedures. Nomenclature for Declares. Nomenclature for User Interface Elements. Nomenclature Exceptions. Instantiation Standards. Instantiation of Variables. Instantiation of Constants. Instantiation of User-Defined Types. Instantiation of Enumerated Data Types. Instantiation of Line Labels. Instantiation of Procedures. Instantiation of Declares. Declaration Modifiers. Global Options. Compiler Directives. Visual Basic Limitations on Declaration. Data Typing of Literals. Summary.

10. Keyword Reference.

Categories. Compiler Directives. Conversion Functions. Date and Time Features. Declaration Features. Error Handling and Debugging Features. File System Features. Financial Features. Flow Control Features. Math Features. Miscellaneous Features. Operators. String Features. Alphabetical Keyword List. Summary.

11. Control and User Interface Standards.

General Considerations. Communication. Control Interaction. Documentation. Specific Control Information. Summary.

12. Database Standards.

Database Design. Nomenclature. Normalization. Database Documentation. Database Usage. Spreadsheet Presentation. Bound Field Presentation. Form Object Presentation. Summary.

Index.

Preface

Preface

I still remember the first computer program I wrote. I composed it while standing in front of a TRS-80 at a Radio Shack store in Missoula, Montana. Then a 12-year-old, I had just seen my first "real" computer a few weeks earlier in my classroom. Our teacher taught us everything that he knew about the computer over one or two days, and I was fascinated. Cautiously I approached the sleek gray terminal with its glowing phosphor screen. With excitement welling up inside of me, I set my mind on the task at hand, reached out for the keyboard, and programmed my first software application.

10 FOR I = 1 TO 1000
20 PRINT I, I + 1
30 NEXT I
40 END

It may seem infantile, especially when you consider what you can do with the same amount of code in some more modern languages. But for a seventh grader with his first chance to write a real program, it was grand. It opened a whole new world for me. I can still recall the feeling I had as I stood there, watching the columns of numbers racing down the screen. That same feeling comes back to me every time I write a working program.

Over the years I have learned to write programs longer than four lines. I took the standard academic and business path through PASCAL, 8086 assembly language, LISP, C, and C++, but today I spend most of my programming career with a variant of the language that my fingers first typed: Microsoft Visual Basic. And why not? Visual Basic allows me to write complex applications for Microsoft Windows in a fraction of the time that it would take me to write the same programs in C or C++, with or without class libraries such as MFC and OWL. Visual Basic makes the creation of Windows applications literally child's play. However, along with the ease of Windows programming has come the ease of writing bad programs.

In the early days of computers, the skill of programming was limited to a few geeks who spent their lives cooped up in a stadium-sized computer room with a brain the size of a four-function calculator (the computer's brain, not the geeks'). These progenitors of modern software engineers spent hours choosing just the right punch cards to calculate pi to 10 decimal places. The most powerful computers of the time were expensive, slow, and short on memory. It was in the programmer's (and his employer's) best interest to write well-crafted, concise, and error-free code the first time. Style was not an issue; if it worked, it was good enough.

Today the computing horizon is quite different. Once there were a few ENIAC-shaped mud huts; now Pentium-class high-rises dot the landscape. The latest machines are orders of magnitude faster than anything imaged by Charles Babbage, and they are priced within the budget of most technology-crazed consumers. The modern business climate requires that the average person understand how to operate a computer. With the advent of (relatively) easy-to-use programming languages such as BASIC, some employers are asking their business experts to translate that business knowledge into working computer applications.

Consider the case of Joe, an accountant for a small manufacturing company. Joe has worked for years literally "keeping the books." One day, Joe's supervisor, knowing that Joe is the resident expert on accounting practices, presents him with an IBM PC and a copy of dBase II. Daunted at first, Joe digs in to the database, and after months of feverish activity, shows off his new accounting package.

No one is more surprised than Joe to find that the program actually does accounting. Still, he knows that it is not quite right, and it is always a few dollars and cents off at the end of the month. Over the next few years Joe works hard at fixing and improving the program, as well as writing numerous reports demanded by various departments. Finally the day comes for Joe to retire, and Sue, his assistant, is given the keys to the dBase program. Along with those keys Sue receives a "good luck" from Joe, but scant information about how the program works.

You already know the rest of the story. The program is in a hideous state of disrepair, but since Sue is as much a novice as Joe was, she is at a loss as to how to fix the application. If this story was unique we would simply sigh and say, "Oh poor Sue." But this situation happens on a daily basis across the computer world. Instead of pity for Sue, we often have to console ourselves.

Obscure programming practices are not limited to untrained business users. Programming students are often tempted with languages that invite them to write strange source code. One of the first languages I used in school was a flavor of BASIC found on the PDP 11/70 hosted operating system RSTS/E. This version of BASIC did not require whitespace to be placed between most language constructs. Therefore, it was possible to write the same four-line program shown earlier using a single, compressed statement.

FORI=1TO1000\PRINTI,I+1\NEXTI\END

It even allowed this reversed syntax.

PRINTI,I+1FORI=1TO1000

Imagine entire applications written in this compressed format! Because the interpreter focused on the extraction of known keywords from any statement, it allowed the programmer to write very unsightly code that did not run any faster than the equivalent code with whitespace included. Consider the following program.

10A$(I)=" "FORI=1TO9\B$="-+-+-"\C$="|"\X=1\R$=""\T=0
20GOSUB500
25IFX=1THENPRINT"YOUR TURN:";ELSEPRINT"TRY AGAIN:";
30INPUTQ$\P=INT(Q$)\X=2\IFA$(P)<>" "THENGOTO20
40X=1\A$(P)="X"\T=T+1
50GOSUB1000\IFR$="X"THENPRINT"YOU WIN!"\GOTO10
60IFT=9THENPRINT"DRAW"\GOTO10
70M=INT(RND(9))\IFA$(M)<>" "THENGOTO70\A$(M)="O"
80GOSUB1000\IFR$="O"THENGOSUB500\PRINT"I WIN!"\GOTO10
90GOTO20
500PRINT"BOARD LEGEND"\FORC1=1TO3
510PRINTA$(((C1-1)*3)+1);C$;A$(((C1-1)*3)+2);
515PRINTC$;A$(((C1-1)*3)+3);
520PRINT" ";((C1-1)*3)+1;C$;
525PRINT((C1-1)*3)+2;C$;((C1-1)*3)+1
530IFC1<3THENPRINTB$
540NEXTC1\RETURN
1000RESTORE\R$=""\FORC1=1TO8\READT1\READT2\READT3
1010Q$=A$(T1)+A$(T2)+A$(T3)
1015IFQ$="XXX"THENR$="X"\IFQ$="OOO"THENR$="O"
1020NEXTC1\RETURN
1030DATA1,2,3,4,5,6,7,8,9,1,4,7,2,5,8,3,6,9,1,5,9,3,5,7

I am sure that you will soon figure out the purpose of this application. (See the answer at the end of this Preface just to be sure.) Can you picture an entire business application written in this style? Can you picture yourself being asked to fix such an application?

Visual Basic is a little more strict in the area of statement formatting, but it is still possible to write programs that are both internally (code) and externally (user interface) displeasing. When I was taking programming classes in school, I thought it was clever to write obfuscated code in this manner. This feeling ended when, in my first programming job, I was asked to fix someone else's muddled application. From that point on I was committed to writing clear, concise, and readable code that was pleasing for both the programmer and for the user. This book is a guide to help you travel this same path. In this text you will find a clear differentiation between unprofessional programs—those that are aesthetically and logically annoying to both the user and other programmers that may review the code—and professional programs.

Who Is This Book For?

This book is for everyone who cares about Visual Basic applications, and the development process surrounding these applications. Microsoft Visual Basic is very popular, outselling Microsoft's own C/C++ compiler by a factor of five to one. Many of these units are sold to weekend programmers with little or no training in programming practices. You can walk in to any major bookseller and see shelf after shelf of books with names like Learn Visual Basic in Your Sleep and Visual Basic in 21 Minutes. These books are great for learning the usage and syntax of Visual Basic, but they often fall short when it comes to training the eager developer how to program well. The Visual Basic Style Guide is written for the Visual Basic programmer who wishes to enhance his or her professional and technical programming methods and style. If you are such a programmer, read on!

Writing professional Visual Basic programs does take effort, lots of effort. Still, effort alone will not bring about the quality that you seek. This book contains lists of guidelines for writing good Visual Basic programs. Yet more than that, it promotes an attitude, an environment of the mind in which healthy Visual Basic programs are formed.

The Visual Basic language now reaches out into other areas of software development. With the advent of Visual Basic for Applications and Visual Basic, Scripting Edition, more and more programmers are relying on Visual Basic for their many software solutions. The Visual Basic Style Guide is designed for use with each of the flavors of Visual Basic.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020