51_108543-bindex.qxp 4/30/08 8:35 PM Page 671

Index

aligning text using in JavaScript, 493–494 Numerics HTML, 466 linked lists versus, 342 Alpha Five database multi-dimensional, 0 (zero) programming 321–323, 375–376 initializing arrays, 317 language, 79 one-based, 315, 316 zero-based arrays, alpha-beta pruning, overview, 314 315–316 420–421 in Pascal/, 586–587 1-based arrays, 315, 316 American Standard Code in , 569–570 1-time pad algorithm, 446 for Information in PHP, 506 4th Dimension database Interchange (ASCII) requirements for programming codes, 423 defining, 314 language, 79 Analytical Engine, 10 resizable, 319–321, 326 anchor points (HTML), retrieving data from, A 470–471 318–319 And operator, 175–176. See searching and sorting, 326 Ada language, 10, 58, 130 also logical/Boolean speed and efficiency address space layout operators issues, 328 randomization AndAlso operator (Visual storing data in, 318 (ASLR), 642 Basic), 597 for string data types in Adobe AIR RIA tool, 664 Apple , 25, /C++, 526 adversarial search 84, 85 structures with, 314, alpha-beta pruning, AppleScript (Mac), 76, 91 323–325 420–421 applets (), 66 uses for, 327–328 depth versus time in, arrays in VB/RB, 603–604 419–420 associative, 352–353, zero-based, 315–316 horizon effect, 420 517–518 artificial intelligence (AI) library lookup, 421–422 in C#, 554–555 applications, 656 overview, 418–419 in C/C++, 537 Bayesian probability, 653 agile documentation, 287 data type limitations, 326 camps, strong versus agile (extreme) declaring, 318 weak, 644 programming, 112–114 default bounds, 315–316 declarative languages, AI. See artificial intelligence definable bounds for, 70–73 algorithms. See also specific 316–317 expert systems, 646–648 kinds defining the size, 314–317, game-playing, 645–646 “best,” 9 COPYRIGHTED325–326 MATERIALimage recognition, comments describing, 282 deleting elements, 327 651–652 data compression, disadvantages, 325–328, machine learning, 652–655 435–444 329, 375–376 natural language defined, 9 elements, defined, 314 processing, 648–650 encryption, 445–459 for heap sort data, neural networks, 653–655 overview, 9 402–403 problem solving, 644–652 searching, 409–422 initializing, 317–318 robotics, 655 sorting, 393–408 inserting elements, speech recognition, string searching, 423–433 326–327 650–651 Alice teaching language, in Java, 554–555 Turing Test, 643 60–61 51_108543-bindex.qxp 4/30/08 8:35 PM Page 672

672 Beginning Programming All-in-One Desk Reference For Dummies

ASCII (American Standard calling functions, 226 “battling robot” Code for Information combining with C, 134–135 programming games, Interchange) codes, 423 comments, 278 61–62 ASCII files. See text files as database programming Bayesian probability, 653 ASLR (address space layout language, 623, 624 Big-O notation, 407 randomization), 642 defining functions, 225 binary arithmetic, 11 assembly language defining random-access binary searching assemblers for, 16 files, 265 algorithm, 413 comments, 278 descriptive commands, binary trees other languages compared 53–54 heap sort using, 399–402 to, 15 development of, 52 overview, 382–383 overview, 12–14 dialects, 52, 589–590 bioinformatics as processor-specific, 14 evolution of, 589 complimentary speed and efficiency of, financial rewards less sequences, 628 16, 666 for, 51 concatenating molecules, typical command, 12–13 as first language, 50–51 627, 628 uses for, 16, 17 as good language to described, 423, 625 assignment operators know, 49 languages for, 631–632 C/C++, 530–531 GOTO command mutating molecules, Java/C#, 547–548 problems, 33 627–628 JavaScript, 490 hardware and operating programming, 630–632 overview, 162 system shielded by, purpose of, 625–626 Perl/Python, 564–565 54, 589 representing molecules, PHP, 502 as high-level language, 14 626–627 Ruby, 513 instant feedback with, searching databases, associative arrays. See 54, 55 628–630 hash tables interpreters and bit depth, 444 asymmetric (public-key) , 55 BLAST (Basic Local encryption, 453–455 limitations, 589 Alignment and Search attributes, database, 616 multi-dimensional arrays Tool), 629–630 automated documentation, in, 322, 323 block ciphers, 449, 450–452 287 practicing online, 590 block comments principles, 53 C#, 543 problem-solving focus C/C++, 525 B of, 128 describing code and B+ trees, 384 program structure, 590 algorithms, 282–283 background of Web pages, reading random-access documenting 469–470 files, 267 subprograms, 283–284 backward chaining, 646 resizable arrays in, Java, 543 backward or forward 319–320 JavaScript, 487 searching algorithm, True BASIC, 52 overview, 279–281 411 versatility of, 54 PHP, 498 BASIC (Beginner’s All- viewed as toy language, Ruby, 510–511 purpose Symbolic 51, 54 surrounding with Instruction Code). See writing random-access asterisks, 281 also REALbasic; Visual files, 266–267 symbols for, 280–281 Basic Basic Local Alignment and block searching algorithm, C compared to, 50–51, 128 Search Tool (BLAST), 412 629–630 blocks in untyped files, 268 51_108543-bindex.qxp 4/30/08 8:35 PM Page 673

Index 673

blocks of commands breaking up programs. See development of, 14–15 in curly bracket objects; subprograms efficiency of, 64–65 languages, 63, 280 breakpoints, 98–99 as first language, 50–51, defined, 182 brute force attacks on 65, 69 in IF-THEN statements, encryption, 456–457 as good language to 182–183 brute-force searching know, 49 in IF-THEN-ELSE algorithms high-level languages statements, 184–185 adversarial search, 419 versus, 14–15 in IF-THEN-ELSEIF overview, 409–410 IF statements, 183 statements, 186, 188 sequential search, including libraries, 524 BlueJ editor (Java), 26 410–416, 424–429 keywords minimal in, 64, body text (HTML), 464–465 B-trees, 383–384 130 Boolean data type bubble sort algorithm, languages based on, 50 in C++, 528 394–396, 406–408 looping statements, in Java/C#, 545 buffer overflow problems, 533–534 mimicking in C, 528 641 as low-level language, 666 in Pascal/Delphi, 579 bugs, 97. See also operators, 528–531 storage requirements debuggers; debugging other languages for, 150 Burrows-Wheeler transform compared to, 15 in VB/RB, 595 (BWT) algorithm, overview, 523 Boolean operators. See 436–438 portability, 65, 660–661 logical/Boolean bus, defined, 12 power of, 63–64 operators buttons, best use of, 294 problem-solving focus Borland Turbo byte, defined, 149 of, 128 compilers, 25 bytecode. See p-code program structure, Boyer-Moore algorithm, 425 524–525 branching statements. See reasons for popularity, also specific statements C 63–65 Boolean operators in, C language. See also curly SWITCH statement, 189–190 bracket languages 191–193 branches, defined, 34 advantages, 15, 16, 523 as systems programming C/C++, 531–533 arrays, 537 language, 73–74 comparison operators BASIC compared to, use for major programs, in, 181 50–51, 128 15 defined, 181 branching statements, C++ language. See also Java/C#, 548–551 531–533 curly bracket JavaScript, 490–492 calling functions, 226 languages overview, 34–35, 181 challenges for learning, 51 advantages, 667 Pascal/Delphi, 581–582 combining with BASIC, arrays, 537 Perl/Python, 565–566 134–135 based on C, 50, 65, 523 PHP, 502–504 comments, 525 bioinformatics Ruby, 514–515 creating functions, subprogram, 632 VB/RB, 597–599 534–535 branching statements, break command dangers from power of, 531–533 with case statements 54, 64, 523 comments, 278, 280, 525 (Java/C#), 550–551 data structures, 535–537 creating functions, with loops, 211 declaring variables, 147, 534–535 with SWITCH statement, 525–528 dangers from power 192–193, 503 defining functions, 226 of, 523 51_108543-bindex.qxp 4/30/08 8:35 PM Page 674

