Processing
eBook - ePub

Processing

An Introduction to Programming

  1. 544 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Processing

An Introduction to Programming

About this book

This book demonstrates how Processing is an excellent language for beginners to learn the fundamentals of computer programming. Originally designed to make it simpler for digital artists to learn to program, Processing is a wonderful first language for anyone to learn. Given its origins, Processing enables a multimodal approach to programming instruction, well suited to students with interests in computer science or in the arts and humanities.

The book uses Processing's capabilities for graphics and interactivity in order to create examples that are simple, illustrative, interesting, and fun. It is designed to appeal to a broad range of readers, including those who want to learn to program to create digital art, as well as those who seek to learn to program to process numerical information or data. It can be used by students and instructors in a first course on programming, as well as by anyone eager to teach them self to program.

Following a traditional sequence of topics for introducing programming, the book introduces key computer science concepts, without overwhelming readers with extensive detail. The conversational style and pace of the book are based upon the authors' extensive experience with teaching programming to a wide variety of beginners in a classroom. No prior programming experience is expected.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Processing by Jeffrey L. Nyhoff,Larry R. Nyhoff in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Graphics. We have over one million books available in our catalogue for you to explore.
CHAPTER 1
Basic Drawing in Processing
We’ll now put aside the advanced capability associated with the looping draw() function and Processing’s active mode that we explored at the end of the introduction. We will return instead to Processing’s simpler static mode and work through some simple examples of basic drawing in Processing. These examples will also give us the opportunity to take a closer look at some of the fundamentals of computer programming in general.
This chapter is not an exhaustive introduction to Processing’s extensive drawing capabilities. Rather, the goal is to give you enough of a foundation in drawing with Processing to understand the graphical examples in the chapters that follow.
Starting a New Program
In the Processing window, pull down the File menu and select New.
image
From now on, we will describe such a menu selection as File > New.
We now see a new Processing sketch window:
image
Saving a Program
When starting a new program, it is a good idea to save it promptly and then to save it frequently after making changes to the program. “Save early and often!” is how this strategy is sometimes stated. This is good advice that can help to spare you from losing work that you have done. Saving a program in Processing is very much the same process as saving your work in other software that you use. Select File > Save. Since this is the first time you are saving this program, the “Save sketch folder as…” dialog box appears.
image
Using this dialog, start by choosing the file folder location where you would like to save the Processing program that you are currently writing. By default, Processing will save all your sketches (programs) in a file location that is known as your Sketchbook. This Processing program setting that specifies this default Sketchbook file location can be changed if you plan to save your Processing programs in a different location.* You can also just browse to the desired file folder location in the manner that you usually do when saving your work in other software programs that you use.
Next, in the File name textbox within the dialog box, enter a name for your program. It is customary to capitalize the first letter of a Processing program. Let’s name this example Drawing.
image
Then, click on the Save button to finish saving this program.
image
As a result, Processing creates a new folder in which your program is stored. This folder has the same name as that which you gave to your program. Thus, in this example, the new folder is named Drawing.
image
Processing calls this the sketch folder. If you examine the contents of ...

Table of contents

  1. Cover
  2. Half-Title
  3. Title
  4. Copyright
  5. Contents
  6. Foreword
  7. Preface: Why We Wrote This Book and For Whom It Is Written
  8. Acknowledgements
  9. Introduction: Welcome to Computer Programming
  10. Chapter 1 ▪ Basic Drawing in Processing
  11. Chapter 2 ▪ Types, Expressions, and Variables
  12. Chapter 3 ▪ More about Using Processing’s Built-In Functions
  13. Chapter 4 ▪ Conditional Programming with if
  14. Chapter 5 ▪ Repetition with a Loop: The while Statement
  15. Chapter 6 ▪ Creating Counting Loops Using the for Statement
  16. Chapter 7 ▪ Creating void Functions
  17. Chapter 8 ▪ Creating Functions That Return a Value
  18. Chapter 9 ▪ Arrays
  19. Chapter 10 ▪ Introduction to Objects
  20. INDEX