Getting started with programming - Rémy Lentzer - E-Book

Getting started with programming E-Book

Remy Lentzer

0,0

Beschreibung

This book is intended for anyone who wants to study the principles of writing code. The important thing is to think well before programming. After a brief history of the development of calculators and computers, you will learn how to design algorithms using everyday examples, such as a recipe of a cheese soufflé, a bubble sort, and a sequential and dichotomous method to sort out numbers in a list. You will discover how to program with Excel VBA and JavaScript adapted to Google Sheets. The objective of this manual is to help you understand how to automate repetitive tasks, while discovering the world of variables, loops, conditions, functions and procedures. Finally, because Internet pages are part of our daily lives, HTML and CSS will also be introduced.

ABOUT THE AUTHOR

Rémy Lentzner has been a computer trainer since 1985. Specialized in the mastery of office automation tools, he assists companies in the professional training of their employees. Self-taught, he has some fifteen computer books to his credit.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern
Kindle™-E-Readern
(für ausgewählte Pakete)

Seitenzahl: 92

Das E-Book (TTS) können Sie hören im Abo „Legimi Premium” in Legimi-Apps auf:

Android
iOS
Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



REMY LENTZNER

Getting started with programming

French original title : Bien débuter en programmation

EDITIONS REMYLENT, Paris, 1ère édition, 2021

R.C.S. 399 397 892 Paris

25 rue de la Tour d’Auvergne - 75009 Paris

[email protected]

www.REMYLENT.FR

ISBN EPUB : 9782490275557

The Intellectual Property Code prohibits copies or reproductions intended for collective use. Any representation or reproduction in whole or in part by any means whatsoever, without the consent of the author or his successors in title or cause, is unlawful and constitutes an infringement, pursuant to articles L.335-2 and following of Intellectual Property Code.

This book is dedicated to Anna and Tama.

I could not have written it without their support, advice, encouragements and proofreading.

Graphic illlustration : Anna LENTZNER

In the same collection

Improve your PivotTables with Excel

Improve your skills with Google Sheets

Programming macros with Google Sheets

Getting started with HTML

Getting started with JavaScript

Getting started with PHP & MySQL

Google Docs

Google Slides

Google Gmail

The macros VBA with Excel

Getting started with WordPress

Table of contents

Chapter 1 A bit of hindsight

1.1 A slow evolution

1.2 What's in a computer?

1.2.1 The I/O architecture

1.2.2 Computer units

1.2.3 The languages

1.2.4 HTML

Chapter 2 Analysis and algorithms

2.1 Thinking and analyzing before acting

2.1.1 The recipe analysis of a cheese soufflé

2.1.2 Sorting out numbers

2.1.3 The bubble sort moves numbers

2.2 Programming a sort

2.2.1 Bubble sort with Excel VBA language

2.2.2 Bubble sort with JavaScript for Google Sheets

2.3 Two algorithms for searching data

2.3.1 The sequential research

2.3.2 Programming with Excel VBA

2.3.3 Programming with Google Sheets JavaScript

2.3.4 The dichotomous research

2.3.5 Dichotomy with Excel VBA

2.3.6 Dichotomy with JavaScript

Chapter 3 Getting started with VBA

3.1 The VBA environment

3.1.1 Tools for handling macros

3.1.2 Recording a macro

3.1.3 The XLSM file type and the macro security

3.1.4 Using relative references

3.2 Writing macros

3.2.1 A macro that empties cells

3.2.2 Running a code from a command button

3.2.3 Learning VBA by recording macros

3.3 VBA is an oriented object language

3.3.1 The Object Browser

3.3.2 Properties and methods

3.3.3 Events in a sheet

3.3.4 The component libraries

3.3.5 From Excel to Outlook

3.4 Calculations and formulas

3.5 Layout and printing

3.5.1 The layout menus

3.5.2 The Page Setup

3.5.3 Programming printing

3.6 Variables and loops

3.6.1 The variable declaration

3.6.2 The loops

The For...Next loop

For next and Select Case

For next and If..ElseIf

The Do While...Loop

The For each loop

3.7 Searching with the FIND method

Chapter 4 HTML

4.1 A markup language

4.2 HTML is a scripting language

4.3 CSS styles sheets

4.3.1 The cascade

4.3.2 Inheritance

INTRODUCTION

This book is for anyone who wants to understand how to write a program. Computer scientists spend a lot of time thinking about the sequence of actions they want to automate before coding in a specific language. Usually, writing a program is the last step in a personal or collective intellectual journey. Before coding, it is necessary to lay out on paper the different modules that the future application will contain.

If we analyze the function of a spreadsheet or a word processor, we understand quite quickly that the first one will be exclusively adapted to numbers and the second one to texts. The functions that are available for the calculations and texts are very complex. They are the result of a collaboration between lots of programmers over decades.

A program, no matter how complicated, is always a series of code modules that can be used separately. For instance in Google Gmail, when you decide to send a new message, Gmail gets the module that handles the creation of the new mail, stores it in memory, activates it then gives you the possibility to enter your information.This principle of modules calling each other is always the same. They are available and called to render a service. Writing programs also requires rigor to avoid redundancies and errors. It is an activity that may seem difficult, but it is exciting and helps to understand any complexity.

A global approach of programming requires taking ownership of the computer world into account and learning a little bit of its history and how it works.

It is by digging into the past that we can discover the fantastic evolution of computer techniques, especially in the age of the Internet.

This book is structured into 4 chapters.