674 Beginning Programming All-in-One Desk Reference For Dummies

C++ language (continued) as type-safe, 68 SELECT CASE, 190–197, data structures, 535–537 calling. See also parameter 598–599 as database programming passing VB/RB, 598–599 language, 78, 623, 624 functions, 226–227 CBR (constant bit rate), 444 declaring variables, polymorphism with, 243 central processing units 525–528 recursion, 227–229 (CPUs). See processors as first language, 65, 69 subprograms in files, chaining hash tables, 357 IF statements, 183 217–218 check boxes, 297–298 including libraries, 524 subprograms in objects, chess-playing computers, looping statements, 252–253 646 533–534 capitalization Chinese lottery attack, multi-dimensional arrays in curly bracket 456–457 in, 323 languages, 144 Chinese Postman problem, as object-oriented, 65 of local variables (Ruby), 379–380 objects, 537–539 511 , 590 operators, 528–531 variable naming cipher-block chaining overview, 523 conventions, 144 (CBC), 451–452 program structure, Carriage Return (CR) code, circular linked lists, 341, 524–525 261 371 resizable arrays in, cascading stylesheets. See Clarion database 320–321 CSS , as systems programming CASE (Computer-Aided 79 language, 73–74 Software Engineering) Class diagrams (CASE), C++ Robots programming Class diagrams, 117–119 117–119 game, 62 flowcharts, 115–116 class files (VB/RB), 591 C# language. See also curly formatting classes bracket languages automatically, 120–121 creating objects from, advantages, 67–68, 667 generating code 251–252 based on C, 50 automatically, 119–120 defining objects branching statements, modeling a large project, with, 249–251 548–551 115–119 #include command comments, 542–543 Sequence diagrams, 119 for, 252 creating functions, tools common in, 115 clear command (Python), 552–553 tracking revisions, 332 data structures, 553–556 121–122 clustered indexes, 417–418 declaring variables, UML with, 116–119 COBOL (COmmon Business 543–545 Use Case diagrams, Oriented Language), as first language, 70 117, 118 14, 50 looping statements, case statements code generators, 119–120 551–552 C/C++, 532–533 CodeWarrior compiler, 84 .NET compatibility, 68 Java/C#, 550–551 coding phase of extreme as object-oriented, 67 JavaScript, 491–492 programming, 114 objects, 556–557 Pascal/Delphi, 582 coding securely, 640–641 operators, 545–548 PHP, 504 collections program structure, 542 Ruby, 515 adding data, 346–348 pronunciation, 66 deleting data, 348–349 51_108543-bindex.qxp 4/30/08 8:35 PM Page 675

Index 675

dictionaries versus, 352 COmmon Business compression. See data index numbers, 347, Oriented Language compression 350–351 (COBOL), 14, 50 algorithms keys for identifying data, comparison operators. See computer security. See 349–350, 351 relational/comparison security language features for, 345 operators Computer-Aided Software overview, 345–346 comparison with signed Engineering. See CASE Ruby, 517 result operator (Perl), computers searching and retrieving 562, 563 choices for programming, data, 350–351 compilers 18–19 in , 603, 604 for BASIC, 55 history of, 10–11 collisions, hash function, choosing carefully, 22, 84 concatenating molecules, 356–359 choosing, steps for, 84–85 627, 628 colors code generation and concatenation operator, for background with optimization features, 166–167 HTML, 469, 470 86–88 conditional expressions, for text with CSS, 478–479 CodeWarrior, 84 172. See also for text with HTML, compiling to a virtual relational/comparison 467–468 machine, 93–94 operators combo boxes, 298–299 defined, 16, 83 constant bit rate (CBR), 444 comma-delimited text files, features evaluation, 86–90 constants, 153–154, 579, 260–261 free, 89–90 595–596 command-line interfaces, GCC (GNU Compiler Context MBA, 659 290 Collection), 25, 85–86 converting comments. See also block inefficiency of, 16 data types, 179–180 comments interpreters versus, 92 keys with hash functions, C/C++, 525 keyword quantity and 354–356 consistent style for, 281 efficiency of, 64, 130 cookies, 264 defined, 278 languages supported, 86 coupling, tight versus describing code and for , 25–26, 85 loose, 135–136, 137–138 algorithms, 282–283 for Mac OS X, 25, 84, 85 CPUs (central processing documenting open source, 85 units). See processors subprograms, 283–284 operating systems CR (Carriage Return) HTML, 469 supported, 88–89 code, 261 for ignoring lines of code overview, 21–22 cracking encryption when testing, 284–285 Perl/Python, 561 Battle of Midway inappropriate, 279 specific to operating example, 459 Java/C#, 542–543 system, 21–22 brute force attacks, JavaScript, 487 specific to processor, 84 456–457 line, 279 speed issues, 87–88 Chinese lottery attack, Pascal/Delphi, 577 type-safe languages 456–457 PHP, 498 with, 67 dictionary attacks, Ruby, 510–511 for Windows, 24–25, 85 457–458 symbols for, 280–281 complimentary sequences, frequency analysis, 458 VB/RB, 592 628 plaintext attacks, 458 white space for, 279 slot machine example, 450 51_108543-bindex.qxp 4/30/08 8:35 PM Page 676

676 Beginning Programming All-in-One Desk Reference For Dummies

critical bugs, 97 subprograms in, 218–219 hash tables, 353–359, CRobots-3D programming SWITCH statement in, 517–518, 556 game, 62 191–193 Java, 553, 554–556 cross-platform zero-based arrays in, linked lists, 337–344, 370, programming. See also 315–316 371, 555–556 portability Pascal, 585–587 languages for, 661–662 Perl, 569–570 need for, 660 D Python, 570–572 rich Internet applications data. See also reading files; queues, 365–370, 556 (RIAs), 664–665 writing files REALbasic, 603–604 robotics, 665–666 isolated with OOP, 45–46 Ruby, 517–518 software as service model, private versus public, sets, 329–337, 341–342, 663–664 234–235 587 virtual machines for, 23, shielded by stacks, 361–365, 556 66, 93–94, 662–663 encapsulation, 236–237 trees, 380–390 CSng function, 179–180 transferring, scripting Visual Basic, 603–604 CSS (cascading stylesheets) languages for, 77 data types. See also cascading and data compression declaring variables; precedence, 482–483 algorithms strings colors for text, 478 Burrows-Wheeler for arrays, 326 embedding styles, 481 transform, 436–438 Boolean, 150, 528, 545, linking to external lossless, 436–442 579, 595 stylesheet files, lossy, 442–444 choosing for variables, 481–482 lossy/lossless trade-offs, 148–149 origin of name, 477 442–443 comments explaining overview, 477 run-length encoding, 436 choice of, 283 separating stylesheets in trade-offs, 435, 444 converting, 179–180 files, 481–482 data execution protection decimal, 579, 594 style classes, 479–480 (DEP), 642 declaring variables with, stylesheet structure, data integrity, 621 146–147 477–479 data mining, 622 floating point, 148–150, curly bracket languages. data structures. See also 527–528, 544 See also specific arrays; structures; for global variables, 156 languages specific structures integer, 148–150, 526–527, break command, C#, 553–555, 556 544, 578, 593–594 192–193, 211 C/C++, 535–537 range of values for, 148 choosing, 69–70 choosing, 328, 342, records, 265 defined, 63 359, 373 storage requirements for, FOR-NEXT loops in, collections, 345–351, 352, 149–150 202–203, 205–206 517, 603, 604 typeless versus strongly- #include command for Delphi, 585–587 typed languages, 74–75 subprograms, 218–219 deques, 370–373 user-defined, 265, 312 increment operator, dictionaries, 352–359, 572, uses for, 148 202–203 603, 604 validation still needed overview, 63–69 graphs, 376–380 with, 149 variant, 326, 595 51_108543-bindex.qxp 4/30/08 8:35 PM Page 677

Index 677

