You are on page 1of 53

Anyone Can Code The Art and Science

of Logical Creativity 1st Edition Ali Arya


Visit to download the full and correct content document:
https://textbookfull.com/product/anyone-can-code-the-art-and-science-of-logical-creati
vity-1st-edition-ali-arya/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

The Creativity Code Art and Innovation in the Age of AI


Marcus Du Sautoy

https://textbookfull.com/product/the-creativity-code-art-and-
innovation-in-the-age-of-ai-marcus-du-sautoy/

The Premonition Code The Science of Precognition How


Sensing the Future Can Change Your Life Theresa Cheung

https://textbookfull.com/product/the-premonition-code-the-
science-of-precognition-how-sensing-the-future-can-change-your-
life-theresa-cheung/

Knife Drop Creative Recipes Anyone Can Cook 2nd Edition


Nick Digiovanni

https://textbookfull.com/product/knife-drop-creative-recipes-
anyone-can-cook-2nd-edition-nick-digiovanni/

Logical Studies of Paraconsistent Reasoning in Science


and Mathematics 1st Edition Holger Andreas

https://textbookfull.com/product/logical-studies-of-
paraconsistent-reasoning-in-science-and-mathematics-1st-edition-
holger-andreas/
Change Your World: How Anyone, Anywhere Can Make A
Difference 1st Edition John C. Maxwell

https://textbookfull.com/product/change-your-world-how-anyone-
anywhere-can-make-a-difference-1st-edition-john-c-maxwell/

Change Your World: How Anyone, Anywhere Can Make A


Difference 1st Edition John C. Maxwell

https://textbookfull.com/product/change-your-world-how-anyone-
anywhere-can-make-a-difference-1st-edition-john-c-maxwell-2/

What Is Paleolithic Art Cave Paintings and the Dawn of


Human Creativity 1st Edition Jean Clottes

https://textbookfull.com/product/what-is-paleolithic-art-cave-
paintings-and-the-dawn-of-human-creativity-1st-edition-jean-
clottes/

The Paradox of Creativity in Art Education Bourdieu and


Socio cultural Practice Kerry Thomas

https://textbookfull.com/product/the-paradox-of-creativity-in-
art-education-bourdieu-and-socio-cultural-practice-kerry-thomas/

Art and Immortality in the Ancient Near East Mehmet-Ali


Ataç

https://textbookfull.com/product/art-and-immortality-in-the-
ancient-near-east-mehmet-ali-atac/
Anyone Can Code
Anyone Can Code
The Art and Science of Logical Creativity

Ali Arya
First Edition published 2021
by CRC Press
2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN

and by CRC Press


6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742

© 2021 Ali Arya

CRC Press is an imprint of Informa UK Limited

The right of Ali Arya to be identified as author[/s] of this work has been asserted by him in accordance with
sections 77 and 78 of the Copyright, Designs and Patents Act 1988.

All rights reserved. No part of this book may be reprinted or reproduced or utilised in any form or by any electronic,
mechanical, or other means, now known or hereafter invented, including photocopying and recording, or in any
information storage or retrieval system, without permission in writing from the publishers.

For permission to photocopy or use material electronically from this work, access www.copyright.com or contact the
Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. For works that are
not available on CCC please contact mpkbookspermissions@tandf.co.uk

Trademark notice: Product or corporate names may be trademarks or registered trademarks, and are used only for
identification and explanation without intent to infringe.
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library

Library of Congress Cataloging-in-Publication Data


Names: Arya, Ali, author.
Title: Anyone can code : the art and science of logical creativity / Ali Arya.
Description: First edition. | Boca Raton : CRC Press, 2020. | Includes
bibliographical references and index.
Identifiers: LCCN 2020030146 | ISBN 9780367199692 (pbk) |
ISBN 9780367199746 (hbk) | ISBN 9780429244421 (ebk)
Subjects: LCSH: Computer programming. | Programming languages (Electronic
computers) | Logic.
Classification: LCC QA76.6 .A78 2020 | DDC 005.13—dc23
LC record available at https://lccn.loc.gov/2020030146

ISBN: 978-0-367-19974-6 (hbk)


ISBN: 978-0-367-19969-2 (pbk)
ISBN: 978-0-429-24442-1 (ebk)

Typeset in Minion Pro


by codeMantra

Visit the companion website: http://ali-arya.com/anyonecancode


Contents

List of Sidebars, xv
List of Tables, xvii
List of Exhibits, xix
Preface, xxiii
Acknowledgments, xxvii
Definition of Key Terms, xxix
Abbreviation, xxxi
Companion Website, xxxiii

PART 1 Getting Started

Introduction 3
HELLO, WORLD! 3
I.1 SOFTWARE DEVELOPMENT 11
I.1.1 Design and Implementation 14
I.1.2 Modularization 16
HIGHLIGHTS 18
END-OF-CHAPTER NOTES 18

Chapter 1 ◾ Computers, Programs, and Games 21


OVERVIEW 21
1.1 BRIEF HISTORY OF COMPUTING 22
1.1.1 Properties of Digital Media 25
1.2 CIRCUITS AND NUMBERS, BITS, AND BYTES 26
1.2.1 Decimal vs. Binary 27
1.2.2 Bits and Bytes 28

v
vi ◾ Contents

1.3 WHAT IS A PROGRAM, ANYWAY? 30


1.3.1 Visual Programming 31
1.4 GAMES AS PROGRAMS: DATA VS. CODE 33
HIGHLIGHTS 39
END-OF-CHAPTER NOTES 40

Chapter 2 ◾ Logical Creativity 43


OVERVIEW 43
2.1 PROBLEM-SOLVING AND CREATIVITY 44
2.2 VISUAL DESIGN AND VISUAL THINKING 48
2.3 ALGORITHMS AND ALGORITHMIC THINKING 51
2.3.1 What Is an Algorithm? 51
2.3.2 Program Flow 56
2.3.3 Selection 57
2.3.3.1 Detecting Odd and Even Numbers 58
2.3.4 Iteration 59
2.3.5 Variables and the First Golden Rule of Programming 64
2.3.6 Loop Counter as a Variable 65
2.4 DATA-CENTERED APPROACH TO PROBLEM-SOLVING
AND ALGORITHM DESIGN 66
2.4.1 Finding Min and Max 68
2.5 STEPWISE REFINEMENT FOR ALGORITHMS 70
2.5.1 Restaurant Bill Calculation 72
HIGHLIGHTS 75
END-OF-CHAPTER NOTES 76

PART 2 Understanding Programs

Chapter 3 ◾ Data: Program’s Information 81


OVERVIEW 81
3.1 HIGH-LEVEL PROGRAMMING LANGUAGES 82
3.1.1 High Level vs. Low Level 83
3.1.2 Declarative vs. Imperative 83
3.1.3 Compiled vs. Interpreted 84
3.1.4 Virtual Machines 84
3.1.5 Development Environments and Tools 86
Contents ◾ vii

