Computer Science Programming Basics in Ruby.pdf

(7825 KB) Pobierz
1066803811.001.png
1066803811.002.png
Computer Science Programming
Basics with Ruby
Ophir Frieder, Gideon Frieder, and David Grossman
1066803811.003.png
Computer Science Programming Basics with Ruby
by Ophir Frieder, Gideon Frieder, and David Grossman
Copyright © 2013 Ophir Frieder, Gideon Frieder, and David Grossman. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles ( http://my.safaribooksonline.com ) . For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com .
Editors: Simon St. Laurent and Meghan Blanchette
Production Editor: Holly Bauer
Copyeditor: Audrey Doyle
Proofreader: Julie Van Keuren
Cover Designer: Randy Comer
Interior Designer: David Futato
Illustrators: Rebecca Demarest and Kara Ebrahim
April 2013:
First Edition
Revision History for the First Edition:
2013-04-15:
First release
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc. Computer Science Programming Basics in Ruby , the image of a common Creeper, and related
trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-35597-5
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1.
Introduction to Computer Science. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Introduction 1
1.2 Application Development 2
Step 1: Understand the Problem 2
Step 2: Write Out the Solution in Plain Language 3
Step 3: Translate the Language into Code 3
Step 4: Test the Code in the Computer 4
1.3 Algorithms 4
1.3.1 Algorithm Efficiency 5
1.4 Summary 6
1.4.1 Key Concepts 6
1.4.2 Key Definitions 7
1.5 Exercises 7
2.
How Does the Computer Really Work?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1 Introduction 11
2.2 Basic Nomenclature and Components of a Computer System 11
2.3 Scales of Magnitude 14
2.4 Instruction Execution—Speed and Timing Scales 16
2.5 Bit Strings and Their Meaning 17
2.6 The Interpreter Process and Ruby 19
2.7 Summary 21
2.7.1 Key Concepts 21
2.7.2 Key Definitions 22
2.8 Exercises 22
3.
Core Programming Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
iii
1066803811.004.png
 
Zgłoś jeśli naruszono regulamin