database management source-level versus decrement operator connecting to databases, machine-language, 98 C/C++, 529–530 273–276 debugging Java/C#, 546–547 data integrity, 621 commenting out code for, JavaScript, 489, 490 data mining, 622 284–285 Perl, 563–564 database programming, stepping or tracing, PHP, 501–502 622–624 97–100 Deep Fritz chess-playing with flat-file databases, variable watching, computer, 646 612–613 100–101 Delphi with free-form databases, decimal data types. See branching statements, 611 also floating point data 581–582 Join command, 619 types comments, 577 manipulating data, in Pascal/Delphi, 579 constants, 579 617–622 in VB/RB, 594 creating functions and overview, 609 declarative languages, 70 subprograms, 584–585 Project command, declaring arrays, 318 data structures, 585–587 618, 619 declaring variables database programming RAD tools for, 275–276 as arrays, 314, 315, 316, features, 80 with relational databases, 317 declaring variables, 613–617 in BASIC, 142–143 577–579 Select command, 617–618, in C/C++, 525–528 looping statements, 619 as collections, 346 583–584 SQL for, 271, 620–621 in commands, 144–145 objects, 587–588 third-party toolkits for, with data type, 146–147 origins of, 57 273–275 global variables, 156 overview, 575–576 writing commands, 620 in Java/C#, 543–545 program structure, 576 database programming in JavaScript, 487–488 reading untyped files, languages, 78–80, language differences 269–270 623–624 for, 147 Web site, 40, 57 databases in modules, 156 writing untyped files, , 609–617 as multi-dimensional 268–269 bioinformatics, 628–630 arrays, 322–323 DEP (data execution distributed, 617 naming conventions, protection), 642 flat-file, 611–613 143–144 deques free-form, 610–611 overview, 142–143 adding and removing popular file formats, in Pascal/Delphi, 577–579 data, 371–372 271–272 Perl/Python, 561 common commands, 371 relational, 273, 274, in PHP, 499 overview, 370–371 613–617 as queues, 366 undoing commands, structure of, 272–273 in Ruby, 511 372–373 uses for, 276 as sets, 329–330 uses for, 373 dBASE, 78–79 as stacks, 362 design patterns debuggers as structures, 312 defined, 243 defined, 83 in subprograms, 157 flyweight, 244–245 features, 95 at top of program, 147 interface, 244 with IDEs, 96 in VB/RB, 592–595 51_108543-bindex.qxp 4/30/08 8:35 PM Page 678

678 Beginning Programming All-in-One Desk Reference For Dummies

design patterns (continued) for malware dissection, free with operating memento, 245–246 634, 635 systems, 19 multiple in one obfuscators for IDE, 95–97 program, 246 preventing, 106 for Java, 26 overview, 243 overview, 105–106 overview, 19–20 design specifications, 285 distributed databases, 617 standalone, 95 designing user interfaces Div operator electronic codebook (ECB) as art and science, (Pascal/Delphi), 580 cipher, 451 302–303 dividing programs. See Electronic Numerical being consistent, 306 objects; subprograms Integrator and error messages, 305 divmod operator (Python), Computer (ENIAC), 10 event-driven programming 562 ELIZA NLP program, for, 39–40, 41, 42 DO loops, 208–211 649–650 focusing on tasks, 306–307 documentation. See also emphasizing text using hiding unusable options, comments HTML, 467 304–305 agile, 287 encapsulation, 235–238 knowing the user, 303 automated, 287 encryption algorithms for navigation ease, 307 design specifications, 285 basics of encryption, tolerating mistakes, help files, 287–288 447–448 305–306 need for, 277 block ciphers, 449, visually, 39–40, 41, 42 self-documenting code, 450–452 desire, training versus, 277–278 cracking encryption, 450, 17–18 technical designs, 286 455–459 Dev-C++ compiler, 25 tools, 286–287 implementation Dev-Pascal compiler, 25 types of, 285 issues, 447 dialog boxes (user user manuals, 286 key length issues, 448 interface), 300–301, video tutorials, 286 one-time pad, 446 494–495 writing, 285–288 password, 446–447 dictionaries double hashing, 358–359 permutation box or P-box, adding data, 352–353 double linked lists, 340–341, 447–448 collections versus, 352 371 security through defined, 352 DO-UNTIL loops (VB/RB), obscurity, 447 hash tables with, 353–359 600–601 steganography, 456 key-value pairs, 352, 354 DO-WHILE loops stream ciphers, 449–450 in Python, 572 C/C++, 534 substitution box or S-box, in REALbasic, 603, 604 Java/C#, 552 447–448 searching and retrieving JavaScript, 493 substitution ciphers, data, 353 Visual Basic, 600, 601 445–446 dictionary attacks on dynamic model (UML), 119 symmetric/asymmetric, encryption, 457–458 452–455 dictionary encoding for wireless standards, 450 algorithms, 439–442 E endless loops, 201–202, 207, directed graphs, 377–378, IDE (Java), 26, 97 212, 228 428–429 editors ENIAC (Electronic disassemblers defined, 19, 83 Numerical Integrator defined, 83 features, 96 and Computer), 10 51_108543-bindex.qxp 4/30/08 8:35 PM Page 679

Index 679

enumerated variables JavaScript, loading in Web in curly bracket (C/C++), 536–537 page, 487 languages, 202–203, error messages, avoiding PDF, 264 205–206 cryptic, 305 proprietary formats, 271 DOWNTO with, 205 event handlers, 39, 40, random-access, 264–268 endless, 201–202 42–43 storing subprograms initializing arrays event-driven programming separately in, 36–37, using, 317 combining with other 131, 133–135 loop variable with, methodologies, 48 text, 259–264 201–203 designing a , Universal Binary (Mac), nested, 209–211 39–42 21 overview, 200–201 development of, 38–39 untyped, 268–271 STEP with, 204 languages, 40 finite automaton string VB/RB, 600 parts of programs, 39 search algorithm, FORTRAN (FORmula writing event handlers, 428–429 TRANslator), 14, 161 42–43 firewalls, 635, 636, 637 forward chaining, 646 writing the program, 43 flat-file databases, 611–613 4th Dimension database Excel (), 659 floating point data types. programming executable (EXE) files, See also decimal data language, 79 21, 83 types free-form databases, EXIT command with in C/C++, 527–528 610–611 loops, 211 in Java/C#, 544 frequency analysis, 458 experimenting, 23–24 overview, 148–150 functional languages, 70 expert systems, 646–648 storage requirements functional model (UML), exponentiation operator for, 150 117, 118 overview, 163 flyweight design pattern, functions. See also Perl/Python, 562 244–245 subprograms Ruby, 512 fonts, HTML for, 467–468 calling, 226–227 VB/RB, 596 FOR loops creating in BASIC, 225 extreme programming C/C++, 533 creating in C, 226 (XP), 112–114 Java/C#, 551 creating in C/C++, 534–535 JavaScript, 492 creating in Java/C#, Pascal/Delphi, 583 552–553 F Perl/Python, 566–567 creating in JavaScript, 493 factorials, calculating, PHP, 504 creating in Pascal/Delphi, 227–228 Ruby, 515 584–585 FBI’s project failure, 8 VB/RB, 600 creating in Perl/Python, Fibonacci searching, forensics, 639 568–569 414–416 FOR-NEXT loops creating in PHP, 505 FIFO (First In, First Out) counting backward, creating in Ruby, 516 structures, 366 205–206 creating in VB/RB, 602 files. See also reading files; counting by a range, defined, 162 writing files 203–204 math (table), 165–166 for CSS, external, 481–482 counting by different parameter list for, 226 executable (EXE), 21, 83 increments, 204–205 RETURN keyword, 226 string (table), 167 51_108543-bindex.qxp 4/30/08 8:35 PM Page 680

680 Beginning Programming All-in-One Desk Reference For Dummies