3.2 DATA AND VARIABLES 88


3.3 PROGRAMMING IN PYTHON 94
3.4 PROGRAMMING IN C AND C++ 99
3.4.1 Compiling and Running C/C++ Programs 102
3.4.2 Comments 103
3.5 DATA TYPES 107
3.5.1 Type Casting 111
3.5.2 Integer and Float Operations 112
HIGHLIGHTS 114
END-OF-CHAPTER NOTES 115

Chapter 4 ◾ Code: Program’s Operation 117


OVERVIEW 117
4.1 SEQUENTIAL EXECUTION AND PROGRAM CONTROL 118
4.1.1 GoTo Statement 118
4.1.2 Structured Programming and Control Flow 119
4.1.2.1 Function 119
4.1.2.2 Selection 120
4.1.2.3 Iteration 120
4.1.2.4 Blocks of Code and the Lexical Scope 121
4.2 SELECTION 122
4.2.1 If/Else 122
4.2.2 Switch/Case 125
4.3 ITERATION 129
4.3.1 While Loops 129
4.3.1.1 Forever Loops 133
4.3.2 For Loops 134
4.4 COMBINING SELECTION AND ITERATION 136
4.4.1 Guessing Game 136
4.4.2 Simple Calculator 139
4.5 NAMING CONVENTIONS 141
4.5.1 #define in C/C++ 142
HIGHLIGHTS 144
END-OF-CHAPTER NOTES 145
viii ◾ Contents

Chapter 5 ◾ Functions 147


OVERVIEW 147
5.1 DEFINING AND USING FUNCTIONS 148
5.1.1 Returning from a Function 152
5.2 FUNCTIONS IN C/C++ 154
5.2.1 void main() 155
5.2.2 void Hello() 156
5.2.3 int GetData() 156
5.3 LOCAL AND GLOBAL VARIABLES 157
5.4 FUNCTION PARAMETERS 163
5.4.1 Simple Board Game Simulator 167
5.4.2 BMI Calculator 171
5.4.3 Prime Number Listing 173
HIGHLIGHTS 176
END-OF-CHAPTER NOTES 176

PART 3 Structured Programming

Chapter 6 ◾ Types, Files, and Libraries 181


OVERVIEW 181
6.1 DATA TYPES REVISITED 182
6.1.1 Predefined and User-Defined Types 182
6.1.1.1 Enumeration 183
6.1.1.2 Structure 186
6.1.2 Memory Address and Pointer Type 191
6.1.3 Passing Parameters to Functions 197
6.2 OUTSIDE THE FILE 200
6.2.1 Multiple Source Files 200
6.2.2 Libraries 206
6.3 GRAPHICS PROGRAMMING 208
6.3.1 Computer Graphics 208
6.3.2 Graphics in Javascript 213
6.3.3 Graphics in Python 217
6.3.4 Graphics in C/C++ 219
6.3.5 Command-Line Parameters 223
Contents ◾ ix

6.3.6 Rendering 224


6.3.7 Simple 2D Game 224
6.3.7.1 Game Objects 225
6.3.7.2 Game Code Structure 225
6.3.7.3 Example 228
HIGHLIGHTS 233
END-OF-CHAPTER NOTES 234

Chapter 7 ◾ Modularization of Data 237


OVERVIEW 237
7.1 USER-DEFINED TYPES AS MODULES OF DATA 238
7.1.1 Collision Detection 244
7.1.2 Vanishing Prize: How to Make Objects Disappear 246
7.1.3 Simple Game in Javascript 247
7.1.4 Events Revisited 252
7.1.5 Distance and Collision 254
7.1.6 Lives and Scores in Python 254
7.1.7 Movements and Collision 260
7.1.8 Life and Score 261
7.2 ARRAYS AS MODULES OF DATA 261
7.2.1 Arrays 261
7.2.2 Arrays in Javascript and Python 267
7.3 EXAMPLES OF USING ARRAYS 268
7.3.1 Linear Search 268
7.3.2 Ground Levels in Games 273
7.3.3 Plotting Data 275
7.3.4 Scaling and Translation 277
7.3.5 Text Processing 283
7.4 COMBINED DATA MODULES 285
7.4.1 Simple Database 285
7.4.2 2D Game with Arrays 291
7.4.3 Animated Objects 298
7.4.4 Transparent Pixels and Background Image 301
HIGHLIGHTS 302
END-OF-CHAPTER NOTES 303
x ◾ Contents

Chapter 8 ◾ Modularization of Code 305


OVERVIEW 305
8.1 FUNCTIONS REVISITED 306
8.1.1 Using Functions to Build Modular Programs 307
8.1.2 A Modular Command Processor 311
8.1.3 What Is a Good Function? 313
8.2 INFORMATION HIDING AND ABSTRACTION 316
8.3 MODULAR DESIGN 320
8.3.1 School Database 320
8.3.2 Library Database 331
8.4 A MODULAR GAME PROGRAM 340
8.4.1 2D Side-Scroller Game 341
8.4.2 Scrolling 342
8.4.3 Defense Mode 343
8.4.4 Physics: Platforms, Jumping, and Falling 349
8.4.5 Data Types 350
8.4.6 Game Functions 350
8.4.7 Movement 351
8.4.8 Timers and Callback Functions 362
HIGHLIGHTS 364
END-OF-CHAPTER NOTES 364

PART 4 Object-Oriented Programming

Chapter 9 ◾ Modularization of Data and Code 369


OVERVIEW 369
9.1 OBJECTS AND CLASSES 370
9.1.1 Abstract Data Types 370
9.1.2 Encapsulation 373
9.1.3 C++ and Classes 376
9.1.4 Constructor 382
9.1.5 Python and Javascript Classes 385
9.2 OBJECT-ORIENTED PROGRAMMING 389
9.2.1 Identifying Classes and Objects 391
9.2.2 Class Development 393
Contents ◾ xi

9.2.3 Constructors and the Order of Execution 399


9.2.4 Class View in Visual Studio 401
9.3 OBJECT-ORIENTED GAMES 402
9.3.1 GameObject Class 409
9.3.2 Game Class 410
9.3.3 Multiple Source Files 411
HIGHLIGHTS 415
END-OF-CHAPTER NOTES 416

Chapter 10 ◾ Object-Oriented Design 419


