Beginning Programming for Dummies

433 Pages · 7.68 mb ·

Programming

Table of contents

- Beginning Programming FOR Dummies 3RD EDITION (Page 1)
- Cover (Page 1)
- About the Author (Page 4)
- Dedication (Page 5)
- Author’s Acknowledgments (Page 6)
- Contents at a Glance (Page 8)
- Table of Contents (Page 10)
- Introduction (Page 20)
- Who Should Buy This Book (Page 21)
- How This Book Is Organized (Page 21)
- Introduction (Page 20)
- Who Should Buy This Book (Page 21)
- How This Book Is Organized (Page 21)
- Part I: Programming a Computer (Page 21)
- Part II: Learning Programming with Liberty BASIC (Page 22)
- Part III: Advanced Programming with Liberty BASIC (Page 22)
- Part V: Algorithms: Telling the Computer What to Do (Page 22)
- Part V: Algorithms: Telling the Computer What to Do (Page 23)
- Part VI: Internet Programming (Page 23)
- Part VII: The Part of Tens (Page 23)
- How to Use This Book (Page 24)
- Foolish assumptions (Page 24)
- Icons used in this book (Page 24)
- Part I Programming a Computer (Page 26)
- Chapter 1: Learning Computer Programming for the First Time (Page 28)
- Why Learn Computer Programming? (Page 28)
- How Does a Computer Program Work? (Page 32)
- Programming is problem- solving (Page 33)
- Programming isn't difficult; it's just time-consuming (Page 34)
- What Do I Need to Know to Program a Computer? (Page 35)
- Chapter 2: All about Programming Languages (Page 38)
- Why So Many Different Programming Languages? (Page 38)
- The joy of assembly language (Page 39)
- C: The portable assembler (Page 41)
- High-level programming languages (Page 43)
- Rapid Application Development ( RAD) programming languages (Page 46)
- Database programming languages (Page 48)
- Scripting programming languages (Page 49)
- Web- page programming languages (Page 51)
- So What's the Best Programming Language to Learn? (Page 53)
- Chapter 3: How to Write a Program (Page 56)
- Before You Write Your Program (Page 57)
- The program’s users (Page 57)
- The target computer (Page 57)
- Your own programming skill (Page 59)
- The Technical Details of Writing a Program (Page 59)
- Prototyping (Page 60)
- Choosing a programming language (Page 61)
- Defining how the program should work (Page 62)
- The Life Cycle of a Typical Program (Page 63)
- The development cycle (Page 63)
- The maintenance cycle (Page 64)
- The upgrade cycle (Page 65)
- Chapter 4: The Tools of a Computer Programmer (Page 66)
- Writing Programs in an Editor (Page 67)
- Using a Compiler or an Interpreter (Page 69)
- Compilers (Page 69)
- Interpreters (Page 70)
- P-code: A combination compiler and interpreter (Page 70)
- So what do I use? (Page 72)
- Squashing Bugs with a Debugger (Page 72)
- Writing a Help File (Page 74)
- Creating an Installation Program (Page 75)
- Part II: Learning Programming with Liberty BASIC (Page 78)
- Chapter 5: Getting Your Hands on a Real Language:Liberty BASIC (Page 80)
- Why Learn Liberty BASIC? (Page 81)
- Liberty BASIC is ( almost) free (Page 81)
- Liberty BASIC is easy (Page 81)
- Liberty BASIC runs on Windows (Page 81)
- You can start using Liberty BASIC today (Page 82)
- Installing Liberty BASIC (Page 82)
- Loading Liberty BASIC (Page 83)
- Your First Liberty BASIC Program (Page 83)
- Running a Liberty BASIC program (Page 84)
- Loading or starting a Liberty BASIC program (Page 86)
- Saving a Liberty BASIC program (Page 85)
- Using Keystroke Commands in Liberty BASIC (Page 87)
- Getting Help Using Liberty BASIC (Page 88)
- Exiting Liberty BASIC (Page 89)
- Chapter 6: Handling Input and Output (Page 90)
- Inputting and Outputting Data: The Old- Fashioned Way (Page 90)
- Inputting and Outputting Data:The Modern Way (Page 93)
- Getting input (Page 93)
- Displaying output (Page 94)
- Sending Data to the Printer (Page 95)
- Chapter 7: Variables, Constants,and Comments (Page 98)
- Storing Data in Variables (Page 99)
- Creating a variable (Page 100)
- Assigning a value to a variable (Page 102)
- Declaring your variables (Page 106)
- Using Constants (Page 109)
- Commenting Your Code (Page 111)
- Chapter 8:Crunching Numbers and Playing with Strings (Page 114)
- Adding, Subtracting, Dividing,and Multiplying (Page 114)
- Using variables (Page 115)
- Working with precedence (Page 116)
- Using parentheses (Page 118)
- Using Liberty BASIC's Built-In Math Functions (Page 119)
- Manipulating Strings (Page 120)
- Declaring variables as strings (Page 121)
- Smashing strings together (Page 122)
- Playing with Liberty BASIC's String Functions (Page 122)
- Counting the length of a string (Page 123)
- Playing with UPPERCASE and lowercase (Page 123)
- Trimming the front and back of a string (Page 124)
- Inserting spaces (Page 125)
- Yanking characters out of a string (Page 125)
- Looking for a string inside another string (Page 126)
- Converting strings into numbers (and vice versa) (Page 127)
- Chapter 9: Making Decisions with Control Statements (Page 130)
- Using Boolean Expressions (Page 130)
- Using variables in Boolean expressions (Page 132)
- Using Boolean operators (Page 133)
- Exploring IF THEN Statements (Page 138)
- IF THEN ELSE statements (Page 139)
- Working with SELECT CASE Statements (Page 140)
- Checking a range of values (Page 143)
- Checking a relational operator (Page 144)
- Chapter 10: Repeating Yourself with Loops (Page 148)
- Using the WHILE- WEND Loop (Page 149)
- Exiting a WHILE- WEND loop prematurely (Page 150)
- Endless loops # 1: Failing to modify the (Page 151)
- Boolean expression inside the loop (Page 151)
- Endless loops # 2: Failing to initialize a (Page 152)
- Boolean expression outside the loop (Page 152)
- Looping a Fixed Number of Times (Page 153)
- Counting with different numbers (Page 154)
- Counting in increments (Page 154)
- Exiting a FOR- NEXT loop prematurely (Page 156)
- Part III: Advanced Programming (Page 158)
- Chapter 15: Debugging Programs (Page 234)
- Anatomy of a Computer Bug (Page 234)
- Syntax Errors (Page 235)
- Run- Time Errors (Page 237)
- Fun with Logic Errors (Page 238)
- Stepping line by line (Page 239)
- Tracing through your program (Page 240)
- Chapter 14: Creating a User Interface (Page 210)
- Designing a Window (Page 210)
- Creating a new window (Page 210)
- Defining the size and location of a window (Page 212)
- Adding color to a window (Page 213)
- Putting Pull- Down Menus in a Window (Page 214)
- Making Pop- Up Menus (Page 217)
- Putting Controls in a Window (Page 219)
- Creating a command button (Page 219)
- Displaying text (Page 222)
- Creating a check box (Page 223)
- Creating a radio button (Page 224)
- Creating text boxes (Page 226)
- Creating list boxes (Page 228)
- Creating combo boxes (Page 230)
- Creating group boxes (Page 232)
- Chapter 13: Saving and Retrieving Stuff in Files (Page 194)
- Storing Stuff in Text Files (Page 194)
- Creating a new text file (Page 195)
- Putting stuff in a text file (Page 195)
- Adding new stuff to an existing text file (Page 196)
- Retrieving data from a text file (Page 197)
- Storing Stuff in Random- Access Files (Page 199)
- Creating a new random- access file (Page 200)
- Saving data into a random- access file (Page 202)
- Retrieving data from a random- access file (Page 203)
- Saving and Retrieving Data in a Binary File (Page 205)
- Creating a new binary file (Page 205)
- Saving stuff in a binary file (Page 206)
- Changing stuff in a binary file (Page 206)
- Retrieving stuff from a binary file (Page 208)
- Chapter 12: Drawing Pictures and Making Noise (Page 180)
- Creating a Graphics Control (Page 180)
- Using Turtle Graphics (Page 181)
- Defining line thickness (Page 185)
- Defining line colors (Page 186)
- Drawing Circles (Page 187)
- Drawing Boxes (Page 189)
- Displaying Text (Page 190)
- Making Sounds (Page 191)
- Making a beeping noise (Page 192)
- Playing WAV files (Page 192)
- Chapter 11: Writing Large Programs by Using Subprograms (Page 160)
- Passing Data by Value or by Reference (Page 177)
- Using Functions (Page 174)
- Defining a function (Page 174)
- Passing data to a function (Page 175)
- Calling a function (Page 175)
- Exiting prematurely from a function (Page 177)
- Using Subroutines (Page 169)
- Defining a subroutine (Page 170)
- Passing data to a subroutine (Page 170)
- Calling a subroutine (Page 172)
- Exiting prematurely from a subroutine (Page 173)
- Writing Modular Programs (Page 166)
- Introducing Structured Programming (Page 163)
- Sequential instructions (Page 163)
- Branching instructions (Page 163)
- Looping instructions (Page 164)
- Putting structured programming into practice (Page 165)
- Breaking the Bad Programming Habits of the Past (Page 160)
- Part IV: Dealing with Data Structures (Page 242)
- Chapter 19: Playing with Object-Oriented Programming (Page 274)
- The Problem with Software (Page 275)
- Ways to Make Programming Easier (Page 275)
- Breaking Programs into Objects (Page 277)
- How to use objects (Page 278)
- How to create an object (Page 280)
- Writing an object's methods (Page 281)
- Creating an object (Page 282)
- Choosing an Object- Oriented Language (Page 284)
- Chapter 18: Linked Lists and Pointers (Page 260)
- Starting with a Pointer (Page 260)
- Defining the parts of a linked list (Page 262)
- Creating a linked list (Page 264)
- Managing a linked list (Page 266)
- Making Data Structures with Linked Lists (Page 268)
- Double- linked lists (Page 268)
- Circular- linked lists (Page 269)
- Stacks (Page 270)
- Queues (Page 271)
- Trees (Page 272)
- Graphs (Page 273)
- Chapter 17: Lumping Related Data in Records (Page 254)
- Creating a Record (Page 255)
- Manipulating Data in Records (Page 256)
- Storing data in a record (Page 256)
- Retrieving data from a record (Page 257)
- Using Records with Arrays (Page 258)
- Chapter 16: Storing Stuff in Arrays (Page 244)
- Making an Array (Page 245)
- Storing (and Retrieving) Data in an Array (Page 247)
- Making a Multidimensional Array (Page 249)
- Creating Dynamic Arrays (Page 251)
- Part V: Algorithms: Telling the Computer What to Do (Page 286)
- Chapter 20: Sorting (Page 288)
- Insertion Sort (Page 289)
- Bubble Sort (Page 292)
- Shell Sort (Page 295)
- Quicksort (Page 299)
- Sorting Algorithms (Page 302)
- Chapter 21: Searching (Page 306)
- Searching Sequentially (Page 306)
- Performing a Binary Search (Page 308)
- Hashing (Page 311)
- Searching by using a hash function (Page 313)
- Dealing with collisions (Page 312)
- Picking a Searching Algorithm (Page 316)
- Chapter 22: Optimizing Your Code (Page 318)
- Choosing the Right Data Structure (Page 319)
- Choosing the Right Algorithm (Page 319)
- Fine- Tuning the Source Code (Page 320)
- Put the condition most likely to be false first (Page 320)
- Put the condition most likely to be true first (Page 321)
- Don't run a FOR-NEXT loop needlessly (Page 322)
- Clean out your loops (Page 323)
- Use the correct data types (Page 323)
- Use built- in commands whenever possible (Page 325)
- Using a Faster Language (Page 325)
- Optimizing Your Compiler (Page 326)
- Part VII: The Part of Tens (Page 328)
- Chapter 26: Ten Cool Programming Careers (Page 17)
- Programming Computer Games (Page 380)
- Creating Computer Animation (Page 382)
- Making (And Breaking) Encryption (Page 383)
- Internet Programming (Page 384)
- Fighting Computer Viruses and Worms (Page 385)
- Hacking for Hire (Page 386)
- Participating in an Open-Source Project (Page 387)
- Niche-Market Programming (Page 388)
- Teaching Others about Computers (Page 388)
- Selling Your Own Software (Page 389)
- Chapter 27: Ten Additional Programming Resources (Page 390)
- Trying Commercial Compilers (Page 391)
- Windows programming (Page 391)
- Macintosh and Palm OS programming (Page 393)
- Linux programming (Page 394)
- Testing the Shareware and (Page 395)
- BASIC compilers (Page 395)
- C/C++ and Java compilers (Page 396)
- Pascal compilers (Page 396)
- Oddball language compilers (Page 397)
- Using a Proprietary Language (Page 397)
- HyperCard (Page 398)
- Revolution (Page 399)
- PowerBuilder (Page 399)
- Shopping by Mail Order (Page 399)
- Getting Your Hands on Source Code (Page 400)
- Joining a Local User Group (Page 401)
- Frequenting Usenet Newsgroups (Page 401)
- Playing Core War (Page 402)
- Programming a Battling Robot (Page 403)
- Toying with Lego Mindstorms (Page 404)
- Appendix: About the CD (Page 406)
- Bonus Chapter: Programming in Python (Page 18)
- Index (Page 414)
- End-User License Agreement (Page 432)