functions (continued) for single path solutions, heuristic searching as subprograms with 378–379 algorithms, 409–410 name as value, 225 topological graph theory, hexadecimal numbers, 11 typical example, 225 380 high coupling, 135–136 future of programming types of, 377–378 high-level languages, 13, 14, cross-platform GUI (graphical user 15. See also specific programming, 660–666 interface). See user languages language choices, interface history of computer 657–658, 666–669 programming choices, assembly language, 12–14 658–660 H C language, 14–15 hackers, defenses against early computers, 10–11 G firewall, 637 high-level languages, 14 forensics, 639 machine language, 11 game-playing in AI, 645–646 intrusion detection pros and cons of GCC (GNU Compiler systems, 637–638 languages, 15–17 Collection), 25, 85–86 rootkit detectors, 638 honeypot programs, 638 GCJ Java compiler, 94 secure computing, horizon effect, 420 generic values (VB/RB), 595 639–642 HTML (HyperText Markup global variables, 154–156 hash arrays (Perl), 570 Language) glue, scripting languages as, hash tables and 77, 668 in C#, 556 tags, 463–464 GNU editor, 95 chaining, 357 aligning text, 466 GOTO command collisions, 356–359 as basis of all Web problems, 33 complexity added by, 359 pages, 463 grafting sub-trees, 388, 390 converting keys with hash body text, 464–465 functions, 354–356 colors for background, (GUI). See user double hashing, 358–359 469, 470 interface overview, 353–356 colors for text, 467–468 graphics Ruby, 517–518 comments, 469 adding to Web page searching improved by, document structure, (HTML), 469 353–354 463–469 background for Web page headings in Web pages emphasizing text, 467 (HTML), 470 CSS for, 478–480, 482–483 font size, 468 image recognition, HTML for, 465 graphics for background, 651–652 style classes for (CSS), 470 graphs. See also trees 479–480 graphics on pages, 469 connecting nodes, 380 tables, HTML for, 472–473 headings, 465 connections or edges, titles, HTML for, 464 hyperlinks, 470–471 defined, 377 heap, defined, 399 JavaScript markup, nodes or vertices, heap sort algorithm, 486–487 defined, 377 399–403, 406–408 line breaks, 464–465 overview, 376–377 help file creators, 83, PHP markup, 497–498 for shortest path 103–104, 288 tables, 471–475 solutions, 379–380 help files, 287–288 titles, 464 51_108543-bindex.qxp 4/30/08 8:35 PM Page 681

Index 681

hybrid OOP languages, IF-THEN-ELSE statements in Perl/Python, 573 246–247 blocks with, 184–185 in PHP, 507 Hydra chess-playing IF-THEN-ELSEIF polymorphism with, computer, 646 statements versus, 185 242–243, 256–258 hyperlinks, 470–471 overview, 184 in Ruby, 519 Pascal/Delphi, 581, 582 in VB/RB, 605 VB/RB, 598 initializing I IF-THEN-ELSEIF arrays, 317–318 IBM’s Jikes Java compiler, statements loop variables, 207, 209 94 checking a condition for in-order traversal of trees, IDE (integrated each command, 385–386 development 186–187 in-place sorting algorithms, environment), 95–97 IF-THEN-ELSE 394 identifying the problem, 8 statements versus, 185 insertion sort algorithm, IDSs (intrusion detection Pascal/Delphi, 582 397–398, 406–408 systems), 637–638 for three or more choices, installer programs, 83, IF statements 187–189 104–105 C/C++, 531 VB/RB, 598 instructions, defined, 128 Java/C#, 548 image recognition, 651–652 instrumentation mode of JavaScript, 490 increment operator profilers, 103 Pascal/Delphi, 581 C/C++, 529–530 integer data types Perl/Python, 565 Java/C#, 546–547 in C/C++, 526–527 PHP, 502–503 JavaScript, 489 in Java/C#, 544 Ruby, 514 overview, 202–203 overview, 148–150 IF-ELSE statements Perl, 563–564 in Pascal/Delphi, 578 C/C++, 531 PHP, 501 storage requirements for, Java/C#, 548 Ruby, 513 150 JavaScript, 491 indexes in VB/RB, 593–594 Perl/Python, 565–566 for collections, 347, integer division operator, PHP, 503 350–351 163, 596 Ruby, 514 for searching algorithms, integrated development IF-ELSEIF statements 416–418 environment (IDE), C++, 531–532 inference engine, 646, 647 95–97 Java/C#, 548–549 informed searching interface design pattern, Perl/Python, 566 algorithms, 409–410 244 PHP, 503 inheritance Internet resources Ruby, 514–515 advantages, 240 Alice site, 60 IF-THEN statements in C++, 538–539 “battling robot” blocks with, 182–183 inheriting an object, programming C/C++, 183 253–256 games, 62 overview, 182 in Java/C#, 557 bioinformatics Pascal/Delphi, 582 multiple, 240, 539 subprograms, 632 SELECT CASE statements need for, 238–240 BLAST, 629 versus, 196–197 overview, 47, 48, 240–242 Chipmunk BASIC site, 590 VB/RB, 597 in Pascal/Delphi, 588 database programming languages, 79 51_108543-bindex.qxp 4/30/08 8:35 PM Page 682

682 Beginning Programming All-in-One Desk Reference For Dummies

Internet resources (continued) operators, 488–490 Delphi site, 40, 57 J overview, 485–486 free compilers, 89–90 structure of programs, Java. See also curly bracket GCC compiler, 85 486–487 languages; virtual IDEs, 97 for transferring data machines (VMs) interpreters, 92 among programs, 77 advantages, 667 Java compilers, 26, 94 user interface design, applets, 66 Java editors, 26 494–496 based on C, 50, 66 Java site, 94 jEdit editor (Mac), 19 bioinformatics in, 631, 632 KPL site, 59 Jikes Java compiler branching statements, Liberty BASIC site, 590 (IBM), 94 548–551 Linux compilers, 25–26, 90 Join command for comments, 278, 542–543 Loebner Prize, 643 databases, 619 compilers, 26, 66, 94 Mac OS X compilers, JScript interpreter creating functions, 25, 90 (Windows), 91 552–553 Mac OS X editors, 19 jump searching algorithm, data structures, 553–556 Phrogram site, 60 412 declaring variables, PowerShell interpreter, 91 Just BASIC compiler, 25 543–545 REALbasic site, 40, 589 editors for, 26 Run BASIC site, 590 as first language, 70 software for running K IDEs for, 97 Windows and Linux on JavaScript versus, 486 keys for encryption Mac OS X, 19 looping statements, asymmetric (public-key), standalone editors, 95 551–552 453–455 ThinkFree Microsoft Office objects, 556–557 ECB ciphers, 451 clone, 663 operators, 545–548 length issues, 448 True BASIC, 52 overview, 541 stream ciphers, 449 Visual Basic site, 589 p-code used by, 23, 66 symmetric (private-key), Windows compilers, portability, 66, 541 452–453 24–25, 89 program structure, 542 keys in data structures interpolation searching safety features, 66 collections, 349–350, 351 algorithm, 414–416 starting with, 26 dictionaries, 352–353, interpreters Web site, 94 354–356 advantages, 92 JavaScript hash function for for BASIC, 55 arrays, 493–494 converting, 354–356 compilers versus, 92 branching statements, keywords for Logo, 57 490–492 in C, minimal, 64, 130 for operating systems, 91 comments, 487 defined, 64 overview, 22–23, 90–91 creating functions, 493 efficiency, ease, and for p-code, 23 declaring variables, number of, 64, 130 for scripting languages, 487–488 overview, 128–129 22–23, 74 external files for, 487 subprograms similar for Web pages, 91–92 HTML markup for, 486–487 to, 132 intrusion detection systems interpreter, 91–92 Kid’s Programming (IDSs), 637–638 Java versus, 486 Language (KPL), 59–60 51_108543-bindex.qxp 4/30/08 8:35 PM Page 683

Index 683

