You are previewing Beginning Programming in 24 Hours, Sams Teach Yourself, Third Edition.
O'Reilly logo
Beginning Programming in 24 Hours, Sams Teach Yourself, Third Edition

Book Description

If you want to learn computer programming but don’t know which language to start with, this is the book for you! In just 24 lessons of one hour or less, any beginner can get a solid introduction to the basics of computer programming and learn to write simple programs for any platform—Windows, Mac, and mobile.

Using a straightforward, step-by-step approach, each lesson in this carefully crafted tutorial builds upon the previous one, allowing you to learn all the essentials of programming from the ground up.

Once you’ve mastered these fundamentals, the book introduces you to several of the most popular computer programming languages today and helps you decide which language to learn first.

  • Step-by-step instructions carefully walk you through the most common programming tasks.

  • Practical, hands-on examples show you how to apply what you learn to create your own programs

  • Quizzes and exercises at the end of each lesson help you test your knowledge and stretch your skills

Learn how to…

  • Set up your programming toolkit with widely available free downloads

  • Create simple programs in JavaScript that get user input and display output

  • Process numbers and words

  • Use variables to hold information

  • Merge strings together

  • Tell programs how to make decisions

  • Create algorithms to count data values and accumulate totals

  • Use JavaScript to create interactive web pages

  • Improve a user’s experience with cookies

  • Debug your programs before going live

  • Structure programs for readability

  • Apply your programming skills to more advanced languages like Java

  • Use object-oriented programming techniques

  • Choose between other popular languages like C and C++, HTML5 and CSS3, Visual Basic and .NET, and PHP

  • Distribute and sell your programs