OVERVIEW 419
10.1 SOFTWARE DESIGN WITH CLASSES 420
10.1.1 OOD Process for a Game 420
10.1.2 Requirements 421
10.1.3 Game-Related Requirements 422
10.1.4 Software-Related Requirements (for Reusability and Manageability) 423
10.1.5 Specific Requirements for Sample Game 423
10.1.6 Game Software Design 425
10.1.6.1 Render 425
10.1.6.2 Physics 426
10.1.6.3 Game 427
10.1.7 GameObject, Information Hiding, and Class Access Control 427
10.1.8 Implementing Class Methods 430
10.1.8.1 GameObject 430
10.1.8.2 Game 431
10.1.8.3 Render 431
10.1.8.4 Physics 433
10.2 DYNAMIC OBJECTS 435
10.2.1 Dynamic Arrays and Objects 435
10.2.2 Dynamic Object Creation 441
10.2.3 Object Destructor 443
10.2.4 Particle Systems 445
10.2.5 Smoke Particle System Requirements 445
10.2.6 Smoke Particle System Design 446
10.2.7 Smoke Particle System Functions 447
xii ◾ Contents

10.2.8 Using the Smoke Particle System 452


HIGHLIGHTS 454
END-OF-CHAPTER NOTES 455

PART 5 More about Objects and Classes

Chapter 11 ◾ Class Hierarchies 459


OVERVIEW 459
11.1 EXTENDING CLASSES WITH INHERITANCE 460
11.1.1 C++ Student Class Revisited 460
11.1.2 Different Yet Similar Classes 465
11.1.3 Inheritance in Python and Javascript 474
11.1.4 Python Inheritance Example 476
11.1.5 Javascript Inheritance Example 479
11.2 DIFFERENT TYPES OF GAME OBJECTS 480
11.2.1 OpenFrameworks 481
11.2.2 ofApp Class 483
11.2.3 Customizing the Project 483
11.2.4 Adding New Content 484
11.2.5 GameObject Class 485
11.2.6 Game Class 486
11.2.7 Enemy vs. Player 489
11.2.8 Animation Revisited 493
HIGHLIGHTS 495
END-OF-CHAPTER NOTES 496

Chapter 12 ◾ Object Identities 497


OVERVIEW 497
12.1 RENDERING MULTIPLE GAMEOBJECT TYPES 498
12.1.1 OF-Based Render Class 499
12.1.2 Function Overloading 501
12.1.3 Multiple GameObject Types 502
12.1.4 Inheritance and Identities 502
12.2 DYNAMIC POLYMORPHISM 503
12.2.1 Visual Effects and Image Processing 506
12.2.2 Basic Image Processing 508
Contents ◾ xiii

12.2.3 Sample Image Effects 510


12.2.4 Effect Classes 513
12.2.5 Rendering with Effects 517
12.2.6 Using Dynamic Polymorphism in Render Class 518
12.2.7 Polymorphism in Python and Javascript 519
12.3 PHYSICS CLASS REVISITED 520
12.3.1 Heightmaps 522
12.3.2 Static Members 526
HIGHLIGHTS 527
END-OF-CHAPTER NOTES 528

PART 6 Moving Forward

Chapter 13 ◾ Software Design 533


OVERVIEW 533
13.1 DESIGN PATTERNS 534
13.2 DATA STRUCTURES 536
13.3 SOFTWARE ARCHITECTURE 538
13.4 SUGGESTED PROJECTS 540
13.4.1 Image Editor 540
13.4.2 Game AI 541

Chapter 14 ◾ Software Projects 543


OVERVIEW 543
14.1 PROJECT MANAGEMENT 544
14.2 VERSION CONTROL 545

Chapter 15 ◾ Concluding Notes 547


OVERVIEW 547
15.1 SUMMARY OF KEY POINTS 547
15.2 SOME PRACTICAL ADVICE 548

BIBLIOGRAPHY, 551

INDEX, 553
List of Sidebars

Sidebar: Flowcharts 10
Sidebar: Process Models for a Software Development Project 13
Sidebar: Analog Computers 27
Sidebar: Game Development Process 35
Sidebar: Game Engines 37
Sidebar: Web and Virtual Machines 85
Sidebar: Compiler Optimization 106
Sidebar: The Evolution Of User Interface (UI) 126
Sidebar: Debugging 165
Sidebar: Computer Architecture and Memory Access 192
Sidebar: Operating Systems 207
Sidebar: Graphic Systems 211
Sidebar: Milestones in Computer Games History 297
Sidebar: Game Production Cycle and Team 340
Sidebar: Programming Paradigms 389
Sidebar: Game Design Document 424
Sidebar: Multiple Inheritance 473
Sidebar: C# and Java 506

xv
List of Tables

Table I.1 Phases of the Software Development Process 13


Table 1.1 Number Systems 29
Table 3.1 File Extensions for Common Source Files 83
Table 3.2 Common Operators 97
Table 3.3 ASCII Codes 111

xvii
List of Exhibits

Exhibit I.1 Simple algorithm. (a) Fixed set of operations, (b) with a rule. 9
Exhibit I.2 Software development process. 12
Exhibit I.3 Sketch to painting. Van Gogh’s Potato Eaters. Many details change at
the implementation phase, but sketch gives a general idea. (Van Gogh,
Vincent. The Potato Eaters. 1890. Van Gogh Museum, Amsterdam,
The Netherlands.) 15
Exhibit I.4 Software modules for a simple computer game. 17
Exhibit 1.1 Computers come in various forms and shapes. 22
Exhibit 1.2 Von Neumann model of a computing device. 23
Exhibit 1.3 Bitwise operation for two bytes. 30
Exhibit 1.4 Assembly and Machine Code. Operations LOAD, ADD, and SAVE are
common machine code instructions, but their name and equivalent
binary values are hypothetical. 30
Exhibit 1.5 Unreal Engine’s Blueprint in action. 32
Exhibit 1.6 Hello, World! using Scratch. 34
Exhibit 1.7 Modules of a simple game. 35
Exhibit 1.8 Defining objects for the simple game. 36
Exhibit 1.9 Defining Game Actions (operations) using object properties. 37
Exhibit 2.1 Directions from A to B. It may require taking different buses and
transferring at different stops such as C. 45
Exhibit 2.2 Visual design process. Observing, identifying the major entities,
drawing the first sketch, and adding details. 49
Exhibit 2.3 Software development process. 50
Exhibit 2.4 Point A to Point B. (a) Straight line heuristic (b) go-around-
obstacle algorithm. 52
xix
xx ◾ List of Exhibits

Exhibit 2.5 Visualization of the GPA program. 67


Exhibit 2.6 Identifying the maximum value in a series of data (item with a star).
(a) It is shown as one of the data items. (b) It is a separate data and gets
its value from one of the data items. 68
Exhibit 2.7 Stepwise refinement. 70
Exhibit 3.1 A typical IDE. 87
Exhibit 3.2 Visualization of Sample Code #1. 88
Exhibit 3.3 Output for Sample Code #2. 90
Exhibit 3.4 Syntax highlighting. Javascript code created and shown in Visual Studio. 91
Exhibit 3.5 Python output for Sample Code #5. 95
Exhibit 3.6 Visual Studio User Interface with project view, source file, and
output windows. 100
Exhibit 3.7 Build process for C programs. 102
Exhibit 3.8 Output for Sample Code #12. 112
Exhibit 4.1 Function call and return. 119
Exhibit 4.2 Selection. 120
Exhibit 4.3 Iteration. 121
Exhibit 4.4 Guessing game. 137
Exhibit 4.5 Simple calculator. 139
Exhibit 5.1 Compiler error. 156
Exhibit 5.2 Full name program visualization. 157
Exhibit 5.3 Undefined variables. 159
Exhibit 5.4 Simple board game simulator. 167
Exhibit 5.5 Sample output of the board game. 167
Exhibit 6.1 Computer memory. 192
Exhibit 6.2 Electronic connections on a CPU circuit board. 193
Exhibit 6.3 Memory access through data, address, and control buses. 194
Exhibit 6.4 Pointers. 195
Exhibit 6.5 Choosing the Startup File in a Python project. 203
List of Exhibits ◾ xxi