knowledge base, 646, 647 problem-solving focus complexity of creating, KPL (Kid’s Programming of, 128 343–344 Language), 59–60 proprietary, 58–59 creating, 338–339 pros and cons of, 15–17 deleting data, 340 queues with, 366 disadvantages, 341–342 L scripting, 73–78 double, 340–341, 371 languages. See also specific sets with, 330 in Java, 555–556 languages shifting popularity of, 27 nodes, defined, 337 artificial intelligence, systems programming, overview, 337–338 70–73 73–74, 668 pointers, defined, 338 assembly, 12–14, 15–16 teaching, 52–62 for queues, 370, 371 for bioinformatics variable declaration rearranging pointers, programming, 631–632 differences, 147 339–340 choosing compiler for, variety of choices Linux 84–85 available, 49 based on UNIX, 18 choosing the best, Lego Mindstorms NXT-G, bioinformatics 668–669 61, 666 subprogram, 632 choosing your first, level order traversal of compilers, 25–26, 90 50–51, 81 trees, 386 described, 19 collections with, 345 LF (Line Feed) code, 261 editors, 19 compiler support for, 86 Liberty BASIC, 590 running on Mac OS X, 19 cross-platform, 661–662 libraries LISP (LISt Processing), curly bracket, 63–70 breaking programs into 72–73, 278, 653 database programming, subprograms for, list boxes, 298 78–80 133–134 lists (Python), 571 for event-driven commercial, 133 Loebner Prize, 643 programming, 40 features added through, logical/Boolean operators features, 30 330 And (overview), 175–176 future of, 657–658, math functions, 165 in branching statements, 666–669 PHP array functions, 506 189–190 goal of, 12 for queues, 366 C/C++, 529 high-level, 14 for sets, 330 Java/C#, 546 hybrid OOP, 246–247 for user interfaces, JavaScript, 489 improvements in, 12, 139, 293 multiple expressions 29–30 line breaks (HTML), using, 189–190 knowing, knowing 464–465 Not (overview), 175 programming versus, line comments, 279 Or (overview), 176–177 26–27 lines of code overview, 174–175 learning two or more, 72 commenting out, 284–285 Pascal/Delphi, 580–581 low-level, 666 comments on, 279 Perl/Python, 563 machine, 11, 666 defined, 19, 128 PHP, 500–501 multiple in one program, minimizing, 128 Ruby, 512–513 134–135 linked lists VB/RB, 596–597 object-oriented, 246–248 adding data, 338 in WHILE loops, 207 popular, reasons for arrays versus, 342 Xor (overview), 177–178 knowing, 49 circular, 341, 371 Logo language, 55–57 51_108543-bindex.qxp 4/30/08 8:35 PM Page 684

684 Beginning Programming All-in-One Desk Reference For Dummies

loop variable lossless algorithms math functions, 165–166 adding 1 to, 202 versus, 435, 442–443, mathematical operators counting backward, 444 C/C++, 528 205–206 overview, 442–444 common (table), 163 counting by a range, Lotus 1-2-3, 659 Java/C#, 545 203–204 low coupling, 135–136, JavaScript, 488 counting by different 137–138 Pascal/Delphi, 580 increments, 204–205 lowercase. See Perl/Python, 561–562 FOR-NEXT loop, 201–206 capitalization PHP, 500 overview, 201–203 LZ77 algorithm, 440 precedence, 164–165 WHILE loop, 208 LZ78 algorithm, 440 Ruby, 511–512 looping statements. See LZW algorithm, 440–442 VB/RB, 596 also specific statements memento design pattern, C/C++, 533–534 245–246 endless loops, 201–202, M memory 207, 212 Mac OS X ASLR, 642 EXIT command, 211 AppleScript with, 76 OOP requirements, 248 initializing arrays using, compilers, 25, 84, 85, 90 sorting algorithm 317 described, 18 requirements, 394 Java/C#, 551–552 editors, 19 storage requirements for JavaScript, 492–493 software for running data types, 149–150 nested loops, 209–211 Windows and Linux on, menus (user interface), overview, 35, 199–200 19 290–291, 294, 295 parts of loops, 35 Universal Binary files, 21 merge sort algorithm, Pascal/Delphi, 583–584 machine language 403–404, 406–408 PHP, 504–505 assemblers for, 16 methodologies. See Ruby, 515–516 created by compilers, 21 programming tips, 211–212 defined, 11 methodologies VB/RB, 600–601 other languages compared methods. See subprograms loose coupling, 135–136, to, 15 microprocessors. See 137–138 overview, 11 processors lossless compression speed and efficiency of, Microsoft. See also algorithms 16, 666 Windows (Microsoft) Burrows-Wheeler uses for, 16, 17 C# development by, 541 transform, 436–438 machine learning compilers no longer dictionary encoding, Bayesian probability, 653 supported by, 84 439–442 neural networks, 653–655 Excel, 659 lossy algorithms versus, overview, 644, 652–653 JScript interpreter, 91 435, 442–443, 444 robotics, 655 Office suite compilers, 84 run-length encoding, 436 machine-language PowerShell interpreter, 91 lossy compression debuggers, 98 Robotics Studio, 665 algorithms macro languages. See Silverlight RIA tool, 665 bit depth, 444 scripting languages Mod operator CBR versus VBR, 444 malware, 633–636 (Pascal/Delphi), 580 51_108543-bindex.qxp 4/30/08 8:35 PM Page 685

Index 685

modeling, 44–45 data types for, 148–150 polymorphism, using to Modula-2 language, 58 initializing arrays for, 317 rewrite a subprogram, module files (VB/RB), 591 in variant data type, 256–258 modules, restricting 326, 595 reusability with, 44, 46 variable scope to, NXT-G language (Lego), structured programming 156–157 61, 666 versus, 44–47 MP3 compression, 443, 444 objects. See also object- multi-dimensional arrays oriented programming creating, 322–323 O (OOP) limitations, 375–376 obfuscators, 106 breaking programs into, overview, 321–322 object model (UML), 135–138 retrieving data from, 323 117–119 C++, 537–539 storing data in, 323 Objective-C language, 667 C#, 556–557 multiple inheritance, object-oriented creating from classes, 240, 539 programming (OOP). 251–252 mutating molecules, See also objects data isolated by, 45–46 627–628 advantages, 47, 232, 235 defined, 45 combining with other defining with classes, N methodologies, 48 249–251 complexity eased by, Delphi, 587–588 names 44–45 inheriting, 253–256 storing values in data isolated with, 45–46 Java, 556–557 subprogram name, defining an object with a modifications simplified 225–227 class, 249–251 by, 46–48 for subprograms, 216 design patterns, 243–246 parts of, 234 variable naming development of, 232 Pascal, 587–588 conventions, 143–144 disadvantages, 248 Perl/Python, 572–573 natural language encapsulation, 235–238 PHP, 507 processing (NLP), examples, 249–258 physical items 648–650 inheritance, overview, 47, represented by, .NET framework, 68–69, 48, 238–242 136–137 133, 541 inheriting an object, private versus public data NetBeans IDE (Java), 26, 97 253–256 in, 234–235 neural networks, 653–655 languages, 246–248 private versus public niche markets, 8 loose coupling enforced subprograms in, NLP (natural language by, 136 234–235 processing), 648–650 modeling with, 44 REALbasic, 605 Not operator, 175. See also modifications simplified Ruby, 518–519 logical/Boolean by, 46–48 running subprograms operators need for, 43 stored in, 252–253 numbers. See also decimal not foolproof, 235 subprograms compared data types; floating overview, 232–235 to, 136–137, 232–233 point data types; polymorphism, overview, Visual Basic, 605 integer data types 242–243 OCR (optical character recognition), 651 51_108543-bindex.qxp 4/30/08 8:35 PM Page 686

686 Beginning Programming All-in-One Desk Reference For Dummies