Table of Contents

  1. About This eBook
  2. Title Page
  3. Copyright Page
  4. Contents at a Glance
  5. Table of Contents
  6. About the Authors
  7. Dedication
  8. Acknowledgments
  9. We Want to Hear from You!
  10. Reader Services
  11. Introduction
    1. Who Should Use This Book?
    2. What This Book Will Do for You
    3. Can This Book Really Teach Programming in 24 Hours?
    4. Conventions Used in This Book
  12. Part I: Start Programming Today
    1. Hour 1. Hands-On Programming
      1. Get Ready to Program
      2. What a Computer Program Does
      3. Common Programming Misconceptions
      4. Many Programs Already Exist
      5. Programmers Are in Demand
      6. The Real Value of Programs
      7. Users Generally Don’t Own Programs
      8. Giving Computers Programs
      9. Your First Program
      10. Clarifying Comments
      11. Entering Your Own Program
      12. Summary
      13. Q&A
      14. Workshop
    2. Hour 2. Process and Techniques
      1. Understanding the Need for Programs
      2. Programs, Programs, Everywhere
      3. Programs as Directions
      4. Summary
      5. Q&A
      6. Workshop
    3. Hour 3. Designing a Program
      1. The Need for Design
      2. User-Programmer Agreement
      3. Steps to Design
      4. Summary
      5. Q&A
      6. Workshop
    4. Hour 4. Getting Input and Displaying Output
      1. Printing to the Screen with JavaScript
      2. Storing Data
      3. Assigning Values
      4. Getting Keyboard Data with Prompt
      5. Summary
      6. Q&A
      7. Workshop
    5. Hour 5. Data Processing with Numbers and Words
      1. Strings Revisited
      2. Performing Math with JavaScript
      3. How Computers Really Do Math
      4. Using the ASCII Table
      5. Overview of Methods
      6. Summary
      7. Q&A
      8. Workshop
    6. Hour 6. Controlling Your Programs
      1. Comparing Data with if
      2. Writing the Relational Test
      3. Looping Statements
      4. Summary
      5. Q&A
      6. Workshop
    7. Hour 7. Debugging Tools
      1. The First Bug
      2. Accuracy Is Everything
      3. Write Clear Programs
      4. Practice Debugging with JavaScript
      5. JavaScript’s Console Log
      6. Additional Debugging Techniques
      7. Summary
      8. Q&A
      9. Workshop
  13. Part II: Programming Fundamentals
    1. Hour 8. Structured Techniques
      1. Structured Programming
      2. Packaging Your JavaScript Code into Functions
      3. Testing the Program
      4. Profiling Code
      5. Getting Back to Programming
      6. Summary
      7. Q&A
      8. Workshop
    2. Hour 9. Programming Algorithms
      1. Counters and Accumulators
      2. Array Variables
      3. Accumulators for Total
      4. Swapping Values
      5. Sorting
      6. Searching Arrays
      7. Taking Functions Further
      8. Nested Loops
      9. Summary
      10. Q&A
      11. Workshop
    3. Hour 10. Having Fun with Programming
      1. Rotating Images on a Page
      2. Capturing the Position of the Mouse
      3. Adding a Repeating News Ticker to Your Website
      4. Summary
      5. Q&A
      6. Workshop
    4. Hour 11. Advanced Programming
      1. JavaScript’s Programming Weakness
      2. Writing Cookies
      3. Reading Cookies
      4. Deleting Set Cookies
      5. Summary
      6. Q&A
      7. Workshop
  14. Part III: Object-Oriented Programming with Java
    1. Hour 12. Programming with Java
      1. Introducing Java
      2. Java Provides Executable Content
      3. Seamless Execution
      4. Multi-Platform Executable Content
      5. Java Usage Summary
      6. You’ll Start with Standalone Java
      7. Java’s Interface
      8. Security Issues
      9. Give Java a Spin
      10. Java Language Specifics
      11. Get Ready to Begin
      12. Summary
      13. Q&A
      14. Workshop
    2. Hour 13. Java’s Details
      1. Defining Java Data
      2. Operators
      3. Programming Control
      4. From Details to High-Level
      5. Summary
      6. Q&A
      7. Workshop
    3. Hour 14. Java Has Class
      1. Using NetBeans to Run a Java Program
      2. Going GUI
      3. Java and OOP
      4. Overview of Classes
      5. Do You Understand OOP?
      6. Methods Do the Work in Classes
      7. Summary
      8. Q&A
      9. Workshop
    4. Hour 15. Applets and Web Pages
      1. About Writing Java Applets
      2. Creating a Java Applet
      3. Placing the Applet Inside the Web Page
      4. Viewing the Applet Inside the Web Page
      5. Summary
      6. Q&A
      7. Workshop
  15. Part IV: Other Programming Languages
    1. Hour 16. HTML5 and CSS3
      1. HTML Programming
      2. A Simpler Example
      3. A Quick HTML Primer
      4. Using CSS to Control How Your Text Looks
      5. Including Graphics in Your Website with HTML
      6. Summary
      7. Q&A
      8. Workshop
    2. Hour 17. JavaScript and AJAX
      1. Introducing AJAX
      2. Using XMLHttpRequest
      3. Creating a Simple AJAX Library
      4. Creating an AJAX Quiz Using the Library
      5. Summary
      6. Q&A
      7. Workshop
    3. Hour 18. Scripting with PHP
      1. What You Need for PHP Programming
      2. Basic Structures in PHP Scripts
      3. Looping
      4. The Building Blocks of PHP: Variables, Data Types, and Operators
      5. Using and Creating Functions in PHP
      6. Working with Objects in PHP
      7. Common Uses of PHP
      8. Summary
      9. Q&A
      10. Workshop
    4. Hour 19. Programming with C and C++
      1. Introducing C
      2. What You Need for C and C++ Programming
      3. Looking at C
      4. C Data
      5. C Functions
      6. C Operators
      7. C Control Statements Mimic JavaScript
      8. Learning C++
      9. Object Terminology
      10. Fundamental Differences Between C and C++
      11. Introducing C++ Objects
      12. Things to Come
      13. Summary
      14. Q&A
      15. Workshop
    5. Hour 20. Programming with Visual Basic 2012
      1. Reviewing the Visual Basic Screen
      2. Creating a Simple Application from Scratch
      3. Other Visual Basic Programming Considerations
      4. Your Next Step
      5. Summary
      6. Q&A
      7. Workshop
    6. Hour 21. C# and the .NET Framework
      1. Understanding the Purpose of .NET
      2. The Common Language Runtime
      3. The Framework Class Library
      4. Parallel Computing Platform
      5. Dynamic Language Runtime
      6. The C# Language
      7. Summary
      8. Q&A
      9. Workshop
  16. Part V: The Business of Programming
    1. Hour 22. How Companies Program
      1. Data Processing and Information Technology Departments
      2. Computer-Related Jobs
      3. Job Titles
      4. Structured Walkthroughs
      5. Putting a Program into Production
      6. Consulting
      7. Summary
      8. Q&A
      9. Workshop
    2. Hour 23. Distributing Applications
      1. Issues Surrounding Software Distribution
      2. Using Version Control
      3. Summary
      4. Q&A
      5. Workshop
    3. Hour 24. The Future of Programming
      1. Some Helpful Tools
      2. Will Programming Go Away?
      3. Your Ongoing Training Needs
      4. Summary
      5. Q&A
      6. Workshop
  17. Index
  18. Appendix A. Glossary
  19. Appendix B. Using the NetBeans Integrated Development Environment
    1. Installing NetBeans
    2. Creating a New Project
    3. Creating a New Java Class
    4. Running the Application
    5. Fixing Errors