- •About the Author
- •Dedication
- •Author’s Acknowledgments
- •Contents at a Glance
- •Table of Contents
- •Introduction
- •Who Should Buy This Book
- •How This Book Is Organized
- •Part I: Programming a Computer
- •Part II: Learning Programming with Liberty BASIC
- •Part III: Advanced Programming with Liberty BASIC
- •Part VI: Internet Programming
- •Part VII: The Part of Tens
- •How to Use This Book
- •Foolish assumptions
- •Icons used in this book
- •Why Learn Computer Programming?
- •How Does a Computer Program Work?
- •What Do I Need to Know to Program a Computer?
- •The joy of assembly language
- •C: The portable assembler
- •High-level programming languages
- •Database programming languages
- •Scripting programming languages
- •The program’s users
- •The target computer
- •Prototyping
- •Choosing a programming language
- •Defining how the program should work
- •The Life Cycle of a Typical Program
- •The development cycle
- •The maintenance cycle
- •The upgrade cycle
- •Writing Programs in an Editor
- •Using a Compiler or an Interpreter
- •Compilers
- •Interpreters
- •P-code: A combination compiler and interpreter
- •So what do I use?
- •Squashing Bugs with a Debugger
- •Writing a Help File
- •Creating an Installation Program
- •Why Learn Liberty BASIC?
- •Liberty BASIC is easy
- •Liberty BASIC runs on Windows
- •You can start using Liberty BASIC today
- •Installing Liberty BASIC
- •Loading Liberty BASIC
- •Your First Liberty BASIC Program
- •Running a Liberty BASIC program
- •Saving a Liberty BASIC program
- •Getting Help Using Liberty BASIC
- •Exiting Liberty BASIC
- •Getting input
- •Displaying output
- •Sending Data to the Printer
- •Storing Data in Variables
- •Creating a variable
- •Assigning a value to a variable
- •Declaring your variables
- •Using Constants
- •Commenting Your Code
- •Using variables
- •Working with precedence
- •Using parentheses
- •Manipulating Strings
- •Declaring variables as strings
- •Smashing strings together
- •Counting the length of a string
- •Playing with UPPERCASE and lowercase
- •Trimming the front and back of a string
- •Inserting spaces
- •Yanking characters out of a string
- •Looking for a string inside another string
- •Using Boolean Expressions
- •Using variables in Boolean expressions
- •Using Boolean operators
- •Exploring IF THEN Statements
- •IF THEN ELSE statements
- •Working with SELECT CASE Statements
- •Checking a range of values
- •Checking a relational operator
- •Boolean expression inside the loop
- •Looping a Fixed Number of Times
- •Counting with different numbers
- •Counting in increments
- •Anatomy of a Computer Bug
- •Syntax Errors
- •Fun with Logic Errors
- •Stepping line by line
- •Tracing through your program
- •Designing a Window
- •Creating a new window
- •Defining the size and location of a window
- •Adding color to a window
- •Putting Controls in a Window
- •Creating a command button
- •Displaying text
- •Creating a check box
- •Creating a radio button
- •Creating text boxes
- •Creating list boxes
- •Creating combo boxes
- •Creating group boxes
- •Storing Stuff in Text Files
- •Creating a new text file
- •Putting stuff in a text file
- •Adding new stuff to an existing text file
- •Retrieving data from a text file
- •Creating a new binary file
- •Saving stuff in a binary file
- •Changing stuff in a binary file
- •Retrieving stuff from a binary file
- •Creating a Graphics Control
- •Using Turtle Graphics
- •Defining line thickness
- •Defining line colors
- •Drawing Circles
- •Drawing Boxes
- •Displaying Text
- •Making Sounds
- •Making a beeping noise
- •Playing WAV files
- •Passing Data by Value or by Reference
- •Using Functions
- •Defining a function
- •Passing data to a function
- •Calling a function
- •Exiting prematurely from a function
- •Using Subroutines
- •Defining a subroutine
- •Passing data to a subroutine
- •Calling a subroutine
- •Exiting prematurely from a subroutine
- •Writing Modular Programs
- •Introducing Structured Programming
- •Sequential instructions
- •Branching instructions
- •Looping instructions
- •Putting structured programming into practice
- •The Problem with Software
- •Ways to Make Programming Easier
- •Breaking Programs into Objects
- •How to use objects
- •How to create an object
- •Creating an object
- •Starting with a Pointer
- •Defining the parts of a linked list
- •Creating a linked list
- •Managing a linked list
- •Making Data Structures with Linked Lists
- •Stacks
- •Queues
- •Trees
- •Graphs
- •Creating a Record
- •Manipulating Data in Records
- •Storing data in a record
- •Retrieving data from a record
- •Using Records with Arrays
- •Making an Array
- •Making a Multidimensional Array
- •Creating Dynamic Arrays
- •Insertion Sort
- •Bubble Sort
- •Shell Sort
- •Quicksort
- •Sorting Algorithms
- •Searching Sequentially
- •Performing a Binary Search
- •Hashing
- •Searching by using a hash function
- •Dealing with collisions
- •Picking a Searching Algorithm
- •Choosing the Right Data Structure
- •Choosing the Right Algorithm
- •Put the condition most likely to be false first
- •Put the condition most likely to be true first
- •Clean out your loops
- •Use the correct data types
- •Using a Faster Language
- •Optimizing Your Compiler
- •Programming Computer Games
- •Creating Computer Animation
- •Making (And Breaking) Encryption
- •Internet Programming
- •Fighting Computer Viruses and Worms
- •Hacking for Hire
- •Participating in an Open-Source Project
- •Niche-Market Programming
- •Teaching Others about Computers
- •Selling Your Own Software
- •Trying Commercial Compilers
- •Windows programming
- •Macintosh and Palm OS programming
- •Linux programming
- •Testing the Shareware and
- •BASIC compilers
- •C/C++ and Java compilers
- •Pascal compilers
- •Using a Proprietary Language
- •HyperCard
- •Revolution
- •PowerBuilder
- •Shopping by Mail Order
- •Getting Your Hands on Source Code
- •Joining a Local User Group
- •Frequenting Usenet Newsgroups
- •Playing Core War
- •Programming a Battling Robot
- •Toying with Lego Mindstorms
- •Index
- •End-User License Agreement
378 Part VII: The Part of Tens
Pascal compiler) for personal use. Just visit www.borland.com to grab your free copy and start programming your Windows or Linux computer in Pascal today.
Oddball language compilers and interpreters
Not everyone likes the idea of following the pack and learning traditional languages such as C/C++ or BASIC. For you rebels out there, consider some of the oddball free language compilers or interpreters that give you a chance to play with some obscure programming languages.
Prolog has gained a loyal following as one of the more popular languages with which to learn about artificial intelligence. If you want to understand all the excitement about artificial intelligence languages in general, and Prolog in particular, download a free copy of Strawberry Prolog from www.dobrev.com, which runs on Both Windows and Linux. For another free Prolog compiler for Windows, download a copy of Visual Prolog from www.visual-prolog.com.
Back in the early 1980s, the Department of Defense tried to force the Ada programming language into full-scale use for all military projects. Unfortunately for the Pentagon, by the time Ada compilers were available, most of the rest of the world had already switched to C/C++ and left Ada behind. Still, Ada has its supporters, and if you want to experiment with a language that tried to become the best programming language in the world, grab a copy of GNAT Ada from ftp://cs.nyu.edu/pub/gnat.
Although BASIC was designed to teach beginners how to program computers, another language, LOGO, was specifically designed to teach kids how to program computers. If you want to program Windows by using the LOGO language, get a free copy of MSW Logo from Softronics (at www.softronix.com).
Using a Proprietary Language
A wide variety of books, magazines, newsletters, source code, and users around the world can provide help and advice for solving specific problems with programming languages such as C/C++ and Java. Unfortunately, popular programming languages are designed to solve a wide variety of different problems, which means that they usually can’t solve any single problem quickly and easily.
Chapter 27: Ten Additional Programming Resources 379
As an alternative to popular programming languages, consider using a proprietary programming language. A single company usually develops proprietary programming languages to perform a specific type of task, such as creating multimedia presentations or artificially intelligent programs. Proprietary programming languages have the following advantages:
Proprietary languages are generally easier to learn than popular languages.
Proprietary language programs are often smaller and faster to create because the languages are designed to perform a specific task.
Although proprietary programming languages can prove easier to learn and enable you to create fancy applications with a minimum amount of programming, they have their own disadvantages, as I describe in the following list, which may make you wary of using them for critical projects:
You don’t find as much third-party support (such as books or magazines) for proprietary languages as you do for popular languages.
Proprietary languages may run on only certain operating systems (meaning that porting the program to another operating system may prove virtually impossible).
You’re dependent on a single company for support. If the company that makes your proprietary language goes out of business, your program may prove difficult or next to impossible to update.
Buying a proprietary language may prove extremely expensive compared to buying general-purpose language compilers.
Proprietary language programs often run slower than programs that you create in a general-purpose language.
HyperCard
One of the most famous (and ultimately most ignored) proprietary programming languages comes from Apple Computer’s HyperCard program. HyperCard was originally designed to enable nonprogrammers to write programs by using an index card metaphor.
An entire HyperCard program is meant to resemble a stack of index cards, with one card at a time appearing on-screen. Text and pictures appear on each card, and cards can provide hyperlinks to other cards. By using a simplified programming language known as HyperTalk, you can write programs to make your HyperCard stack calculate results or display information.