Exhibit 6.6 Two-dimension screens and pixels. 209


Exhibit 6.7 Transparency. Making the background of an image transparent
using alpha values will allow it to be superimposed on top of
another with only the foreground object showing. The pixels on
the background (or any other pixel) have the alpha value of 0, which
makes them transparent. 211
Exhibit 6.8 Output of the simple graphics program with pixels, lines, and images. 221
Exhibit 6.9 Command-line parameters. /AD is a parameter for dir program that
tells to show only directories. 223
Exhibit 6.10 Visualizing a Game with three types of objects. 226
Exhibit 7.1 Calculating distance. 245
Exhibit 7.2 Visualization of search program. 271
Exhibit 7.3 Ground levels. (a) Very realistic and random, (b) piece-wise flat,
(c) heightmap for (a), (d) heightmap for (b). 273
Exhibit 7.4 Simple plot. 275
Exhibit 7.5 Translation, scaling, and rotation as a change in coordinate systems. 279
Exhibit 7.6 Plotting lines. 280
Exhibit 7.7 Animated character. 299
Exhibit 7.8 Game with background and moving characters. The character on
the left shows its background, but the character on the right has a
transparent background. 301
Exhibit 8.1 Modules in the simple calculator. 313
Exhibit 8.2 Deep vs. shallow functions. Function A is deep (few parameters with
substantial actions) and Function B is shallow (a large set of parameters
for a simple but configurable action). 315
Exhibit 8.3 Main data items for school program. 320
Exhibit 8.4 Functions for school program. 322
Exhibit 8.5 Borrowing and returning. 332
Exhibit 8.6 Hierarchical data items in the library program. 333
Exhibit 8.7 Game program visualization. 342
xxii ◾ List of Exhibits

Exhibit 8.8 Scrolling and screen vs. world coordinate systems. X1 and X2 are
the X coordinates of the selected point with respect to the Screen
(camera view) and World (actual image) coordinate systems. 343
Exhibit 9.1 OOP program. Object-oriented library. 393
Exhibit 9.2 Classes and their members in the library program. 394
Exhibit 9.3 Class View vs. Solution Explorer. 401
Exhibit 10.1 Ground levels. 423
Exhibit 10.2 OOD for sample game and game engine. 425
Exhibit 10.3 Particle systems. Simple particles can together make a complex shape. 445
Exhibit 10.4 Particle system demo. 452
Exhibit 11.1 Class hierarchy. Student is the base (parent or superclass) and the other
three are derived from it (child or subclass). 472
Exhibit 11.2 Library class hierarchy. 476
Exhibit 12.1 Using visual effects for rendering. Enemies are rendered with a “red”
filter, even though they have the same shape (image file). 507
Exhibit 12.2 Edge detection. The edge pixels of an object (black lines above) can be
used to recognize the shape and so the object. 511
Exhibit 12.3 Ground level can change as steps, ramps, or ram shapes. 522
Exhibit 13.1 Finite state machine for a guard character. Based on the enemy’s
distance from the guarding point, the guard moves between
three states. 536
Exhibit 13.2 IPO. 539
Exhibit 13.3 Layered architecture. 539
Exhibit 14.1 Agile process. 544
Preface

Anyone Can Code is a tricky title for a book. It may give the impression that the book is
one of those super-simplified resources that helps anyone make a nice-looking computer
program, for example, a game or a mobile app. It is not, but there is a truth in that title,
and it deserves an explanation. The title and the whole book are based on how I view the
computing education. And my view is the result of a long journey.
I wrote my first computer program in 1985 when I was a university freshman study-
ing Electrical Engineering. Michael Jackson’s “Thriller,” hair bands, and breakdance
were the big things, and the PC era had just started. I loved the creative power that
programming gave me and found the underlying problem-solving process fascinating.
So, I moved, and sometimes sneaked and forced my way, through various computing
platforms and went from batch processing punch cards for mainframe computers to ter-
minals, early personal computers such as Commodore 64, ZX Spectrum, and MS-DOS
PCs. I soon discovered computer graphics as the combination of my visual arts and com-
puting passions, and eventually tried software development on Windows, Unix, Mac,
and later web and mobile platforms, using various tools and languages, and for different
types of applications from industrial automation to games. Throughout this process, I
shared my experience with friends, colleagues, and students, and accumulated years of
teaching experience in both industry and academia.
This journey taught me many things about computers, work, life, and myself, but it
particularly shaped my belief about programming. I learned that despite many com-
plex and seemingly unnatural forms, programming is not really about the complicated
languages and strange names; it is about thinking. More precisely, it is a process that
some people call logical creativity, as it combines logical thinking with creativity and cre-
ative problem-solving. And here is where the book title comes in: despite the scary looks,
computer programming is an activity that we are all equipped to do. We all think and solve
problems on a daily basis. We can all Code, but we need to approach it in the right way:
instead of getting stuck with tools, we should learn the concepts; instead of memorizing
this and that syntax, we should learn how to think, a process that involves both rigorous
methodology and creative design. That is how the second part of the book title came in.
The Art and Science of Logical Creativity part of the book title says that we can all design
and write programs, but it is a process that we need to learn the right way.
A few years ago, as a random plan after a lunch date, my wife and I tried a dance lesson.
Unlike any other dance classes I had attended before, the instructors at the Fred Astaire

xxiii
xxiv ◾ Preface

