Computer Science Programming Basics With Ruby

                           Introduction


Introductory students often confuse programming with computer science, but programming is merely a strategy to implement computer science concepts.


We introduce the basics of computer science using the Ruby programming language. Given our goal, we intentionally forgo many of the intricacies of the language.


Computer science is never tied to a programming language; it is tied to the task of solving problems efficiently using a computer.


A computer comes with some resources, which will be discussed in Chapter 2, such as internal memory for short-term storage, processing capability, and long-term storage devices. A complete program is a set of instructions that use the computer to solve a real problem.


The tool for producing these instructions is called a programming language. The goal is to develop solutions that use these resources efficiently to solve real problems.


Programming languages come and go, but the essence of computer science stays the same. If we need to sort a sequence of numbers, for example, it is immaterial if we sort them using programming language A or B. The steps the program will follow, commonly referred to as the algorithm, will remain the same.


Hence, the core goal of computer science is to study algorithms that solve real problems. Computer scientists strive to create a correct sequence of steps that minimize resource demands, operate in a timely fashion, and yield correct results.


Algorithms are typically specified using pseudocode. Pseudocode, which may itself be simply written in plain language, specifies the logical, conceptual steps that must occur without specifying the necessary details needed to actually execute each step.


However, we think that a properly selected subset of Ruby is sufficiently simple to introduce the algorithms.


So, instead of creating an algorithm by writing it in plain language, generating equivalent pseudocode, and transforming it into a programming language, we go straight from the plain-language definition of an algorithm to Ruby code.

Customer Reviews