computer_science_programming_basics_in_ruby.pdf

(7800 KB) Pobierz
www.it-ebooks.info
www.it-ebooks.info
Computer Science Programming
Basics with Ruby
Ophir Frieder, Gideon Frieder, and David Grossman
www.it-ebooks.info
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
April 2013:
First Edition
Cover Designer:
Randy Comer
Interior Designer:
David Futato
Illustrators:
Rebecca Demarest and Kara Ebrahim
Revision History for the First Edition:
2013-04-15:
First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449355975
for release details.
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]
www.it-ebooks.info
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1. Introduction to Computer Science. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Introduction
1.2 Application Development
Step 1: Understand the Problem
Step 2: Write Out the Solution in Plain Language
Step 3: Translate the Language into Code
Step 4: Test the Code in the Computer
1.3 Algorithms
1.3.1 Algorithm Efficiency
1.4 Summary
1.4.1 Key Concepts
1.4.2 Key Definitions
1.5 Exercises
1
2
2
3
3
4
4
5
6
6
7
7
2. How Does the Computer Really Work?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1 Introduction
2.2 Basic Nomenclature and Components of a Computer System
2.3 Scales of Magnitude
2.4 Instruction Execution—Speed and Timing Scales
2.5 Bit Strings and Their Meaning
2.6 The Interpreter Process and Ruby
2.7 Summary
2.7.1 Key Concepts
2.7.2 Key Definitions
2.8 Exercises
11
11
14
16
17
19
21
21
22
22
3. Core Programming Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
iii
www.it-ebooks.info
Zgłoś jeśli naruszono regulamin