Dance Studio combined multiple types of ballroom dances in each session. The logic was
that there are so many common concepts among seemingly different dances such as Tango,
Swing, and Foxtrot. Learning them together helps the learner to go deeper than the sur-
face and get the fundamental ideas while playing with variations. This experience inspired
the particular approach of this book that introduces programming concepts within the
context of multiple languages. Such an approach emphasizes the concepts and the notion
of logical creativity. It allows the learners to see how these concepts can be translated into
different languages while maintaining the same meaning.
However, just like many other creative design tasks, software development is a hierar-
chical process that starts with basic and simple elements and creates more and more com-
plex modules on top of each other. This modularization is the thread that connects many
key concepts in programming from arrays and functions to classes, design patterns, and
architectures. Modularization, logical thinking, and the multi-language approach are the
key features of this book.
Anyone Can Code: The Art and Science of Logical Creativity introduces 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. This approach is
not the simplest way to start programming and “build a nice-looking app.” But, based
on my many years of experience, it gives the 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. It is designed to cover material for the first
two programming courses in a typical university program: an introductory course and an
intermediate one with subjects such as Object-Oriented Programming. This book can also
be used by individual learners at their own pace.
The popularity of computer games and the multi-disciplinary nature of game develop-
ment projects that involve programmers, artists, designers, writers, and many other experts
have prompted the idea of “learning by making games.” This idea is particularly useful in
the case of learning programming where almost all topics from basic concepts to advanced
ones (such as graphics, networking, and database) will be used and practiced frequently. As
such, this book uses the notion of “learning by making games” quite frequently. While many
other examples are provided, you will see a clear focus on game development as a context for
explaining various programming topics. This allows the reader to practice what is being said
through a hopefully engaging experience that can result in programs similar to many popu-
lar desktop and mobile games. But no learning experience will be effective if it is not accom-
panied by sense-making that allows the learner to really understand what happened and why.
Reflection (making sense of the experience) is found to be necessary for learning as
“doing” by itself will not help us learn if we don’t understand what we did and how it has
affected us. It is defined as a generic term for a variety of affective and intellectual activities
in which an individual engages in order to gain new understandings and appreciations by
exploring their experiences. While essential and quite helpful, reflection may not be a very
natural and comfortable process for many people. Most of us do think about our experiences
Preface ◾ xxv

and the work we have done, but, usually, this is not in any organized fashion, it happens ran-
domly, and we don’t lead the thinking to proper results. I encourage the readers to think of
programming, and reading this book, as reflective processes where they make sense of what
they are doing by thinking about them during and after the experience. To help readers with
the reflective aspects of this experience, and in addition to self-test questions and projects,
this book includes reflective questions. They are grouped into three categories:

1. Explicit Story: Questions such as “What was this chapter about?” or “What was your
task in this project?” encourage the learner to think about what they did and try to
review it.
2. Implicit Story: Questions such as “How do you feel about this subject?” or “How do
you evaluate your performance on this task?” encourage the learner to reflect on
the effect of the tasks and their reactions to them in order to see the strengths and
weaknesses.
3. Upcoming Story: Questions such as “Where do you see this concept used?” or
“How will you approach the next task based on what you did this time?” encourage
the learner to see the big picture and plan ahead.

Throughout this book, I provide various examples of the concepts I am discussing. They are
almost always followed by tasks that expand on the examples or involve variations. In order
to successfully perform these and any future projects that use those concepts, you need
to (1) design and write the programs and (2) make sense of what you have done through
reflection. You will not learn programming by reading this or any other text. Learning to
program requires an experiential approach and thinking about what you have done, so you
understand the concepts. Reflective questions are provided throughout this book to help
with this learning approach. They are as important as writing the code itself. Feel free to
consider other reflective questions you may have and answer as many as you can.
After decades of doing software development and trying many different roles, I still find
programming a fascinating, rewarding, and enjoyable activity, which is a big part of my
life. I hope reading and using this book helps you discover and establish your own partner-
ship with it and develop skills that not only provide you with new professional options but
also help you be a stronger and more creative and logical problem-solver.
In the words of the iconic Mr. Spock who symbolized logical thinking for many of us,
“Live Long and Prosper.”

Ali Arya
April 2020, Ottawa
Acknowledgments

I always tell my students, “You don’t learn programming by listening to people or even by
reading sample codes. You learn by writing a lot of code and making sense of it.” Writing a
book about programming is somewhat similar but needs more. First, there is a significant
amount of listening, to people who are learning to see what they find hard or easy, and to
other instructors to learn from their experiences. Then there is the need to read a lot of
code by a lot of people to see what mistakes they make and what good solutions they use.
Finally, and after you make sense of all these and come up with a way of presenting your
thoughts, there must be many more conversations to make sure what you are saying makes
sense to others.
Writing this book was the result of many years spent doing all the things I mentioned
above, starting way before I thought about writing the book. From the first friend that I sat
with to share my limited knowledge to those who reviewed the final version of this text,
many were involved in shaping my understanding of programming and my approach to
teaching and learning it. The list is too long to include here. I am grateful to all of them, but
some I should mention.
Writing this book would not have been possible without the experience of working with
many students who attended my classes since I was a PhD student and particularly those at
the School of Information Technology, Carleton University. They helped me shape my ideas
about computer programming and how to learn it, and for that and their patience, support,
and advice, I am honored and grateful. Some of them shared my passion for programming,
and some didn’t (and occasionally got bored and fell sleep in class). Some ended up doing
(or surprisingly teaching) software development, and some didn’t write a single line of
code after graduation. Regardless, I am proud of them all. I hope to have contributed to
their lives and careers positively, not just through the practice of algorithmic thinking but
with our human interactions. I know I learned a lot from them, enjoyed those interactions
immensely, and will always strive to prepare a better learning environment where everyone
feels valued, understood, and supported. Hopefully, this book is a small step toward such
support. I would like to particularly thank Max Leeming, Marie-France Curtis, Geoffrey
Datema, and Alex Larocque for their direct assistance in creating the content of this book.
Many colleagues and academic reviewers also provided invaluable suggestions to
improve the content. I am grateful to all of them, especially Dr. David Sprague, whose
comments were essential in resolving some of the problems with this book.

xxvii
xxviii ◾ Acknowledgments

