Anyone Can Code: The Art and Science of Logical Creativity introduces computer programming as a way of problem-solving through logical thinking. It uses the notion of modularization as a central lens through which we can make sense of many software concepts. This book takes the reader through fundamental concepts in programming by illustrating them in three different and distinct languages: C/C++, Python, and Javascript.
Key features:
- Focuses on problem-solving and algorithmic thinking instead of programming functions, syntax, and libraries.
- Includes engaging examples, including video games and visual effects.
- Provides exercises and reflective questions.
This book gives beginner and intermediate learners a strong understanding of what they are doing so that they can do it better and with any other tool or language that they may end up using later.
Sample code is available on the author’s website (http://ali-arya.com/anyonecancode/).
Author(s): Ali Arya
Edition: 1
Publisher: Chapman and Hall/CRC
Year: 2020
Language: English
Pages: 600
Tags: code, coding
Cover
Half Title
Title Page
Copyright Page
Table of Contents
List of Sidebars,
List of Tables,
List of Exhibits,
Preface,
Acknowledgments,
Definition of Key Terms,
Abbreviation,
Companion Website,
Part 1 Getting Started
Introduction
Hello, World!
I.1 Software Development
I.1.1 Design and Implementation
I.1.2 Modularization
Highlights
End-of-Chapter Notes
Chapter 1 Computers, Programs, and Games
Overview
1.1 Brief History of Computing
1.1.1 Properties of Digital Media
1.2 Circuits and Numbers, Bits, and Bytes
1.2.1 Decimal vs. Binary
1.2.2 Bits and Bytes
1.3 What is a Program, Anyway?
1.3.1 Visual Programming
1.4 Games as Programs: Data vs. Code
Highlights
End-of-Chapter Notes
Chapter 2 Logical Creativity
Overview
2.1 Problem-Solving and Creativity
2.2 Visual Design and Visual Thinking
2.3 Algorithms and Algorithmic Thinking
2.3.1 What is an Algorithm?
2.3.2 Program Flow
2.3.3 Selection
2.3.3.1 Detecting Odd and Even Numbers
2.3.4 Iteration
2.3.5 Variables and the First Golden Rule of Programming
2.3.6 Loop Counter as a Variable
2.4 Data-Centered Approach to Problem-Solving and Algorithm Design
2.4.1 Finding Min and Max
2.5 Stepwise Refinement for Algorithms
2.5.1 Restaurant Bill Calculation
Highlights
End-of-Chapter Notes
Part 2 Understanding Programs
Chapter 3 Data: Program’s Information
Overview
3.1 High-Level Programming Languages
3.1.1 High Level vs. Low Level
3.1.2 Declarative vs. Imperative
3.1.3 Compiled vs. Interpreted
3.1.4 Virtual Machines
3.1.5 Development Environments and Tools
3.2 Data and Variables
3.3 Programming in Python
3.4 Programming in C and C++
3.4.1 Compiling and Running C/C++ Programs
3.4.2 Comments
3.5 Data Types
3.5.1 Type Casting
3.5.2 Integer and Float Operations
Highlights
End-of-Chapter Notes
Chapter 4 Code: Program’s Operation
Overview
4.1 Sequential Execution and Program Control
4.1.1 GoTo Statement
4.1.2 Structured Programming and Control Flow
4.1.2.1 Function
4.1.2.2 Selection
4.1.2.3 Iteration
4.1.2.4 Blocks of Code and the Lexical Scope
4.2 Selection
4.2.1 If/Else
4.2.2 Switch/Case
4.3 Iteration
4.3.1 While Loops
4.3.1.1 Forever Loops
4.3.2 For Loops
4.4 Combining Selection and Iteration
4.4.1 Guessing Game
4.4.2 Simple Calculator
4.5 Naming Conventions
4.5.1 #Define In C/C ++
Highlights
End-of-Chapter Notes
Chapter 5 Functions
Overview
5.1 Defining and Using Functions
5.1.1 Returning From a Function
5.2 Functions in C/C++
5.2.1 Void Main()
5.2.2 Void Hello()
5.2.3 Int Getdata()
5.3 Local and Global Variables
5.4 Function Parameters
5.4.1 Simple Board Game Simulator
5.4.2 Bmi Calculator
5.4.3 Prime Number Listing
Highlights
End-of-Chapter Notes
Part 3 Structured Programming
Chapter 6 Types, Files, and Libraries
Overview
6.1 Data Types Revisited
6.1.1 Predefined and User-Defined Types
6.1.1.1 Enumeration
6.1.1.2 Structure
6.1.2 Memory Address and Pointer Type
6.1.3 Passing Parameters to Functions
6.2 Outside the File
6.2.1 Multiple Source Files
6.2.2 Libraries
6.3 Graphics Programming
6.3.1 Computer Graphics
6.3.2 Graphics in Javascript
6.3.3 Graphics in Python
6.3.4 Graphics in C/C++
6.3.5 Command-Line Parameters
6.3.6 Rendering
6.3.7 Simple 2D Game
6.3.7.1 Game Objects
6.3.7.2 Game Code Structure
6.3.7.3 Example
Highlights
End-of-Chapter Notes
Chapter 7 Modularization of Data
Overview
7.1 User-Defined Types as Modules of Data
7.1.1 Collision Detection
7.1.2 Vanishing Prize: How to Make Objects Disappear
7.1.3 Simple Game in Javascript
7.1.4 Events Revisited
7.1.5 Distance and Collision
7.1.6 Lives and Scores in Python
7.1.7 Movements and Collision
7.1.8 Life and Score
7.2 Arrays as Modules of Data
7.2.1 Arrays
7.2.2 Arrays in Javascript and Python
7.3 Examples of Using Arrays
7.3.1 Linear Search
7.3.2 Ground Levels in Games
7.3.3 Plotting Data
7.3.4 Scaling and Translation
7.3.5 Text Processing
7.4 Combined Data Modules
7.4.1 Simple Database
7.4.2 2D Game with Arrays
7.4.3 Animated Objects
7.4.4 Transparent Pixels and Background Image
Highlights
End-of-Chapter Notes
Chapter 8 Modularization of Code
Overview
8.1 Functions Revisited
8.1.1 Using Functions to Build Modular Programs
8.1.2 A Modular Command Processor
8.1.3 What is a Good Function?
8.2 Information Hiding and Abstraction
8.3 Modular Design
8.3.1 School Database
8.3.2 Library Database
8.4 A Modular Game Program
8.4.1 2D Side-Scroller Game
8.4.2 Scrolling
8.4.3 Defense Mode
8.4.4 Physics: Platforms, Jumping, and Falling
8.4.5 Data Types
8.4.6 Game Functions
8.4.7 Movement
8.4.8 Timers and Callback Functions
Highlights
End-of-Chapter Notes
Part 4 Object-Oriented Programming
Chapter 9 Modularization of Data and Code
Overview
9.1 Objects and Classes
9.1.1 Abstract Data Types
9.1.2 Encapsulation
9.1.3 C++ and Classes
9.1.4 Constructor
9.1.5 Python and Javascript Classes
9.2 Object-Oriented Programming
9.2.1 Identifying Classes and Objects
9.2.2 Class Development
9.2.3 Constructors and the Order of Execution
9.2.4 Class View in Visual Studio
9.3 Object-Oriented Games
9.3.1 GameObject Class
9.3.2 Game Class
9.3.3 Multiple Source Files
Highlights
End-of-Chapter Notes
Chapter 10 Object-Oriented Design
Overview
10.1 Software Design With Classes
10.1.1 OOD Process for a Game
10.1.2 Requirements
10.1.3 Game-Related Requirements
10.1.4 Software-Related Requirements (For Reusability and Manageability)
10.1.5 Specific Requirements for Sample Game
10.1.6 Game Software Design
10.1.6.1 Render
10.1.6.2 Physics
10.1.6.3 Game
10.1.7 GameObject, Information Hiding, and Class Access Control
10.1.8 Implementing Class Methods
10.1.8.1 GameObject
10.1.8.2 Game
10.1.8.3 Render
10.1.8.4 Physics
10.2 Dynamic Objects
10.2.1 Dynamic Arrays and Objects
10.2.2 Dynamic Object Creation
10.2.3 Object Destructor
10.2.4 Particle Systems
10.2.5 Smoke Particle System Requirements
10.2.6 Smoke Particle System Design
10.2.7 Smoke Particle System Functions
10.2.8 Using the Smoke Particle System
Highlights
End-of-Chapter Notes
Part 5 More About Objects and Classes
Chapter 11 Class Hierarchies
Overview
11.1 Extending Classes With Inheritance
11.1.1 C++ Student Class Revisited
11.1.2 Different Yet Similar Classes
11.1.3 Inheritance in Python and Javascript
11.1.4 Python Inheritance Example
11.1.5 Javascript Inheritance Example
11.2 Different Types of Game Objects
11.2.1 Openframeworks
11.2.2 Ofapp Class
11.2.3 Customizing the Project
11.2.4 Adding New Content
11.2.5 Gameobject Class
11.2.6 Game Class
11.2.7 Enemy vs. Player
11.2.8 Animation Revisited
Highlights
End-of-Chapter Notes
Chapter 12 Object Identities
Overview
12.1 Rendering Multiple Gameobject Types
12.1.1 Of-Based Render Class
12.1.2 Function Overloading
12.1.3 Multiple Gameobject Types
12.1.4 Inheritance and Identities
12.2 Dynamic Polymorphism
12.2.1 Visual Effects and Image Processing
12.2.2 Basic Image Processing
12.2.3 Sample Image Effects
12.2.4 Effect classes
12.2.5 Rendering with Effects
12.2.6 Using Dynamic Polymorphism in Render Class
12.2.7 Polymorphism in Python and Javascript
12.3 Physics Class Revisited
12.3.1 Heightmaps
12.3.2 Static Members
Highlights
End-of-Chapter Notes
Part 6 Moving Forward
Chapter 13 Software Design
Overview
13.1 Design Patterns
13.2 Data Structures
13.3 Software Architecture
13.4 Suggested Projects
13.4.1 Image Editor
13.4.2 Game AI
Chapter 14 Software Projects
Overview
14.1 Project Management
14.2 Version Control
Chapter 15 Concluding Notes
Overview
15.1 Summary of Key Points
15.2 Some Practical Advice
Bibliography,
Index,