offline sorting algorithms, Python, 561–563, 564–565 scope of variables with, 394 regular expressions, 158–159 one-based arrays, 315, 316 168–171 by value, 223, 602 one-time pad algorithm, 446 relational/comparison PARRY NLP program, 650 online sorting algorithms, (overview), 172–174 Pascal language 394 Ruby, 511–513 advantages, 57–58 open source compilers, 85 VB/RB, 596–597 branching statements, operating systems. See also optical character 581–582 specific kinds recognition (OCR), 651 comments, 281, 577 choices for programming, optimizing programs constants, 579 18–19 compiler features for, creating functions and choosing compiler for, 86–87 subprograms, 584–585 84–85 profilers for, 102–103 data structures, 585–587 compiler support for, Or operator, 176–177. See declaring variables, 147, 88–89 also logical/Boolean 577–579 compilers specific to, operators development of, 57 21–22 ordered trees fading popularity of, 58 defined, 18 binary, 382–383 as high-level language, 14 editors free with, 19 B-trees, 383–384 linked lists with, 343–344 future of, 658–660 ordinary, 381–382 looping statements, interpreters, 91 OrElse operator (Visual 583–584 p-code compatibility Basic), 597 objects, 587–588 issues, 23 organizing programs overview, 575–576 shielded from breaking into program structure, 576 by subprograms, 131–135 structured programming BASIC, 54 creating a user interface, in, 37, 57–58 operators. See also specific 138–140 passing parameters. See kinds dividing into objects, parameter passing assignment (overview), 135–138 password algorithms, 162 need for, 130–131 446–447. See also keys C/C++, 528–531 storing subprograms in for encryption defined, 162 separate files, 36–37, patching, 640 increment (overview), 131, 133–135 pattern matching 202–203 organizing user interfaces, combining regular Java/C#, 545–548 301–302 expressions, 170–171 JavaScript, 488–490 with multiple-character language differences wildcards, 169–170 for, 161 P with ranges, 170 logical/Boolean parameter passing with single-character (overview), 174–178 calling functions, 226–227 wildcard, 168 mathematical (overview), calling subprograms, for specific characters, 162–165 219–222 169 Pascal/Delphi, 580–581 parameter list for, 219, 226 payload of viruses, 634 Perl, 561–563 parameters, defined, 219 P-box algorithms, 447–448 PHP, 500–502 by reference, 222–225, 602 p-code precedence, 164–165 51_108543-bindex.qxp 4/30/08 8:35 PM Page 687

Index 687

advantages and operators, 561–565 of Java, 66, 541 disadvantages, 23 overview, 559–560 of REALbasic, 589–590 compatibility issues, 23 program structure, Visual Basic issues, 589 compiling to a virtual 560–561 Portable Document Format machine for, 93–94 Python compared to, (PDF), 264 with Java, 23, 66 559–560 postorder traversal of with .NET framework, 68 for transferring data trees, 386 overview, 23 among programs, 77 PowerShell interpreter with Revolution, 77–78 permutation box (Windows), 91 virtual machines for, 662 algorithms, 447–448 precedence of operators, with Visual Basic, 77 PGP (Pretty Good Privacy), 164–165 PDF (Portable Document 454, 455 preorder traversal of Format), 264 phonetic string searching, trees, 385 performance 431–433 Pretty Good Privacy (PGP), arrays, 328 PHP (PHP Hypertext 454, 455 assembly language, 16 Processor) private versus public data BASIC limitations, 589 arrays, 506 and subprograms, compiler issues, 16, 64, branching statements, 234–235 87–88, 130 502–504 private-key (symmetric) of compilers, 87–88 comments, 498 encryption, 452–453 keywords’ affect on, creating functions, 505 problem solving in AI 64, 130 creating objects, 507 expert systems, 646–648 machine language, 16 declaring variables, 499 game-playing, 645–646 sorting algorithms, 394, HTML markup for, image recognition, 406–408 497–498 651–652 string searching interpreter for, 92 natural language algorithms, 433 looping statements, processing, 648–650 structures, 328 504–505 overview, 644 virtual machines, 94 operators, 500–502 speech recognition, Perl program structure, 650–651 based on C, 50 497–498 problem solving in bioinformatics in, 627, Phrogram teaching programming, 7–9, 628, 631, 632 language, 60 127–128 branching statements, plain text files. See text files procedural languages, 70 565–566 plaintext attacks on procedures. See comments, 278, 561 encryption, 458 subprograms creating functions, pointers, 338. See also processors 568–569 linked lists assembly language data structures, 569–570 polymorphism, 242–243, particular to, 14 default sorting algorithm, 256–258 C manipulation of, 15 404 popping data from a stack, compilers specific to, 84 defining variables, 561 363–364 defined, 11 interpreter for, 92 portability. See also cross- functions of, 12 looping statements, platform programming native language of, 11 566–568 of C, 65, 660–661 registers, 12, 13 objects, 572–573 defined, 65 profilers, 83, 96, 102–103 51_108543-bindex.qxp 4/30/08 8:35 PM Page 688

688 Beginning Programming All-in-One Desk Reference For Dummies

programming basics proprietary languages, declaring variables assemblers or compilers, 58–59 for, 366 21–22 pruning sub-trees, 387–388, deleting data, 368 computer and operating 389 overview, 365–366 system choices, 18–19 pseudocode. See p-code quick sort algorithm, defining the steps, 9 pseudorandom numbers, 405–408 desire versus training, 449–450 17–18 public versus private data editors, 19–20 and subprograms, history, 10–17 234–235 Rabin-Karp algorithm, 426 identifying the problem, 8 public-key (asymmetric) RAD (rapid application interpreters, 22–23 encryption, 453–455 development) tools knowing programming Python database, 275–276 versus knowing a bioinformatics in, 631, 632 user interface, 139, 140, language, 26–27 branching statements, 293 p-code (pseudocode), 23 565–566 radio buttons, 297 starting with Java, 26 calling functions, 227 random-access files starting with Linux, 25–26 comments, 278, 561 overview, 264–266 starting with Mac OS X, 25 creating functions, proprietary formats, 271 starting with Windows, 568–569 reading, 267–268 24–25 data structures, 570–572 text files versus, 264 subjects involved, 1 defining variables, 561 uses for, 276 taking time to experiment, interpreter for, 92 writing, 266–267 23–24 looping statements, RAT (remote access programming languages. 566–568 Trojan), 636 See languages objects, 572–573 RB. See REALbasic programming operators, 561–563, RC4 stream cipher, 450 methodologies 564–565 reading files combining, 48 overview, 559–560 defined, 263 event-driven Perl compared to, 559–560 random-access, 267–268 programming, 38–43 program structure, text, 263 object-oriented 560–561 untyped, 269–271 programming, 43–48 reading text files, 263 REALbasic. See also BASIC spaghetti programming, sets in, 330–337 (Beginner’s All-purpose 31–32, 33 subprogram creation Symbolic Instruction structured programming, in, 220 Code) 32–37 for transferring data branching statements, tools, 29–30 among programs, 77 597–599 top-down programming, writing text files, 262 class files, 591 35–37 comments, 592 programming tools. See Q compiler, 26 tools constants, 595–596 Project command for queues creating functions and databases, 618, 619 adding data, 367 subprograms, 601–602 Prolog language, 70–72, in C#, 556 data structures, 603–604 73, 653 counting and searching, declaring variables, proprietary file formats, 368–370 592–595 271 51_108543-bindex.qxp 4/30/08 8:35 PM Page 689

Index 689

