Learning to Program

Book description

Everyonecan benefit from basic programming skills–and after you start, you just might want to go a whole lot further.

Author Steven Foote taught himself to program, figuring out the best ways to overcome every obstacle. Now a professional web developer, he’ll help you follow in his footsteps. He teaches concepts you can use with any modern programming language, whether you want to program computers, smartphones, tablets, or even robots.

Learning to Program will help you build a solid foundation in programming that can prepare you to achieve just about any programming goal. Whether you want to become a professional software programmer, or you want to learn how to more effectively communicate with programmers, or you are just curious about how programming works, this book is a great first step in helping to get you there.

Learning to Program will help you get started even if you aren’t sure where to begin.

•  Learn how to simplify and automate many programming tasks

•  Handle different types of data in your programs

•  Use regular expressions to find and work with patterns

•  Write programs that can decide what to do, and when to do it

•  Use functions to write clean, well-organized code

•  Create programs others can easily understand and improve

•  Test and debug software to make it reliable

•  Work as part of a programming team

•  Learn the next steps to take to build a lifetime of programming skills

Table of contents

  1. About This eBook
  2. Title Page
  3. Copyright Page
  4. Dedication Page
  5. Contents at a Glance
  6. Table of Contents
  7. Acknowledgments
  8. About the Author
  9. We Want to Hear from You!
  10. Reader Services
  11. Introduction: Why I Wrote This Book
    1. Why You Should Read This Book
    2. Your Project
  12. 1. “Hello, World!” Writing Your First Program
    1. Choose a Text Editor
      1. Core Features
    2. Making Your Choice
      1. Sublime Text
      2. TextMate
      3. Notepad++
      4. Gedit
      5. Vim
      6. Eclipse
      7. IntelliJ
      8. Xcode
      9. Visual Studio
    3. Create a Project Directory
    4. Start Small: Create a Test File
      1. How HTML and JavaScript Work Together in a Browser
      2. The Value of Small Changes
    5. Build on Your Success
      1. Reference Your JavaScript in manifest.json
      2. Let It Run!
    6. Great Power, Great Responsibility
    7. Summing Up
  13. 2. How Software Works
    1. What Is “Software”?
    2. Software Life Cycle
    3. Source Code—Where It All Starts
      1. A Set of Instructions
      2. Programming Languages
      3. From Source Code to 0’s and 1’s
      4. Compiled vs. Interpreted Languages: When Does the Source Code Become Binary?
      5. Runtime Environment
      6. Execution by the Processor
    4. Input and Output
      1. Making Software Useful (and Reusable) with Input
      2. Where Does the Input Come From?
      3. How the Software Gets the Input
      4. Types of Output
      5. GIGO: Garbage In, Garbage Out
      6. State
      7. Add State to Kittenbook
    5. Memory and Variables
      1. Variables
      2. Variable Storage
      3. A Finite Resource
      4. Memory Leaks
    6. Summing Up
  14. 3. Getting to Know Your Computer
    1. Your Computer Is Stupid
    2. Your Computer Is Magic
      1. Standing on the Shoulders of Giants
    3. Computer Guts
      1. Processor
      2. Short-Term Memory
      3. Long-Term Memory
    4. Using Your Computer
      1. The File System
      2. The Command Line: Take Control
    5. Summing Up
  15. 4. Build Tools
    1. Automate (Almost) Everything
      1. Install Node
      2. Install Grunt
      3. Software That Helps You Create Software
      4. Avoid Mistakes
      5. Work Faster
    2. Tasks to Automate
      1. Compile
      2. Test
      3. Package
      4. Deploy
    3. Build Your Own Build
      1. Gruntfile.js
      2. Use Grunt Plug-ins
      3. Load Grunt Plug-ins
      4. Register Tasks
    4. Watch This!
    5. Summing Up
  16. 5. Data (Types), Data (Structures), Data(bases)
    1. Data Types
      1. Why Different Data Types Exist
      2. Primitive Data Types
      3. Composite Data Types
      4. Dynamically and Statically Typed Languages
    2. Data Structures
      1. Set
      2. Stack
      3. Tree
      4. Graph
      5. How to Choose an Effective Data Structure
    3. Databases
      1. Long-Term (Persistent) Storage
      2. Relational Databases
      3. A Brief Introduction to SQL
    4. Summing Up
  17. 6. Regular Expressions
    1. Ctrl+F on Steroids: Looking for Patterns
    2. Using Regular Expressions in JavaScript
    3. Repetition
      1. ?
      2. +
      3. *
      4. Special Characters and Escaping
      5. {1,10}: Make Your Own Super Powers
      6. Match Anything, Period
      7. Don’t Be Greedy
    4. Understanding Brackets from [A-Za-z]
      1. Lists of Characters
      2. Ranges
      3. Negation
    5. A Pattern for Phone Numbers
    6. I Need My \s
      1. Shortcuts for Brackets
      2. Limitations
      3. Capture the Tag
      4. Advanced Find and Replace
      5. The Beginning and the End (of a Line)
    7. Flags
      1. Global
      2. Ignore Case
      3. Multiline
    8. When Will You Ever Use Regex?
      1. grep
      2. Code Refactoring
      3. Validation
      4. Data Extraction
    9. Summing Up
  18. 7. if, for, while, and When
    1. Operators
      1. Comparison Operators
      2. Logical Operators
      3. Unary Operators
      4. Binary Operators
      5. Ternary Operators
      6. “Truthy” and “Falsy”
      7. “Syntactic Sugar”
      8. Looping Through an Array
      9. Looping Through Images
      10. Nested Loops
      11. You Need a Break
      12. Infinite Loops
      13. Take Another Break
      14. When You Don’t Know When to Stop
    2. When
      1. Events
      2. Listeners
      3. Cron Jobs
      4. Timeouts
      5. Catch When Things Go Wrong
      6. Writing Robust Code
    3. Summing Up
  19. 8. Functions and Methods
    1. Function Structure
      1. Definition
      2. Invocation
      3. Arguments
      4. Call Stack
    2. Code Encapsulation
      1. Do One Thing Well
      2. Divide and Conquer
      3. A Place for Everything and Everything in Its Place
    3. Code Reuse
      1. Solve the General Problem
      2. Do More with Less
      3. Don’t Repeat Yourself (DRY)
    4. Scope
      1. Global
      2. Local
      3. How Variable Lookups Happen
    5. Summing Up
  20. 9. Programming Standards
    1. Coding Conventions
      1. Setting Standards
      2. To Hack or Not to Hack
      3. Pay Now or Pay Later
      4. Writing Maintainable Code
    2. Code Formatting
      1. Keep It Consistent
      2. Whitespace
    3. It Doesn’t Happen on Its Own: Make Rules
    4. Using the Work of Others
      1. Build Faster
      2. Open Source Software
      3. Built by the Community
      4. When to Build It Yourself
    5. Best Practices
      1. Documentation
      2. Planning
      3. Testing
    6. Summing Up
  21. 10. Documentation
    1. Document Intentions
      1. Self-Documenting Code
      2. Don’t Document the Obvious
      3. The Danger of Outdated Documentation
      4. Find Bugs Using Documentation
    2. Document for Yourself
      1. How Good Is Your Memory?
      2. Document to Learn
      3. Documentation Beyond Comments
    3. Document for Others
      1. Document Your Decisions
      2. Document Your Resources
      3. Document to Teach
    4. Summing Up
  22. 11. Planning
    1. Think Before You Build
    2. Create a Specification
    3. Design an Architecture
      1. Draw Diagrams
      2. Try to Break Your System
    4. Iterative Planning
    5. Design for Extensibility
    6. What Are Your Priorities?
      1. User Experience
      2. Performance
      3. Security
      4. Scalability
      5. Deadlines
    7. The Balancing Act
      1. Identify and Create Constraints
      2. Know What You Can and Can’t Do
    8. Summing Up
  23. 12. Testing and Debugging
    1. Manual Testing
      1. Test As You Work
      2. Try Something Crazy
      3. Eat Your Own Dog Food
    2. Automated Testing
      1. Unit Tests
      2. Set Up Tests for Kittenbook
      3. Epic Fail!
      4. Spies Like Us (and We Like Spies)
    3. Integration Tests
      1. Catch Problems Early
    4. Debugging
      1. Errors
      2. Logs
      3. Breakpoints
      4. Inspecting, Watching, and the Console
      5. Stepping Through the Code
      6. Call Stack
      7. Find the Root Cause
      8. Code, Test, Debug, Repeat
    5. Summing Up
  24. 13. Learning to Fish: How to Acquire a Lifetime of Programming Knowledge
    1. How to Search
      1. Finding the Right Terms
      2. Working Backward
      3. Identifying Quality Resources
      4. Personal Blogs: Hidden Gems
    2. Where, When, and How to Ask Programming Questions
      1. Where
      2. When
      3. How
      4. Learn by Teaching
    3. Summing Up
  25. 14. Building Your Skills
    1. Make kittenbook Your Own
      1. Restyle Facebook
      2. Add New Functionality
      3. Share Your Version of Kittenbook
    2. Find Your Own Project
      1. Solve Your Own Problem
      2. Be Ambitious
      3. Get Help, Give Help
    3. Open Source Projects
      1. GitHub
      2. Finding a Project
      3. Different Ways to Contribute
      4. Create Your Own
    4. Free Online Education
      1. Project Euler
      2. Udacity
      3. Coursera
      4. codecademy
      5. Khan Academy
      6. Tutorials
    5. Paid Education
      1. Read a Book
      2. Udacity and Coursera
      3. Treehouse
    6. Summing Up
  26. 15. Advanced Topics
    1. Version Control
      1. Why Use Version Control?
      2. Working with a Team
      3. Subversion
      4. Git
    2. OOP (Object-Oriented Programming)
      1. Classes
      2. Inheritance
      3. Instances
    3. Design Patterns
      1. Pub Sub
      2. Mediator
      3. Singleton
    4. Summing Up
  27. Glossary
  28. Index
  29. Code Snippets

Product information

  • Title: Learning to Program
  • Author(s): Steven Foote
  • Release date: November 2014
  • Publisher(s): Addison-Wesley Professional
  • ISBN: 9780133795257