Beginning Programming All-in-One For Dummies
Реклама. ООО «ЛитРес», ИНН: 7719571260.
Оглавление
Wallace Wang. Beginning Programming All-in-One For Dummies
Beginning Programming All-in-One For Dummies® To view this book's Cheat Sheet, simply go to www.dummies.com and search for “Beginning Programming All-in-One For Dummies Cheat Sheet” in the Search box. Table of Contents
List of Tables
List of Illustrations
Guide
Pages
Introduction
About This Book
Foolish Assumptions
Icons Used in This Book
Beyond the Book
Where to Go from Here
Getting Started with Programming. Contents at a Glance
Getting Started Programming a Computer
How Computer Programming Works
Identifying the problem
THE FBI’S $170 MILLION FLOP
Defining the steps
The History of Computer Programming
Talking to a processor in machine language
Using assembly language as a shortcut to machine language
Hiding the details of a computer with a high-level language
Combining the best of both worlds with the C programming language
Weighing the pros and cons of programming languages
Figuring Out Programming
Desire beats technical training every time
Picking a computer and an operating system
Writing programs with an editor
Converting source code with an assembler or compiler
Translating source code with an interpreter
Combining a compiler with an interpreter to create p-code
Taking the time to understand
KNOWING HOW TO PROGRAM VERSUS KNOWING A PROGRAMMING LANGUAGE
Different Methods for Writing Programs
Spaghetti Programming
SPAGHETTI PROGRAMMING WITH THE GOTO COMMAND
Structured Programming
The three parts of structured programming
Top-down programming
STRUCTURED PROGRAMMING AND PASCAL
Event-Driven Programming
Designing a user interface
Writing event handlers
Writing your program
Object-Oriented Programming
Isolating data
Simplifying modifications
Using Protocol-Oriented Programming
Design Patterns
DESIGNING PROGRAMS WITH TODAY’S METHODOLOGY
Types of Programming Languages
Your First Language
BASICally disrespected
Visual programming with Scratch
Programming robots with LEGO Mindstorms
Learning object-oriented programming with Alice
Programming a killer robot
Curly-Bracket Languages
Learning programming with C
The power of C
The efficiency of C
The portability of C
Adding object-oriented programming with C++
Gaining true portability with Java
Programming more safely with C#
C# advantages
IT’S OBJECT-ORIENTED
IT’S TYPE-SAFE
THE PROS AND CONS OF TYPE-SAFE LANGUAGES
.NET compatibility
Choosing a curly-bracket language
Artificial Intelligence Languages
Scripting Languages
Automating a program
Customizing a program
Transferring data among multiple programs
Creating stand-alone programs
Database Programming Languages
Comparing Programming Languages
Programming Tools
Choosing a Compiler
Defining your needs for a compiler
Evaluating the technical features of a compiler
Supported language standards
Code generation and optimization
Target platforms
Cost
Finding an Interpreter
THE ADVANTAGES OF INTERPRETED LANGUAGES
Compiling to a Virtual Machine
Writing a Program with an Editor
Stand-alone editors
COMMON EDITOR FEATURES
Integrated development environments
Features
Free software
Fixing a Program with a Debugger
Stepping line-by-line
Breakpoints
Over and out
STEP OVER
STEP OUT
Watching variables
Saving Time with Third-Party Components
Optimizing a Program with a Profiler
Managing Source Code
Creating a Help File
Installing a Program
Dissecting Programs with a Disassembler
Programming Basics. Contents at a Glance
How Programs Work
THE TROLLEY PROBLEM
Using Keywords as Building Blocks
MORE VERSUS FEWER KEYWORDS
Organizing a Program
Dividing a Program into Subprograms
Dividing a Program into Objects
Creating a User Interface
PROGRAMMING IS ABOUT MAINTAINING EXISTING PROGRAMS
Variables, Data Types, and Constants
Declaring Variables
Variable naming conventions
Creating variables in a command
CAMEL-CASE NAMING
Declaring the data type of a variable
DECLARING VARIABLES
Using Different Data Types
TYPE INFERENCE
Storing Data in a Variable
OPTIONAL VARIABLES
Retrieving Data from a Variable
Using Constant Values
Defining the Scope of a Variable
Handling global variables with care
Restricting scope to a module
Isolating variables in a subprogram
Passing data among subprograms
Manipulating Data
Storing Data with the Assignment Operator
Using Math to Manipulate Numbers
Organizing equations with operator precedence
Using built-in math functions
Manipulating Strings
Finding Strings with Regular Expressions
Pattern-matching with the single character (.) wildcard
Pattern-matching for specific characters
Pattern-matching with the multiple-character (*) and plus (+) wildcards
Pattern-matching with ranges
Using Comparison Operators
Using Boolean Operators
Using the Not operator
Using the And operator
Using the Or operator
Using the Xor operator
Converting Data Types
Making Decisions by Branching
Picking One Choice with the IF-THEN Statement
Picking Two Choices with the IF-THEN-ELSE Statement
Picking Three or More Choices with the IF-THEN-ELSEIF Statement
Checking a condition for each set of commands
Offering three or more choices
Playing with Multiple Boolean Operators
Making Multiple Choices with the SELECT CASE Statement
USING THE SWITCH STATEMENT IN C AND SIMILAR LANGUAGES
Matching multiple values in a SELECT CASE statement
Checking a range of values
Comparing values
Repeating Commands by Looping
Looping a Fixed Number of Times with the FOR-NEXT Loop
Using a FOR-NEXT loop variable
Counting by a different range
Counting by different increments
Counting backward
Counting over arrays and other items
Looping Zero or More Times with the WHILE Loop
Looping at Least Once with the DO Loop
Playing with Nested Loops
Prematurely Exiting from a Loop
Checking Your Loops
Breaking a Large Program into Subprograms
Creating and Using Subprograms
Creating a subprogram
“Calling” a subprogram
Passing Parameters
Passing parameters by reference
Storing values in a subprogram name
Repeating a Subprogram with Recursion
Breaking a Large Program into Objects
How Object-Oriented Programming Works
Encapsulation Isolates Data and Subprograms
Shielding data inside an object
Grouping methods inside of an object
Protecting code from other programmers
Sharing Code with Inheritance
SINGLE VERSUS MULTIPLE INHERITANCE
Polymorphism: Modifying Code without Changing Its Name
Design Patterns
Object-Oriented Languages
Hybrid languages
Pure languages
Disadvantages of object-oriented programming
Real-Life Programming Examples
Defining an object with a class
Creating an object from a class
Running methods stored in an object
Inheriting an object
Using method overloading to rewrite an inherited subprogram
Reading and Saving Files
Storing Data in Text Files
THE “OTHER” UNIVERSAL FILE FORMAT
Creating a text file
Reading a text file
THE PORTABLE DOCUMENT FORMAT (PDF)
Storing Fixed-Size Data in Random-Access Files
Writing data
Reading data
Storing Varying-Size Data in Untyped Files
Writing data
Reading data
Using Database Files
Looking at the structure of a database
Connecting to a database
Documenting Your Program
Adding Comments to Source Code
Identifying the two types of comments
Line comments
Block comments
Describing code and algorithms
Documentation
Debugging
Writing Software Documentation
Documentation types
Design specifications
Technical design
VIDEO TUTORIALS
User manuals
Documentation tools
Agile documentation
Automation
Help files
Principles of User Interface Design
The Evolution of User Interfaces
Command-line interface
Menus
Graphical user interface
Elements of a User Interface
Displaying commands to a user interface
Giving data to the user interface
Restricting choices to one option with radio buttons
Restricting choices with check boxes
Displaying multiple choices in a list box or combo box
Restricting numeric choices with a slider
Showing information back to the user
Organizing a user interface
Designing a User Interface
Know the user
Hide/disable unusable options
Tolerate mistakes
Be consistent
Give the user freedom to customize the user interface
Make navigation easy
Debugging and Testing
Common Types of Programming Errors
RUBBER-DUCK DEBUGGING
Debugging with Comments and Print Statements
Breakpoints, Stepping, and Watching
Stepping through code
Watching variables
Testing Code
EVERY PROGRAM HAS BUGS
Unit tests
Integration tests
User interface testing
Data Structures. Contents at a Glance
Structures and Arrays
Using Structures
Storing data
Retrieving data
Using an Array
Defining the size
Bounds
DEFAULT BOUNDS
DEFINABLE BOUNDS
Initializing
LOOPS
DECLARATIONS
Storing data
Retrieving data
Working with Resizable Arrays
BASIC
C#
Swift
Working with Multidimensional Arrays
Creating a multidimensional array
Storing and retrieving data
Using Structures with Arrays
Drawbacks of Arrays
Data types
Searching and sorting
Adding and deleting
Identifying the location of data in an array
Sets and Linked Lists
Using Sets
Adding and deleting data in a set
Checking for membership
Avoiding duplicate data
Manipulating two sets
Combining two sets into a third set with the union command
Combining the common elements of two sets into a third set with the intersection command
Combining the different elements of two sets into a third set with the difference command
Using Linked Lists
Creating a linked list
Modifying a linked list
Creating a double linked list
Drawbacks of Sets and Linked Lists
Problems with pointers
Problems with accessing data
COMPLEXITY OF CREATING LINKED LISTS AND POINTERS
Collections and Dictionaries
Using a Collection
Adding data to a collection
Deleting data from a collection
Identifying data with keys
Searching and retrieving data
Index numbers
Keys
Using Dictionaries
Adding data to a dictionary
Searching and retrieving data from a dictionary
Understanding Hash Tables
Converting keys with a hash function
Hash function collisions
Solving collisions by chaining
Avoiding collisions with double hashing
Stacks, Queues, and Deques
Using Stacks
Adding data to a stack
Removing data from a stack
Counting and searching a stack
Using Queues
Adding data to a queue
Removing data from a queue
Counting and searching a queue
Using Deques
Graphs and Trees
Understanding Graphs
Types of graphs
Uses for graphs
Designing a single path with the Seven Bridges of Königsberg
Finding the shortest path through a graph
Connecting nodes in a graph
Creating Trees
Ordered trees
Binary trees
B-trees
Taking Action on Trees
Traversing a tree to search for data
Preorder traversal
In-order traversal
Postorder traversal
Level-order traversal
Adding new data
Deleting data
Pruning and grafting sub-trees
Algorithms. Contents at a Glance
Sorting Algorithms
Using Bubble Sort
Using Selection Sort
Using Insertion Sort
Using Shell Sort
Using Heap Sort
Using Merge Sort
Using Quick Sort
Comparing Sorting Algorithms
Searching Algorithms
Sequential Search
Backward or forward searching
Block searching
Binary searching
Interpolation searching
Using Indexes
Creating an index
Clustered and unclustered indexes
Problems with indexes
Adversarial Search
Depth versus time
Alpha-beta pruning
Looking up a library of good moves
String Searching
Sequential Text Search
The Boyer-Moore algorithm
The Rabin–Karp algorithm
The Shift Or algorithm
The finite automaton algorithm
Searching with Regular Expressions
Searching for single character patterns
Searching for multiple character patterns
Searching for alternate patterns
Searching Phonetically
Data Compression Algorithms
Lossless Data Compression Algorithms
Run-length encoding
The Burrows–Wheeler transform algorithm
Dictionary encoding
The LZ77 algorithm
The LZ78 algorithm
The LZW algorithm
Lossy Data Compression
Encryption Algorithms
How Encryption Works
The Basics of Encryption
THE 56-BIT KEY OF THE DES ALGORITHM
Stream ciphers
HACKING A SLOT MACHINE
Block ciphers
Electronic codebook (ECB)
Cipher-block chaining (CBC)
HASH FUNCTIONS
Symmetric/Asymmetric Encryption Algorithms
HIDING IN PLAIN SIGHT WITH STEGANOGRAPHY
Cracking Encryption
Brute-force attacks
Dictionary attacks
THE CHINESE LOTTERY AND BLOCKCHAINS
Plaintext and ciphertext attacks
CODE CRACKING IN THE BATTLE OF MIDWAY
Web Programming. Contents at a Glance
HyperText Markup Language
The Structure of an HTML Document
Creating a title
Creating the body text
Aligning text
Emphasizing text
Adding color
Changing the font size
Adding comments
Adding Graphics
Defining the Background
Creating Hyperlinks
Defining an anchor point
Linking to an anchor point
Making Tables
Defining a table
Defining a table heading
Creating table rows and data
Displaying a table caption, header, and footer
CSS
The Structure of a Stylesheet
Creating Style Classes
Separating Styles in Files
Cascading Stylesheets
JavaScript
The Structure of a JavaScript Program
Creating Comments
Declaring Variables
Using Operators
Increment and decrement operators
Assignment operators
Branching Statements
Looping Statements
Creating Functions
Using Arrays
Designing User Interfaces
Creating dialog boxes
Alert dialog boxes
Confirmation dialog boxes
Prompt dialog boxes
Creating windows
PHP
Examining the Structure of a PHP Program
Creating Comments
Declaring Variables
Using Operators
Increment and decrement operators
Assignment operators
Branching Statements
Looping Statements
Creating Functions
Using Arrays
Creating Objects
Ruby
The Structure of a Ruby Program
Creating Comments
Declaring Variables
Using Operators
Branching Statements
Looping Statements
Creating Functions
Using Data Structures
Creating Objects
Programming Language Syntax. Contents at a Glance
C and C++
Looking at the Structure of a C/C++ Program
Creating Comments
Declaring Variables
Declaring string data types
Declaring integer data types
Declaring floating-point data types
Declaring Boolean values
Using Operators
Increment and decrement operators
Assignment operators
Branching Statements
Looping Statements
Creating Functions
Data Structures
Creating a structure
Creating enumerations
Creating an array
Using Objects
Java and C#
Looking at the Structure of a Java/C# Program
Creating Comments
Declaring Variables
Declaring string data types
Declaring integer data types
Declaring floating-point data types
Declaring Boolean variables
Using Operators
Increment and decrement operators
Assignment operators
Branching Statements
Looping Statements
Creating Functions
Data Structures
Creating a C# structure
Creating an array
Creating a Java linked list
Creating C# data structures
Using Objects
Perl and Python
Reviewing the Structure of a Perl or Python Program
Creating Comments
Defining Variables
Using Operators
Increment and decrement operators
Assignment operators
Branching Statements
Looping Statements
Creating Functions
Making Data Structures
Perl data structures
Creating a Perl array
Creating a Perl hash
Python data structures
Creating a Python tuple
Creating a Python list
Creating a Python dictionary
Using Objects
Kotlin
Looking at the Structure of a Kotlin Program
Creating Comments
Declaring Variables
Declaring string data types
Declaring integer data types
Declaring floating-point data types
Declaring Boolean values
Declaring Constants
Using Operators
Branching Statements
Looping Statements
Creating Functions
Creating Data Structures
Creating a list
Creating an array
Creating a set
Creating Objects
Swift and SwiftUI
Considering the Structure of a Swift Program
Understanding SwiftUI
Creating a SwiftUI user interface
Understanding SwiftUI state variables
Creating Comments
Declaring Variables
Declaring string data types
Declaring integer data types
Declaring decimal data types
Declaring Boolean values
Declaring Constants
Using Operators
Branching Statements
Looping Statements
Creating Functions
Data Structures
Creating an array
Creating a dictionary
Creating a set
Creating Objects
Flutter and Dart
Working with Flutter
Understanding the structure of a Flutter program
Working with widgets in Flutter
Aligning widgets in rows and columns
Understanding the Dart Language
Creating comments
Declaring variables
Using operators
Increment and decrement operators
Assignment operators
Using branching statements
Using looping statements
Creating functions
Creating data structures
Creating a list
Creating a queue
Creating a map
Using objects
Applications. Contents at a Glance
Database Management
Understanding the Basics of Databases
Free-form databases
Flat-file databases
Relational databases
Manipulating Data
Writing database commands
The SQL language
Data integrity
Data mining
Database Programming
Bioinformatics
The Basics of Bioinformatics
Representing molecules
Manipulating molecules in a computer
Database Searches
Bioinformatics Programming
Computer Security
Stopping Malware
Viruses
Worms
Trojan horses
Spyware
Distributed denial-of-service attacks
ATTACKING NUCLEAR REACTORS IN IRAN WITH STUXNET
Stopping Hackers
Intrusion detection systems
STOPPING CHEATERS IN VIDEO GAMES
Rootkit detectors
Forensics
Secure Computing
Patching as an afterthought
Security in coding
Security by design
Artificial Intelligence
STRONG VERSUS WEAK ARTIFICIAL INTELLIGENCE
Problem Solving
Game-playing
Natural language processing
Speech recognition
Image recognition
Machine Learning
THE DANGER OF MACHINE LEARNING
Bayesian probability
Neural networks
ROBOTICS AND ARTIFICIAL INTELLIGENCE
Applications of Artificial Intelligence
Mobile and Wearable Computing
Understanding the Different Generations of Computing
Giving Data to the User
Getting Data from the User
Tracking Motion and Location
Tracking Real-Time Health Data
Looking to the Future of Augmented Reality and Wearable Computers
Game Engines
Understanding Game Engines
Picking a Game Engine
Programming a Game Engine
Exploring the Future Uses of Game Engines
Filmmaking
Architecture and engineering simulations
Marketing and advertising
The Future of Computer Programming
Picking a Programming Language
Picking an Operating System
Doing Cross-Platform Programming
The portability of C
Cross-platform languages
Virtual machines
Software as a service
Data science
Website programming
Macro programming
Robotics programming
Blockchain programming
Defining Your Future in Programming
Teaching yourself other languages
Combining other interests besides programming
Getting experience and knowledge
Index. Symbols
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Z
About the Author
Dedication
Author’s Acknowledgments
WILEY END USER LICENSE AGREEMENT
Отрывок из книги
If you enjoy using a computer, you may have even more fun learning to control a computer by writing your own programs. To learn how to program a computer, you need to:
If you have any interest in programming but don’t know where to start, this book can give you a nudge in the right direction. You won’t learn how to write programs in a specific programming language, but you’ll learn the basics of computer programming so you’ll have no trouble learning more on your own.
.....
After you understand that programming is nothing more than telling a computer how to solve a problem, you may wonder how you can get started figuring out programming on your own. If you want to figure out how to program a computer, this is what you need:
Find out more about programming tools, like an editor and a compiler, in Book 1, Chapter 4.
.....