looping statements, Ruby, 512 overview, 509 600–601 VB/RB, 596 program structure, 510 module files, 591 Remember icon, 4 Ruby on Rails framework objects, 605 remote access Trojan for, 509 operators, 596–597 (RAT), 636 for transferring data portability, 589–590, 661 REPEAT-UNTIL loops among programs, 77 program structure, (Pascal/Delphi), Run BASIC site, 590 590–591 583–584 run-length encoding (RLE) Visual Basic versus, repository, 121–122 algorithm, 436 667–668 reserved words. See Web site, 40, 589 keywords window files, 590–591 resizable arrays, 319–321, S records (data structures). 326 S-box algorithms, 447–448 See structures reusability. See also scope of variables records in random-access libraries described, 154 files, 264–265 inheritance for, 241–242 general rule for, 159 recursion, 227–229, 394 object-oriented global, 154–156 reference, passing programming for, 44, 46 module, 156–157 parameters by, 222–225 polymorphism for, 243 parameter passing, registers, 12, 13 structured programming 158–159 regular expressions issues, 46–47 subprogram, 157–159 (RegEx) subprogram issues, 231 Script Editor interpreter combining, 170–171 revision control programs, (Mac), 91 defined, 168 121–122 scripting languages. See multiple-character Revolution scripting also specific languages wildcards in, 169–170 language, 77–78 for automating repetitive ranges of characters RIAs (rich Internet tasks, 75 in, 170 applications), 664–665 for customizing programs, single-character wildcard Robocode programming 76 in, 168 game, 62 with database programs, square brackets in, 169 robotics, 61, 655, 665–666 80 for string searching, Robotics Studio defined, 74 429–431 (Microsoft), 665 future of, 668 relational databases, 273, rootkit detectors, 638 as glue, 77, 668 274, 613–617 RTF (Rich Text Format), 261 interpreters for, 22–23, 74 relational/comparison Ruby overview, 74–75 operators branching statements, for standalone in branching statements, 514–515 applications, 77–78 181 comments, 510–511 traditional programming C/C++, 529 creating functions, 516 languages versus, common (table), 172 creating objects, 518–519 74–75 Java/C#, 546 data structures, 517–518 for transferring data JavaScript, 488–489 declaring variables, 511 among programs, 77 overview, 172–174 interpreter for, 92 as typeless, 74–75 Pascal/Delphi, 580 looping statements, uses for, 75 Perl/Python, 562–563 515–516 search space, 409 PHP, 500 operators, 511–513 51_108543-bindex.qxp 4/30/08 8:35 PM Page 690

690 Beginning Programming All-in-One Desk Reference For Dummies

searching. See also through obscurity, 447 overview, 424–425 searching algorithms SELECT CASE statements Rabin-Karp algorithm, 426 arrays, challenges for, 326 checking range of values, Shift Or algorithm, collections, 350–351 194–195 427–428 dictionaries, 353 comparing values, 195 sets queues, 369–370 ELSE statement with, adding data, 331 regular expressions for, 195–196 advantages over arrays, 429–431 general rule for, 196–197 330, 332 stacks, 365 IF-THEN statements checking for membership, trees (traversal), 382, 383, versus, 196–197 332–333 384, 385–386 matching multiple values, combining elements with searching algorithms 193–194 difference adversarial search, overview, 190–191 command, 335–337 418–422 running at least one combining elements with backward or forward command, 195–196 intersection searching, 411 SWITCH statement, command, 334–335 binary searching, 413 191–193 combining with union BLAST, 629 VB/RB, 598–599 command, 333–334 block searching, 412 Select command for deleting data, 331–332 indexes for, 416–418 databases, 617–618, 619 drawbacks, 341–342 informed or heuristic, selection sort algorithm, language features for, 330 409–410 396–397, 406–408 in Pascal/Delphi, 587 interpolation searching, self-documenting code, Seven Bridges of 414–416 277–278 Königsberg problem, search space for, 409 self-synchronizing stream 378–379 sequential search, ciphers, 450 SharpDevelop IDE 410–416 Sequence diagrams (Windows), 97 string searching, 423–433 (CASE), 119 Shell, Donald (algorithm uninformed or brute- sequences, 33–34 inventor), 398 force, 409–410 sequential search shell sort algorithm, secure computing algorithms 398–399, 406–408 coding securely, 640–641 backward or forward Shift Or algorithm, 427–428 overview, 639–640 searching, 411 show stopper bugs, 97 patching, 640 binary searching, 413 Silverlight RIA tool security by design, block searching, 412 (Microsoft), 665 641–642 Fibonacci searching, SIMULA language, 232 Secure Sockets Layer (SSL), 414–416 single inheritance, 240 454 interpolation searching, sliders, 299 security 414–416 slot machine hacking, 450 firewalls, 635, 636, 637 overview, 410 SNOBOL operators, 161 need for, 633–634 text search, 424–429 software as service model, secure computing, sequential text search 663–664 639–642 Boyer-Moore algorithm, software engineering stopping hackers, 637–639 425 CASE (Computer-Aided stopping malware, finite automaton Software Engineering), 634–636 algorithm, 428–429 115–122 51_108543-bindex.qxp 4/30/08 8:35 PM Page 691

Index 691

extreme programming speech recognition, comparison operators for, method, 112–114 650–651 172–174 goals, 108 spreadsheet programs, 659 concatenation operator, need for, 107–108 spyware, 636 166–167 pros and cons, 117, SQL (Structured Query initializing arrays for, 317 122–123 Language), 271, in Java/C#, 543 waterfall model, 108–112 620–621 in Pascal/Delphi, 577–578 sorting algorithms SSL (Secure Sockets regular expressions for, Big-O notation for, 407 Layer), 454 168–171 bubble sort, 394–396 stacks storage requirements for, comparison of, 406–408 adding data, 362–363 150 factors to consider, in C#, 556 in variant data type, 326, 393–394 counting and searching, 595 heap sort, 399–403 365 in VB/RB, 592 in-place, 394 declaring variables strong coupling, 135–136 insertion sort, 397–398 for, 362 strongly-typed languages. merge sort, 403–404 deleting data, 363–364 See type-safe languages online versus offline, 394 overview, 361–362 structured programming overview, 393–394 standalone editors, 95 branches in, 34–35 quick sort, 405–406 statements, 128. See also combining with other recursion in, 394 branching statements; methodologies, 48 selection sort, 396–397 looping statements loops in, 35 shell sort, 398–399 steganography, 456 need for, 32 Soundex algorithm, 431–433 stepping through code object-oriented source code breakpoints for, 98–99 programming versus, commenting out, 284–285 overview, 97–98 44–47 comments, 278–285 stepping out, 100 Pascal designed for, 37 compilers or assemblers stepping over, 99 reusability issues, 46–47 for, 21–22 stream ciphers, 449–450 sequences in, 33–34 defined, 20 string searching algorithms top-down programming, disassemblers for, 83, bioinformatics, 423 35–37 105–106 Boyer-Moore, 425 Structured Query Language formatting automatically, finite automaton, 428–429 (SQL), 271, 620–621 120–121 performance, 433 structures generating automatically, phonetically, 431–433 arrays with, 314, 323–325 119–120 Rabin-Karp, 426 in C#, 554 interpreters for, 22–23 regular expressions for, in C/C++, 536 obfuscators for, 106 429–431 defined, 311–312, 536 self-documenting, 277–278 sequential text search, as records in some source code formatters, 424–429 languages, 311 120–121 Shift Or, 427–428 retrieving data from, 313 source-level debuggers, 98 Soundex, 431–433 speed and efficiency spaces, initializing arrays strings issues, 328 with, 317 in C/C++, 526 storing data in, 312–313 spaghetti programming, common functions in Visual Basic, 603 31–32, 33 (table), 167 style classes (CSS), 479–480 specifications, defined, 109 51_108543-bindex.qxp 4/30/08 8:35 PM Page 692

692 Beginning Programming All-in-One Desk Reference For Dummies

stylesheets. See CSS storing in separate files, synchronous stream (cascading stylesheets) 36–37, 131, 133–135 ciphers, 450 subprograms. See also storing values in name, systems programming functions 225–227 languages, 73–74, 668 for bioinformatics, 632 tight versus loose calling, 217–218 coupling, 135–136 comments documenting, in top-down programming, T 283–284 35–36 tab-delimited text files, creating in Pascal/Delphi, uses for, 133–135, 213–215 260–261 584 variable scope isolation tables (HTML) creating in VB/RB, in, 157–158 captions, 474, 475 601–602 window files (VB/RB), creating, 471–472 creating (overview), 590–591 header and footer, 216–217 substitution box 474–475 in curly bracket algorithms, 447–448 headings, 472–473 languages, 218–219 substitution ciphers, rows and data, 473–474 grouped by encapsulation, 445–446 tabs (user interface), 302 237 sub-trees teaching languages #include command for, defined, 387 Alice, 60–61 218–219 grafting, 388, 390 BASIC as, 52–55 libraries of, 133 pruning, 387–388, 389 “battling robot” limitations and problems, Sun Microsystems. See also programming games, 135–136, 231, 235–236, Java 61–62 238–239 Java compiler and VM goal of, 52 methods as, 234 from, 26 KPL (Kid’s Programming module files for (VB/RB), Java development by, 541 Language), 59–60 591 SWITCH statements. See Lego Mindstorms NXT-G, for multiple languages in also case statements 61, 666 one program, 134–135 break command with, Logo, 55–57 naming, 216 192–193, 503 Pascal as, 57–58 need for, 131 C/C++, 532–533 proprietary, 58–62 objects compared to, general rule for, 196–197 technical design 136–137, 232–233 IF-THEN statements documents, 286 parameter passing, versus, 196–197 Technical Stuff icon, 4 158–159, 219–227 Java/C#, 549–551 text boxes, 296–297 private versus public, JavaScript, 491–492 text files 234–235 matching multiple values, comma-delimited, 260–261 protected by 194 cookies as, 264 encapsulation, 238 overview, 191–192 creating, 261–262 repeating with recursion, PHP, 503–504 defined, 259 227–229 SELECT CASE statement overview, 259 rewriting using versus, 195 random-access files polymorphism, 256–258 symmetric (private-key) versus, 264 stored in objects, running, encryption, 452–453 reading, 263 252–253 RTF, 261 51_108543-bindex.qxp 4/30/08 8:35 PM Page 693

