Book contents
- Frontmatter
- Contents
- Preface
- 1 Fundamentals of Design and Programming – Starting from Scratch
- 2 Variables and Constants – A Place for Everything and Everything in Its Place
- 3 Writing Programs – First You Walk, Then You Run
- 4 Writing Programs II – More Controls and New Logic
- 5 Using If and Case – Decisions, Decisions, Decisions
- 6 Loops – Once Is Not Enough
- 7 Procedures and Functions – Divide and Conquer
- 8 Writing Programs III – Tying It All Together, So Far
- 9 File I/O – Files and Records and Fields, Oh My!
- 10 Arrays and Structures – Organizing Data
- 11 Events and More Controls – Tips and Tricks for Programming
- 12 Objects and Classes – Objects Are in a Class By Themselves
- 13 Graphics – The Visual (and Audio) Side of Visual Basic
- 14 LINQ to SQL – The World Runs on Databases
- 15 Crystal Reports – Tying Databases to Output
- Appendices
- Index
7 - Procedures and Functions – Divide and Conquer
Published online by Cambridge University Press: 05 June 2012
- Frontmatter
- Contents
- Preface
- 1 Fundamentals of Design and Programming – Starting from Scratch
- 2 Variables and Constants – A Place for Everything and Everything in Its Place
- 3 Writing Programs – First You Walk, Then You Run
- 4 Writing Programs II – More Controls and New Logic
- 5 Using If and Case – Decisions, Decisions, Decisions
- 6 Loops – Once Is Not Enough
- 7 Procedures and Functions – Divide and Conquer
- 8 Writing Programs III – Tying It All Together, So Far
- 9 File I/O – Files and Records and Fields, Oh My!
- 10 Arrays and Structures – Organizing Data
- 11 Events and More Controls – Tips and Tricks for Programming
- 12 Objects and Classes – Objects Are in a Class By Themselves
- 13 Graphics – The Visual (and Audio) Side of Visual Basic
- 14 LINQ to SQL – The World Runs on Databases
- 15 Crystal Reports – Tying Databases to Output
- Appendices
- Index
Summary
VB Quip
Specialists learn more and more about less and less until they know everything about nothing. Generalists learn less and less about more and more until they know nothing about everything.
– AnonymousWe live in a world of specialization. Want a cup of coffee? There's a store that specializes in coffee, any way you like it. Need a doughnut to go with it? There's a company that makes and sells the best doughnuts. Need something to read while you're enjoying a bite? Pick from thousands of magazines or millions of books on any and all topics imaginable. Gone are the days of the local handyman – the resident “Mr. Fixit” – who could fix anything and get anything to work. Today's world has specialists. A mechanic specializes in car repair. The cable guy handles your TV problems. When the office copier is on the fritz, call the copier guy. Everyone's an expert.
Programming is the same way. Blocks of code are written for a particular purpose. Some do simple tasks, but do them often. It's easier to write a procedure once for a task and then call it multiple times as needed. Other blocks of code might do a complicated calculation or solve a particular problem. These provide a specific function. It's easier to write and store these functions and then use them when needed than it is to create them from scratch. That's the basis for procedures and functions.
- Type
- Chapter
- Information
- Programming in Visual Basic 2010The Very Beginner's Guide, pp. 224 - 257Publisher: Cambridge University PressPrint publication year: 2010