Chapter 1 recalls some historical notions, describes the design of a computer and the units in computer science, then details the diversity of programming languages.

Chapter 2 explains the meaning of algorithms, i.e. the steps to think about, in order to establish a sequence of repetitive tasks. You will discover how to create a recipe for acheese soufflé. You will also be able to compare two programming languages: Excel VBA and JavaScript with Google Sheets. You will study how to sort out numbers with the bubble sort technique and how to find a value in a table with both the sequential and dichotomous methods.

Chapter 3 takes up indepth the programming notions studied previously, using the environment of the Excel VBA language under Windows. You will learn how to create macros, manipulate variables, control structures and functions. You will also work on Excel spreadsheet objects.

Chapter 4 shows the techniques for writing Internet pages using HTML and CSS.

I hope that this book will give you a better understanding of what programming is all about.

Do not hesitate to contact me at [email protected] if you have any comments or questions.

I will be sure to answer you.

Enjoy your reading.

The author

Chapter 1 A bit of hindsight

For a very long time, people have been counting and calculating in many ways. First on their fingers, then with stones, later with wheels and gears and so on. Later on, calculating machines, computers and even mentally with a pencil were introduced as calculation methods.

This chapter recalls some of the historical steps that led us to the Internet and the tremendous development that followed.

1.1 A slow evolution

One can imagine that prehistoric men and women counted with fingers and certain parts of the body, such as the phalanges of the hand. We know, however, that they cut lines on bones or wood, probably to make it easier to count cattle, for example.

Later on, the head boss of this time improved their skills by using seeds, shells, balls, tokens, but especially pebbles, that is said to be calculi in Latin. In order to be able to quickly calculate numbers, our accountants have been manipulating abacuses or counting tables for more than 2000 years. Today, we continue to use abacuses to find results easier, thanks to the system of the retainer.

From the 17th century onwards, calculating machines came into being, such as the Pascaline, Blaise Pascal's arithmetic machine created around 1642. As a result, wheels and gears were designed and implemented for these machines.

The young Pascal invented his machine to facilitate the financial calculations of his father, a tax collector at the time of Richelieu in Normandy.

Figure 1.1 : The Pascaline

In such a device, the wheels are numbered and connected to each other by gears, with an internal mechanism that tilts the retainer from wheel to wheel. Other more complex inventions were later created to make multiplications, but there was no repetitive task in such machines. The use of perforated cards in Joseph-Marie Jacquard's loom allowed people to control the machine to weave any pattern, since it was sufficient to change the group of cards.

Figure 1.2 : Perforated cards for loom programming

The idea was to identify the presence or absence of a hole in certain areas to transmit information to the mechanical wire processing device. This principle of cards is found in mechanical pianos, since a melody can be memorized in more complex cards.

Figure 1.3 : A card unwinding system for a player piano

A hole gives information or its absence gives the opposite information. Thus, it is the "I pass or I don't pass" principle. The end of the 19th century was rich in theoretical developments of this logic, in particular with Georges BOOLE (1815-1864) professor at Queen's College in Ireland, who defined a new logical approach, based on three operators OR, AND and NOT.

To the question is 1=1 true ?, the answer is inevitably yes. To the question is 3=1 true ?, the answer is no (or false). This boolean logic enables you to define logical states and truth tables, defined in the BOOLE algebra.

Figure 1.4 : Truth tables

This binary logic (1 or 0) is naturally found in the properties of the electric current, that passes or not through a circuit. It is this logic that will be applied to computers.

The history of computer science shows that the evolution of machines has only taken place in parallel with the technology evolution. In 1946, a huge calculator called ENIAC (Electronic Numerical Integrator and Calculator) at the University of Pennsylvania made ballistic calculations for the military. This machine weighed 30 tons and covered an area of 165 square meters.

Figure 1.5 : The ENIAC calculator in 1946. Source https://fr.wikipedia.org/wiki/ENIAC#/media/Fichier:Eniac.jpg

It took a lot of time and effort to make these machines fully integrated into our environment today, because those features were neither small nor powerful. As for the ENIAC calculator technicians, countless people have worked extremely hard for decades to learn computer languages and develop applications. This result has made possible the appearance of the Internet, cell phones, tablets, Apple or Microsoft products, Facebook, digital television, e-mail, GPS, microwave ovens and many other devices.

1.2 What's in a computer?

A computer is a machine that contains hard and soft components. In other words, physical hardware and programs that are also called software. The heart of a computer is a microprocessor or CPU, for Central Processing Unit. This microchip is responsible for performing arithmetic and logical processing on astronomical quantities of binary values 1 and 0. For example, when you press a key on your keyboard, it is immediately transformed into a code, then into 1 or 0. The microprocessor can only read binary and that is why chips are physically created with pins that allow information to enter and exit at an extremely high speed. A microprocessor is capable of handling millions of operations per second.

1.2.1 The I/O architecture

The architecture of computers is based on the so-called Von Neumann model. John Von Neumann (1903-1957) was an American mathematician of Hungarian origin who worked in the ENIAC project then participated in the creation of the first atomic bomb at Los Alamos.

Together with his colleagues, he had the idea of separating the data itself (the 1 and the 0 that compose numbers, texts, images, sound, videos, etc.) from the programs, i.e. the instructions that enable someone to manipulate the data. These two parts were found in the heart of the system: the motherboard. It is the main component of a computer that contains a very large number of electronic chips and devices required for inputing and outputing information, like images that are to be displayed to the screen.