I would also like to thank the whole publishing team for their support and excellent
work. My special gratitude goes to my editor, Randi Cohen, for believing in my book idea
and guiding me through the process.
Last but certainly not least, for this book and many other good things in my life, I am
grateful to my wife, Luciara; my son, Caio; and our cats, Aztec and Daphne. I cannot
promise there won’t be any more late-night or weekend working (just like many other flaws
and weaknesses I have), but I know I can count on your support and forgiveness. Love you!
Another random document with
no related content on Scribd:
Pineria, 442
Pinna, 449;
shell, 254
Pinnoctopus, 385
Pinnotheres, 62
Pinoceras, 398
Pirena, 417
Pirenella, 416
Piropsis, 424
Pirula—see Pyrula
Pisania, 424
Pisidium, 453;
smell, 195;
ova, 146;
P. pusillum, distribution, 282
Pitys, 327
Placobranchus, 432
Placostylus, 322, 323–325, 359, 442;
radula, 233
Placuna, 448;
P. placenta used for windows, 101
Placunanomia, 448
Placunopsis, 448
Plagioptycha, 347–351, 441
Plagioptychus, 456
Planaxis, 417
Planispira, 311, 312, 319, 441
Planorbis, 27, 247, 439;
monstrosity, 93;
eye, 181;
P. albus, distribution, 282
Platyceras, 76, 412
Platydoris, 434
Platypoda, 411
Platyschisma, 413
Plaxiphora, 403
Plecochilus, 442
Plecotrema, 439
Plectambonites, 505
Plectomya, 459
Plectopylis, 303, 305, 314, 316;
aperture, 63
Plectostylus, 358, 442
Plectotropis, 305, 306, 310, 311, 314–318, 441
Plectrophorus, 298
Plesiastarte, 451
Plesiotriton, 420
Pleurobranchaea, 431;
jaws, 212
Pleurobranchoidea, 431
Pleurobranchus, 245, 428, 431;
warning coloration, 73;
jaws, 212;
radula, 230
Pleurocera, 340, 417
Pleuroceridae, origin, 17
Pleurodonta, 348;
aperture, 63
Pleuroleura, 433
Pleuromya, 458
Pleurophorus, 451
Pleurophyllidia, 433;
breathing organs, 159;
radula, 230
Pleuropyrgus, 357
Pleurotoma, 426, 426;
slit, 263, 265
Pleurotomaria, 266, 373, 376, 407, 407;
prices given for recent, 122;
slit, 156;
radula, 226
Plicatula, 450
Pliny the elder, on use of snails, 118, 120
Plocamopherus, 434
Plochelaea, 425
Plutonia, 298, 440
Pneumoderma, 158, 437, 438
Poecilozonites, 352, 440
Poisonous bite of Conus, 65;
poisonous oysters, 114;
mussels, 117
Polycera, 434;
radula, 230
Polycerella, 434
Polyconites, 456
Polydontes, 346–351, 347, 441
Polygona, 424
Polygyra, 340, 345–353, 441;
aperture, 63
Polygyratia, 246, 263, 357, 442
Polymita, 346–351, 347, 441
Polyplacophora, 9, 401 f.;
radula, 228
Polytremaria, 266, 407
Pomatia, 285, 293, 295, 441
Pomatias, 288, 289, 292 f., 302, 413
Pomatiopsis, 415
Pomaulax, 409
Pompholyx, 250, 341, 439
Ponsonbya, 332
Poromya, 459;
branchiae, 168
Porphyrobaphe, 27, 356, 442
Position of Mollusca in Animal Kingdom, 4
Potamides, 16, 416
Potamomya, 15
Potamopyrgus, 325, 326, 415
Poterioceratidae, 394
Praecardium, 459
Prasina, 449
Prices given for rare shells, 121
Primitive mollusc, form of, 245;
types of, 7
Prisogaster, 409
Pristiloma, 341, 440
Proboscidella, 497, 504
Productidae, 497, 500, 504, 508
Productus, 492, 501, 502, 504;
stratigraphical distribution, 508
Promachoteuthis, 389
Proneomenia, 404;
breathing organs, 154;
nervous system, 203;
radula, 229
Prophysaon, 341, 441;
habits, 44
Propilidium, 405
Proserpina, 21, 355, 410
Proserpinella, 354, 410
Proserpinidae, relationships, 21
Prosobranchiata, 9, 404 f.;
breathing organs, 154
Prosocoelus, 451
Protective coloration, 69 f.;
in snails, 70;
in Nudibranchs, 71 f.;
in other Mollusca, 74
Protegulum, 509
Protobranchiata, 447;
branchiae, 166
Protoma, 417
Protremata, 511
Provocator, 376, 425
Psammobia, 456
Pseudachatina, 328–330, 443
Pseudedmondia, 452
Pseudobalea, 350
Pseudo-deltidium, 498, 511
Pseudodon, 295, 307, 452
Pseudolamellibranchiata, 167, 449
Pseudoliva, 424
Pseudomelania, 417
Pseudomilax, 296, 440
Pseudomurex, 423
Pseudopartula, 323
Pseudosubulina, 440
Ptenoglossa, 224, 411
Pterinaea, 449
Pteroceras, 256, 262, 418
Pteroctopus, 384
Pterocyclus, 266, 267, 300, 316, 414;
tube, 157
Pterodonta, 418
Pteropoda, 7, 434;
breathing organs, 158;
foot, 200;
radula, 230
Pterotrachaea, 421;
foot, 200;
radula, 227
Ptychatractus, 424
Ptychoceras, 399
Ptychodesma, 452
Pugilina, 424
Pulmonata, 10, 22, 151, 185, 438;
origin, 17, 19;
breathing organs, 160;
nervous system, 203
Pulsellum, 444
Punctum, 441
Puncturella, 265, 406
Pupa, 289, 296, 325–357, 442;
P. cinerea, hybrid union, 129
Pupidae, radula, 233
Pupilla, 442
Pupillaea, 406
Pupina, 157, 266, 309, 318–327, 414
Pupinella, 318, 414
Purpura, 423;
operculum, 269;
erosion, 276;
P. coronata, 367;
lapillus, feeding on Mytilus, 60;
on oysters, 111;
protective coloration, 69;
variation, 90;
egg-capsules, 124;
time of breeding, 129;
distribution, 363 n.
Purpuroidea, 423
Pusionella, 426
Pygocardia, 451
Pygope, 497
Pyramidella, 422
Pyramidellidae, 262
Pyrazus, 50, 416
Pyrgina, 330
Pyrgula, 415
Pyrochilus, 441
Pyrolofusus, 423
Pyrula (= Pirula), 419, 420;
spawn, 125;
operculum, 269
Pythina, 453

Quenstedtia, 456
Quoyia, 260, 417

Rachiglossa, 220, 422;


eggs, 124
Rachis, 329–335, 441, 442
Radiolites, 456
Radius, 419
Radsia, 403
Radula, 213 f.;
of Littorina, 20;
of Cyclophorus, 21;
of parasitic Mollusca, 79
Raëta, 454
Ranella, 256, 420
Range of distribution, 362 f.
Rangia, 15, 453
Ranularia, 420
Rapa, 423
Rapana, 423
Raphaulus, 305, 309
Rathouisia, 316, 440
Rats devouring Mollusca, 57
Realia, 316, 327, 414
Recluzia, 411
Rectum, 241
Registoma, 414
Relationship of Mollusca to other groups, 5
Renssoellaria, 512
Reproductive activity of oyster, 112;
system in Mollusca, 123, 134 f.
Requienia, 269, 455, 455
Respiration, 150 f.
Retzia, 508
Revoilia, 331, 414
Reymondia, 332
Rhabdoceras, 398
Rhagada, 311, 324
Rhenea, 325, 440
Rhinobolus, 504
Rhiostoma, 247, 266, 309, 414
Rhipidoglossa, 225, 405
Rhizochilus, 75, 423
Rhodea, 356, 441
Rhodina, 307, 310, 442
Rhynchonella, 466, 470, 471, 472, 474, 483, 487;
distribution, 487;
fossil, 492, 497, 499, 505;
stratigraphical distribution, 506, 507, 508, 511
Rhynchonellidae, 487, 501, 505;
stratigraphical distribution, 507, 508, 511
Rhysota, 67, 310, 314, 316, 319, 440
Rhytida, 319–326, 333, 359, 440;
habits, 54;
radula, 232
Rillya, 442
Rimella, 418
Rimula, 265, 406
Ringicula, 430;
radula, 230
Risella, 413
Rissoa, 415
Rissoina, 415
Robillardia, 77
Rochebrunia, 331, 414
Rock-boring snails, 49
Rolleia, 349
Rossia, 389
Rostellaria, 418
Rudistae, 456
Rumina, 260, 442
Runcina, 431;
protective coloration, 73