Index 693

source code as, 264 minimum needed, 106 traversing (searching), tab-delimited, 260–261 profilers, 102–103 382, 383, 384, 385–386 uses for, 276 third-party components, unordered, 381 text (HTML) 102 uses for, 388–389 aligning, 466 for user interfaces, 139, Trojan horses, 636 body, 464–465 140 True BASIC, 52 colors, 467–468 variety available, 83 tuples comments, 469 top-down programming, database, 616 emphasizing, 467 35–37 Python, 571 font size, 468 topological graph theory, Turbo compilers (Borland), headings, 465 380 25 line breaks, 464–465 tracing code. See stepping Turing, Alan titles, 464 through code (mathematician), 643 text searching. See string training, desire versus, Turing Test, 643 searching algorithms 17–18 typeless versus type-safe TextWrangler editor Traveling Salesman languages, 74–75, (Mac), 19 problem, 380 178–179 ThinkFree Microsoft Office traversal of trees type-safe languages clone, 663 B+ trees, 384 advantages and third-party components, binary trees, 383 disadvantages, 67, 68 102, 273–275 B-trees, 384 C# as, 68 Three Cottage problem, 380 defined, 385 converting data types, tight coupling, 135–136 in-order, 385–386 179–180 Tip icon, 4 level order, 386 as strongly-typed, 74 titles (HTML), 464 ordered trees, 382 typeless languages toolbars and toolboxes, postorder, 386 versus, 74–75, 178–179 294–296 preorder, 385 tools trees CASE, 115 adding data, 386, 387 U choosing a compiler, B+ trees, 384 UML (Unified Modeling 84–90 binary, 382–383 Language) choosing an interpreter, B-trees, 383–384 dynamic model, 119 90–92 deleting data, 386–387 functional model, 117, 118 compiling to a virtual grafting sub-trees, 388, generating code machine, 93–94 390 automatically, 119–120 database toolkits, 273–275 heap sort algorithm using, object model, 117–119 debuggers, 97–101 399–402 overview, 116–117 disassemblers, 105–106 internal nodes, 380 problems encountered, documentation, 286–287 leaf nodes, 380 116, 117 editors, 19–20, 94–97 ordered, 381–382 unclustered indexes, efficiency improved by, overview, 380–381 417–418 29–30 pruning sub-trees, undirected graphs, 377–378 help file creators, 83, 387–388, 389 Unicode character 103–104, 288 root node, 380 codes, 423 installer programs, sub-trees, defined, 387 104–105 51_108543-bindex.qxp 4/30/08 8:35 PM Page 694

694 Beginning Programming All-in-One Desk Reference For Dummies

uninformed searching getting data from users, loop variable, 201–206 algorithms. See brute- 296–299 modifying a variable by force searching JavaScript for designing, itself, 152 algorithms 494–496 module, 156–157 Universal Binary files libraries of subprograms passing data among (Mac), 21 for, 139, 293 subprograms, 158–159 UNIX, 18. See also Linux list boxes, 298 retrieving data from, unordered trees, 381 menus, 290–291, 294, 295 151–152 UNTIL loops (Ruby), 516 organizing, 301–302 scope, 154–159 untyped files overview, 138–139 in subprograms, 157–159 overview, 268 purpose of, 289 watching with debugger, proprietary formats, 271 RAD tools for, 139, 140, 100–101 reading, 269–271 293 variant data type, 326, 595 uses for, 276 radio buttons, 297 VB. See Visual Basic writing, 268–269 sliders, 299 VBA (Visual Basic for uppercase. See tabs, 302 Applications), 75 capitalization text boxes, 296–297 VBR (variable bit rate), 444 Use Case diagrams (CASE), toolbars, 294–295 version control programs, 117, 118 toolboxes, 295–296 121–122 user interface transparent to user, 293 video games, 645 advantages for users, 38, writing event handlers, video tutorials, 286 292–293 42–43 editor, 95 functions of, 293 writing from scratch, 293 virtual machines (VMs) buttons, 294 user manuals, 286 compiling to, 93–94 challenges for user-defined data types, for cross-platform programmers, 39 265, 312 programming, 662–663 check boxes, 297–298 utilities. See tools Java, 66 combo boxes, 298–299 for p-code, 23 command-line, 290 speed issues, 94 creating, 139–140 V viruses, 634 customizing, 40–42 variable bit rate (VBR), 444 Visual Basic. See also BASIC defined, 39 variables. See also data (Beginner’s All-purpose design tips for, 302–307 types; declaring Symbolic Instruction designers with IDEs, 96 variables Code) designing visually, 39–40, assigning value of one to branching statements, 41, 42 another, 152 597–599 dialog boxes, 300–301 assigning values to, class files, 591 displaying commands to 150–151, 162 collections in, 346–351 users, 293–296 data overwritten by new comments, 592 displaying information to values, 151 constants, 595–596 users, 300–301 defined, 142, 152 creating functions and before event-driven enumerated (C/C++), subprograms, 601–602 programming, 39 536–537 data structures, 603–604 event-driven programming global, 154–155 database programming for, 38–43 initializing before looping, features, 80 evolution of, 290–293 207, 209 declaring variables, 147, of expert systems, 646 limitations, 311 592–595 51_108543-bindex.qxp 4/30/08 8:35 PM Page 695

Index 695

as event-driven Web resources. See Internet .NET framework, 68–69 programming resources Notepad editor with, 19 language, 40 weighted graphs, 377–378 running on Mac OS X, 19 looping statements, WHILE loops worms, 635 600–601 C/C++, 534 writing files module files, 591 counting, 208 random-access, 266–267 .NET compatibility, 68 endless, 207 text, 261–262 objects, 605 initializing the variable, untyped, 268–269 operators, 596–597 207 p-code used by, 77 Java/C#, 551–552 portability issues, 589 JavaScript, 492 X program structure, nested, 209–211 xBASE languages, 79 590–591 overview, 206–208 Xcode compiler, 25, 84, 85 queues in, 366–370 Pascal/Delphi, 583 Xor operator, 177–178. See REALbasic versus, Perl/Python, 568 also logical/Boolean 667–668 PHP, 505 operators stacks in, 362, 363–365 reading text files XP (extreme programming), for standalone using, 263 112–114 applications, 77 reading untyped files Web site, 589 using, 269–270 window files, 590–591 Ruby, 516 Z Visual Basic for wildcards for pattern Applications (VBZ), 75 matching, 168–171 zero (0) VMs. See virtual machines window files (VB/RB), initializing arrays, 317 590–591 zero-based arrays, windows in user interface 315–316 W (JavaScript), 496 Warning! icon, 4 Windows (Microsoft) watching variables, 100–101 compilers, 24–25, 89 waterfall model, 108–112 as largest market, 22 weak coupling, 135–136, as largest market for 137–138 programs, 18 51_108543-bindex.qxp 4/30/08 8:35 PM Page 696

696 Beginning Programming All-in-One Desk Reference For Dummies