Sabatia, 430
Sactoceras, 394
Sagda, 348–351, 441
Sageceras, 398
Salasiella, 353, 440
Salivary glands, 237
Sandford, on strength of Helix, 45
Sandwich islanders, use of shells, 99
Sanguinolaria, 456
Sarepta, 447
Sarmaticus, 409
Satsuma, 314, 316, 441
Saxicava, 447, 457
Saxidomus arata, money made from, 97
Scalaria, 247, 263, 411;
radula, 224
Scaldia, 452
Scalenostoma, 422
Scaliola, 415
Scaphander, 428, 429, 430;
radula, 231;
gizzard, 238
Scaphites, 399, 399
Scaphopoda, 444;
defined, 6;
breathing organs, 160;
nervous system, 205;
radula, 236
Scaphula, 14, 305, 448
Scarabus, 18, 278, 439, 439
Scharff, R., on food of slugs, 31;
on protective coloration in slugs, 70
Schasicheila, 347, 351, 354, 410
Schismope, 266, 407
Schizochiton, 187, 402, 403
Schizodus, 448
Schizoglossa, 325, 440
Schizoplax, 403
Schizostoma, 413
Schloenbacia, 398
Scintilla, 175, 453
Scissurella, 265, 407;
radula, 226
Sclerochiton, 403
Scrobicularia, 15, 164, 453;
siphons, 164
Sculptaria, 333
Scurria, 405
Scutalus, 356, 442
Scutellastra, 405
Scutus, 245, 406, 406
Scyllaea, 433;
jaws, 212;
stomach, 239
Segmentina, 320
Selenites, 339, 341, 440
Selenitidae, radula, 231
Selenochlamys, 296
Self-fertilisation, 42–44
Semele, 453
Semicassis, 420
Semper, K., on habits of Limnaea, 34;
of Helicarion, 45, 67;
on mimicry, 67;
on parasitic Eulima, 79;
on development of Limnaea, 84, 94;
on sexual maturity in snails, 129;
on Onchidium, 187
Sepia, 381, 385–387, 389;
egg-capsules, 127;
glands, 136;
jaws, 214;
radula, 236;
alimentary canal, 238;
ink-sac, 241;
hectocotylus, 389
Sepiadarium, 389
Sepiella, 389
Sepiola, 389;
glands, 136;
radula, 236
Sepioloidea, 389
Sepiophora, 388
Sepioteuthis, 390;
hectocotylus, 139
Septaria, 337, 338, 410
Septibranchiata, 145, 167, 459;
branchiae, 166
Septifer, 274, 449
Sequenzia, 420
Sergius Orata, 104
Serrifusus, 424
Sesara, 305, 440
Sex, differences of, 133
Shell, 244 f.;
internal, 174;
shape of bivalve, 445
Shell-gland, primitive, 132
Shells as money, 96 f.;
as ornament, etc., 98 f.;
various uses of, 98 f.;
prices given for rare, 121;
sinistral, 249
Shores of N. Asia, no littoral fauna, 2
Showers of shells, 47
Sigaretus, 186, 245, 267, 411;
foot, 198
Sight, 180
Silenia, 459;
branchiae, 168
Silia, 425
Siliqua, 274, 457
Siliquaria, 248, 418
Simnia, 419
Simpulopsis, 345, 350, 442
Simpulum, 420
Simroth, on recent forms of Helix, 22;
on food of slugs, 31;
on crawling of Helix, 45
Singular habitat, 48
Sinistral shells, 249
Sinistralia, 424
Sinusigera, 133
Sipho, 424
Siphonalia, 424
Siphonaria, 18, 431;
classification, 19;
breathing organs, 151, 152
Siphonarioidea, 431
Siphonodentalium, 444
Siphonostomata, 156
Siphonotreta, 493, 496, 504;
stratigraphical distribution, 507, 508
Siphons, 173;
in burrowing genera, 165;
branchial, 155
Sistrum, 75, 423;
radula of S. spectrum, 79, 222
Sitala, 301, 304, 310, 314–319, 333, 440
Skärgard, Mollusca of the, 13
Skenea, 415
Skenidium, 505, 508
Slit, in Gasteropoda, 265, 406
Slugs, habits and food of, 30 f.;
bite hand of captor, 33;
in bee-hives, 36;
in greenhouses, 36;
protective coloration, 70;
eaten in England, 120
Smaragdia, 21
Smaragdinella, 430
Smell, sense of, 192
Smith, W. Anderson, quoted, 98, 111, 114, 191
Snails as barometers, 50;
plants fertilised by, 102;
cultivation for food, 118 f.;
used for cream, 119;
as medicine, 120;
banned by the Church, 121
Solariella, 408;
radula, 225
Solarium, 264, 412, 413;
radula, 224
Solaropsis, 343, 353–357, 442
Solecurtus, 165, 457
Solen, 171, 446, 457;
vision, 190;
habits, 45
Solenaia, 452
Solenomya, 275, 448
Solenotellina, 456
Solomon islanders, use of shells, 98
Somatogyrus, 415
Sophina, 305
Spallanzani, experiments on Helix, 163
Spat, fall of, 113
Spatha, 294, 331, 336, 452
Spekia, 333
Spermatophore, in Cephalopoda, 137;
in Helix, 142
Spermatozoa, forms of, 136
Sphaerium, 453
Sphenia, 456
Sphenodiscus, 398
Sphyradium, 442
Spines, use of, 64
Spiraculum, 266, 414
Spiraxis, 442
Spirialis, 249
Spirifera, 468, 501, 505;
stratigraphical distribution, 507, 508, 511, 512
Spiriferidae, 501, 505, 508
Spiriferina, stratigraphical distribution, 507, 508
Spirobranchiata, 464
Spirotropis, 426;
radula, 218, 219
Spirula, 247, 386, 387, 388
Spirulirostra, 380, 386, 388
Spondylium, 500
Spondylus, 257, 446, 450, 450;
ocelli, 191;
genital orifice, 242
Spongiobranchaea, 437
Spongiochiton, 403
Sportella, 453
Starfish eat oysters, 110
Stearns, R. E. C., on tenacity of life, 38
Stegodera, 306
Stenochisma, 505;
stratigraphical distribution, 507, 508
Stenogyra, 324, 442;
S. decollata, 279;
food, 34;
smell, 194;
Goodallii, 279;
octona, sudden appearance, 47
Stenogyridae, radula, 234
Stenopus, 440;
habits, 45
Stenothyra, 415
Stenotis, 416
Stenotrema, 340, 441
Stephanoceras, 399
Stepsanoda, 358
Stilifer, 76, 77, 79, 422
Stiliferina, 76, 422
Stiliger, 432
Stilina, 76
Stoastoma, 348–351, 410
Stoloteuthis, 389
Stomach, 239
Stomatella, 408
Stomatia, 408
Stomatodon, 302, 417
Strebelia, 353, 440
Strength of Helix, 45
Strephobasis, 417
Strepsidura, 424
Streptaulus, 414
Streptaxis, 302, 306, 309, 314–331, 343, 357–359, 440;
variation, 87
Streptoneura, 203, 404
Streptosiphon, 424
Streptostele, 329, 338, 440
Streptostyla, 343–355, 353, 440
Stricklandia, 505;
stratigraphical distribution, 507, 508
Strigatella, 425
Stringocephalidae, 506, 508
Stringocephalus, 492, 497, 498, 500, 501, 506;
stratigraphical distribution, 507, 508
Strobila, 340, 345–353
Strobilops, 442
Strombidae, habits, 64;
penis, 136
Strombina, 423
Strombus, 69, 200, 252, 418;
mimicking Conus, 69;
operculum, 78, 269;
pearls from, 101;
metapodium, 199;
stomach, 239
Strophalosia, 504;
stratigraphical distribution, 507, 508
Stropheodonta, 497, 505, 508
Strophia, 343–355, 442;
S. nana, 278
Strophochilus, 358, 441
Strophomena, 499, 505;
stratigraphical distribution, 507, 508
Strophomenidae, 500, 505, 508
Strophostoma, 248, 414
Structure of shell, 252
Struthiolaria, 99, 418;
radula, 216
Styliola, 437
Stylodonta, 339, 441
Stylommatophora, 11, 181, 439;
origin, 19
Subemarginula, 406
Submytilacea, 451
Subularia, 422
Subulina, 332, 352, 442
Subulites, 420
Succinea, 325, 327, 358, 433;
jaw, 211;
S. putris, parasite of, 61
Succineidae, 443;
radula, 234
Sudden appearance of Mollusca, 46
Suessia, stratigraphical distribution, 507
Sulphuric acid, 237
Surcula, 426
Sycotypus, 424
Synaptocochlea, 408
Syndosmya, 453
Syringothyris, 500, 508
Syrnola, 422
Syrnolopis, 332, 333
Systrophia, 356, 357

Tachea, 441
Taenioglossa, 223, 411
Taheitia, 414
Talona, 457
Tanalia, 304, 417
Tancredia, 453
Tanganyicia, 332, 415
Tanganyika, L., fauna of, 12
Tanysiphon, 454
Taonius, 391, 391
Tapes, 454
Taste, 179
Tebennophorus, 143, 340, 440
Tectarius, 413
Tectibranchiata, 10, 429
Tectura, 305, 405
Tectus, 408
Teeth in aperture of the shell, 63
Teinostoma, 247, 408
Teinotis, 407
Telescopium, 252, 416
Tellina, 440, 453, 453
T. balthica, variation, 84
Tellinacea, 453
Telotremata, 511
Tenacity of life, 37
Tenison-Woods, on red blood, 171;
on shell-eyes, 189
Tennent, Sir J. E., on musical sounds produced by Mollusca, 50
Tennentia, 304, 314, 338, 440
Terebellum, 418;
jumping powers, 64
Terebra, 246, 263, 426, 426;
radula, 219
Terebratella, 468, 487;
distribution, 486;
fossil, 506;
stratigraphical distribution, 508
Terebratula, 467, 468, 487;
size, 484;
distribution, 485, 486;
fossil, 492, 499, 506;
stratigraphical distribution, 506, 507, 508
Terebratulidae, 487;
fossil, 500, 505, 506;
stratigraphical distribution, 507, 508
Terebratulina, 466, 479, 487;
larva, 482;
distribution, 486;
fossil, 506;
stratigraphical distribution, 508;
form of shell, 510
Teredina, 457
Teredo, 262, 457, 458;
nervous system, 206;
intestine, 241
Tergipes, 432
Terquemia, 450
Testacella, 22, 52, 440;
habits, etc., 49, 51 f.;
pulmonary orifice, 160;
eyes, 186;
radula, 231;
anus, 241
Testicardines, 466, 487;
muscles, 476;
fossil, 497, 504;
external characters, 497;
internal characters, 499;
attachment of muscles, 501;
stratigraphical distribution, 508
Testis, 135
Tethyidae, 216
Tethys, 432
Tetrabranchiata, 391 f.
Thala, 425
Thalassia, 319
Thalotia, 408
Thapsia, 329
Thaumasia, 349, 442
Thaumastus, 356, 442
Thecacera, 434;
radula, 229
Thecidiidae, 487;
fossil, 501, 506, 508
Thecidium, 475, 479, 480, 483, 487;
fossil, 506, 508
Thecosomata, 435
Thelidomus, 346–351, 350, 441
Theora, 453
Therasia, 441
Thersites (Helicidae), 322, 325
Thersites (Fasciolariidae), 424
Thetis, 454
Thracia, 245, 459
Thread-spinning, 29
Thridachia, 432
Thyca, 76, 79
Thyrophorella, 330, 440
Thysanoteuthis, 390
Tiedemannia, veliger, 132
Tiphobia, 332, 333, 417
Titicaca, L., Mollusca of, 25
Todarodes, 390
Tomichia, 414
Tomigerus, 334, 356, 358, 442
Tomocyclus, 354
Tomostele, 330, 440
Tonicella, 403
Tonicia, 403;
eyes, 188
Torellia, 411
Torinia, 413;
radula, 224;
operculum, 269
Tornatellina, 278, 319, 323–327, 338, 358, 443
Tornatina, 250, 430
Torquilla, 442
Toucasia, 455
Touch, sense of, 177
Toxoglossa, 218, 426
Trachia, 314
Trachyceras, 397
Trachydermon, 403
Trachyteuthis, 389
Tralia, 439
Transovula, 419
Trematis, 492, 493, 504;
stratigraphical distribution, 507, 508
Trematonotus, 407
Tremoctopus, 384;
radula, 236;
hectocotylus, 137
Trevelyana, 434
Trichia, 316
Trichotropis, 275, 411
Tricula, 302
Tridacna, 273, 455
Triforis, 416;
radula, 224
Trigonellites, 397
Trigonia, 15, 254, 269, 448;
jumping powers, 65;
distribution, 370
Trigonochlamys, 296, 440
Trigonostoma, 426
Trimerella, 495, 504, 508, 511
Trimerellidae, 493, 494, 496, 504;
stratigraphical distribution, 507, 508
Trinacria, 448

You might also like