Що таке комп’ютерне програмування? Визначення розробки програмного забезпечення.

Мій п'ятирічний син Рамі підійшов до мене одного дня, коли я працював вдома, і запитав: "Що ти робиш, мамо?"

"Я працюю", - відповів я.

Він подивився на екран мого ноутбука і знову запитав: "Але що ти робиш ?"

Я зупинився і почав думати про це. Я веб-розробник і програмую на JavaScript. Як пояснити це п’ятирічному?

“Я пишу інструкції для комп’ютера, і комп’ютер виконує те, що я йому наказую. Це називається програмуванням », - пояснив я. Рамі виглядав спантеличеним.

Я продовжив: “Наприклад, я можу дати комп’ютеру вказівки додати два числа, і це дасть мені відповідь”. Я написав функцію, яка додала 2 + 2 і показала йому відповідь на моєму екрані. Очі його засвітились.

З цього моменту я почав думати, що таке програмування ? Що насправді відбувається під капотом? Коли я вперше почав вчитися кодувати в 2017 році на freeCodeCamp, я використовував вбудований редактор коду на веб-сайті і бачив результати. Однак я не дуже розумів магію, яка творилася за лаштунками.

Я почав проводити деякі дослідження, і це деякі терміни, які я шукав: «Що таке комп’ютерне програмування? Що таке програмне забезпечення? " У Google є понад 600 мільйонів результатів пошуку “Що таке комп’ютерне програмування?” Це трохи схоже на спуск по кролячій норі - це може бути складно і переважно.

Я хотів скласти всебічне вступ до того, що таке програмування та розробка програмного забезпечення для початківців. Почну з комп’ютерного програмування, а потім розгляну мови комп’ютерного програмування. Тоді я поговорю про програмне забезпечення та розробку програмного забезпечення. Нарешті, я перейду до сучасних тенденцій та майбутнього комп’ютерного програмування.

Якщо ви думаєте про перехід у світ програмування або просто зацікавлені в тому, щоб навчитися кодувати, це дасть вам загальний огляд, без (занадто!) Технічного жаргону.

Зазначимо лише одне: ви можете використовувати слова "Розробник" та "Програміст", щоб означати того, хто пише код.

Що таке комп’ютерне програмування?

У Вікіпедії визначення «комп’ютерне програмування»:

«Комп’ютерне програмування - це процес проектування та побудови виконуваної комп’ютерної програми для досягнення певного обчислювального результату».

Але що це означає?

Сам комп'ютер не є розумним. Так, вони потужні і здатні виконувати завдання набагато швидше, ніж люди. Але комп’ютерам потрібна людина, щоб написати інструкції та сказати, що робити.

Тому програмування - це процес написання цих інструкцій. Для цього ми використовуємо мову програмування. Ці інструкції перекладені в читабельний формат, який комп’ютер може зрозуміти. Потім інструкції виконує комп'ютер.

Програмування, як зробити чашку чаю

Візьмемо як приклад приготування чашки чаю. Якби ви дали вказівки, як приготувати чашку чаю, це виглядало б так:

  1. Закип’ятити трохи води
  2. Налийте гарячої води в чашку з пакетиком чаю
  3. Дайте чаю настоятися
  4. Вийміть пакетик
  5. Додати молоко та / або цукор (за бажанням)

Просто, правда?

Ми сприймаємо як належне те, що спілкування з людиною відрізняється від спілкування з комп’ютером. Людина має попередні знання та життєвий досвід - вони можуть знати, де знайти чай. Ми припускаємо, що вони знають, що молоко зберігається в холодильнику.

Люди також мають інтуїцію. Якщо ви не можете знайти чашку, ви можете замість цього здійснити пошук у шафах. Існує також читання невербальних реплік людей, таких як мова тіла.

Що стосується програмування, то ви повинні бути дуже конкретними. Продовжуючи те, як приготувати чашку чаю, ви можете написати інструкції в псевдокоді, як це

  1. Йди на кухню
  2. Знайдіть чайник
  3. Відкрийте кришку чайника
  4. Наповніть чайник водою
  5. Увімкніть чайник
  6. Зачекайте, поки він закипить до 100 градусів Цельсія
  7. Знайди чашку

І так далі.

Що робити, якщо інструкцій, наведених вище, недостатньо? Можливо, вам доведеться додати трохи логіки, щоб врахувати всі сценарії. Наприклад: 2) Знайдіть чайник. Ну це електричний чайник чи чайник, який ви поставили на плиту? Вам потрібно буде додати умову, що якщо це електричний чайник, то виконайте xyz. В іншому випадку зробіть xyz для чайника, який ви поставили на плиту.

Навіть коли ви думаєте, що врахували всі можливі умови і дали дуже конкретні вказівки, є речі, які ви не можете передбачити. Ви починаєте робити свою чашку чаю, і щось йде не так. О ні! Ваш чайник перестає працювати після того, як ви починаєте його кип’ятити.

Що сталося? У вашому коді є помилка! Помилка - це помилка або недолік вашого коду, що може призвести до несподіваних результатів. Для того, щоб виправити свій код, ви проходите процес «налагодження», де ви знаходите проблеми у своєму коді та вирішуєте їх.

У цьому випадку ваші інструкції не передбачають наповнення чайника до 0,8 літра для покриття нагрівального елемента. Тож чайник вимикається як засіб безпеки.

Щоб запобігти помилкам після запуску програми, розробники проводять тестування та модульне тестування своїх програм. Unit-тестування - це місце, де ви пишете тести для частин коду. Тести або не проходять, або проходять.

Наприклад, ви пишете функцію, яка додає два числа: 1 + 1. Потім ви пишете одиничний тест, де очікуваний результат - 2. Усі відповіді не дадуть результатів, якщо це не 2.

You go through your code until everything runs without any unexpected problems. Programming is therefore a detailed oriented and iterative process where you are continuously improving what you have previously written.

How does your computer understand your code?

What most programmers write as “code” is a high level programming language. It is abstract by design. Abstraction in this context means that we are moving further away from machine code and programming languages are closer to spoken languages.

But a computer can’t understand text based code. It needs to be compiled (translated) into machine code. Machine code is a set of instructions which can be understood by a computer’s central processing unit (CPU). Think of the CPU as the brain of a computer. Machine code is made up of ones and zeros. This is called binary.

For example, this is how you would write “Hello World” in binary:

01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100

As you can see, binary is not easily readable for humans, so we tend to avoid programming in machine code!

What exactly is a programming language?

Programming languages fall both within the spectrum of low-level languages, such as assembly, and high level programming languages, such as JavaScript.

But what is a programming language exactly? The best analogy I can think of are the spoken languages we use today. All languages express the same idea, but in different ways to another person:

English: Hello

French: Bonjour

Spanish: Hola

Programming languages are different ways of expressing the same idea, but to a computer instead. The following will print out “Hello” in three different programming languages:

JavaScript: alert(“Hello”);

Python: print(“Hello”)

Perl: print "Hello";

Each programming language has its own syntax. In English, we have grammar. The same applies to programming languages – they each have their own set of rules.

How do you know if a programming language is a programming language?

This might seem like an odd question to ask. Is all code written in a programming language? Technically, no. For example, there is a misconception that HTML (HyperText Markup Language) is a programming language. It is in fact a “declarative” language, which according to Wikipedia is:

“...a style of building the structure and elements of computer programs - that expresses the logic of computation without describing its control flow.”

In other words, HTML provides the structure of a web page, but doesn’t control how the website behaves or functions.

You can determine if a language is a programming language by whether it’s “Turing complete”. The Turing Machine is a hypothetical machine described by Alan Turing in 1936. For a programming language to be Turing complete it needs:

  1. Conditional branching (which I explore below).
  2. The ability to read and write to an infinite paper tape. This essentially means being able to store data in memory.

I’m not going to explore this topic deeply, but if you are interested this video is a helpful introduction.

What are the fundamentals of a programming language?

There are some basic elements which are commonly featured. This includes variables, loops, conditional statements, data structures and algorithms. These are the building blocks of most programming languages.

What is a 'for loop'?

For loops are useful if you have to execute a set of instructions repeatedly. For example, you have afternoon tea and have to make five cups of tea for your guests. In order to make one cup of tea, you have to follow a set of instructions, like my earlier example.

Instead of writing the instructions five times, you can tell the computer to loop through the same instructions five times. This enables you to scale.

Below is an example of a basic for loop:

for (let i = 0; i < 5; i++) { console.log("Make Tea!"); } //expected output: "Make Tea!" "Make Tea!" "Make Tea!" "Make Tea!" "Make Tea!" 

What is a conditional statement?

In JavaScript we have if...else conditional statements. These are used when you want to execute different actions based on a condition.

Going back to my earlier example, you ask the user if they want milk in their tea. If they do want milk, then add milk to tea, else do nothing.

Here is an example of an if...else statement in JavaScript:

if(milk == true) { // add milk } else { // don't add milk } 

What are data structures?

“A data structure is a way of organizing data so that it can be used effectively...They are essential ingredients in creating fast and powerful algorithms.”

(Data Structures Easy to Advanced Course, William Fiset)

Common data structures that you can find across many programming languages are arrays, objects, tuples, and unions. I’ll take arrays as an example.

In JavaScript, an array can store a range of data such as numbers and strings (text). I love biscuits with my tea so I’m going to store them in my array:

biscuits = [“shortbread”, “digestive”, “ginger nut”]; 

These biscuits are stored in the computer’s memory and you, as a developer, can access a specific biscuit by referencing its index. You start counting the index from 0. The index is like the biscuit’s position in a biscuit tin. You reference it by using the square bracket notation.

biscuits[0]; // “shortbread” biscuits[1]; // “digestive” biscuits[2]; // “ginger nut” 

If you want to get a digestive biscuit, you can access its index position: biscuits[1]. I can easily find it because I know where it’s stored.

Remember that the first item of the array is index 0. So when you refer to index 1, it’s actually the second item of the array.

Therefore, data structures are a way to manage data. This includes storing and retrieving data. It’s more efficient to execute algorithms if data is organised in a data structure.

What is an algorithm?

An algorithm is a specific set of instructions that solves a problem. It’s an abstract concept. Here’s a link to a short video from TED on "What is an Algorithm?".

Remember when we were writing instructions on how to make a cup of tea earlier? That is essentially an algorithm: a set of sequential instructions.

When I wrote my first function in JavaScript, I actually created my first algorithm without knowing it was an algorithm! A function is an implementation of an algorithm.

Just like in real life, there are often multiple solutions for a coding problem. For example, say you’re planning on going to a cafe that you’ve never been to before. There are several ways of getting to your destination. Some routes take longer than others, but ultimately, they all get you to the same place. Ideally you want to pick the quickest, most efficient, and easiest route.

The same principle can be applied to programming. There are usually a few ways to solve a coding problem, and programmers strive to find the most elegant and efficient solution.

Developers often don’t get it right on the first try! Just as I would write a first draft for an article, it’s the same for coding. I would redraft an article several times, where I may change the structure, edit, rewrite sections, and cut out unnecessary sentences. In programming we go through a similar process, and we call this refactoring our code.

What are the main programming languages used today? How many are there?

There seems to be some debate on the total number of programming languages on the internet. Some websites such as Wikipedia list approximately 700 of “all notable” current and historical programming languages. Other sites such as Tiobe track and monitor 250 of the “most popular” languages.

On Github, the most popular programming language of 2019 was JavaScript:

Why are there so many programming languages? How have programming languages evolved?

Different programming languages are developed to satisfy different needs. This is demonstrated throughout the history of programming languages. Please refer to this diagram by O’Reilly which maps out the history of programming languages from the 1950s to 2004.

In the mid 1950s, FORTRAN (Formula Translation) was created to work out complex mathematical, statistical, and scientific problems. COBOL (“Common Business Oriented Language”) was created in 1959 to make it easier for businesses to use code. There are some languages which are more suited for doing statistical analysis such as R (1976).

There was the rise of general purpose programming languages from the 1970s onwards, such as C, C++, C# and Java. As you can see in the chart above, general purpose languages dominate the top 10 most popular languages.

JavaScript, created in 1995, is a popular language for the web. It gives websites their interactivity and life.

More recently, we’ve seen the birth of new languages such as Go from Google, which was intended to maintain large software systems more efficiently. We'll probably see even more programming languages created in the future.

Compiled vs. interpreted programming languages

As you start to become more familiar with programming languages, you will come across compiled and interpreted programming languages. What is the difference?

What is a compiled language?

Programming languages such as C, C++, and Java have a “build” process where your code is compiled down to a more readable format (machine language) for the computer.

It might be easier to think of two people who don’t speak the same language, but they have to work together. John speaks English and Chloe speaks French. Chloe writes a set of instructions on how to make a chocolate soufflé in French, but John can’t understand it. They need a translator that can speak both English and French. It’s easier if the translator can translate Chloe’s instructions in advance before they start cooking together.

Instead, developers “speak” a programming language like Java or Python. They need their code to be compiled (translated) to machine language before a program can run so the computer can understand it.

Programs made from a compiled language are easier for a computer to understand, and therefore run very quickly.

What is an interpreted language?

JavaScript, PHP, and Python are examples of interpreted programming languages. There’s no build process and the code doesn’t need to be compiled. Your code is being interpreted or read line by line as you run the program.

Back to my analogy of Chloe and John. John writes down a set of instructions on how to make a shepherds pie. The translator doesn’t translate John’s instructions in advance, but instead joins them for their cooking session. The translator translates each line of John’s instructions from English to French as Chloe cooks. Because of this, it takes longer for Chloe to prepare and cook the meal.

Therefore, interpreted languages are slower than compiled languages. They have to be translated on the fly so the computer can understand.

But with just-in-time (JIT) compilers, interpreted languages are becoming faster and more efficient.

Which programming language(s) should I choose to learn?

Programming languages pretty much do the same thing, but they are just different ways of expressing the same instructions to a computer. Once you've grasped the concepts and fundamentals of one programming language, the learning curve for learning another language won't be as steep.

The programming language you should choose to learn first depends on a number of factors. For example, I wanted to be a web developer, so I chose JavaScript as my primary programming language. Other languages for the web you can learn are PHP and Ruby on Rails.

If you want to become a data scientist, then Python might be an option. Python is considered one of the best data science tools to analyze big data. I mentioned R earlier, which is another language used widely amongst data scientists and statisticians.

Python is a general purpose programming language, and is also useful to learn if you want to get into the field of Machine Learning and Artificial Intelligence.

If you want to become a Software Engineer then Java could be an option. Java is one of the most popular and in demand languages in the world. It's a versatile language which can be used for developing small to large enterprise software.

So think about what role in tech you would like and what kind of companies you want to work for.

Choosing a programming language also depends on what software you’re trying to build. This leads us nicely to our next section.

What is software?

How many times do you interact with software on a given day?

Software is everywhere. It’s integrated as embedded systems into everyday devices such as your microwave, washing machines, cars, TVs, children’s toys, and remote controls. Then there’s more obvious computer related devices which have application and/or system software such as tablets, smart phones, laptops, desktop computers, and home assistants like Alexa.

The average person probably interacts with software a few dozen times a day, if not more. It is part of our daily life.

All software is programmed by a developer. Software is agile by nature and can constantly iterate. Software and hardware are intertwined. Imagine your phone without its apps and operating system. The phone would essentially be an expensive brick! Therefore, software gives hardware life and hardware is how we interact with software.

The majority of software that’s created by programmers is written in a high level programming language.

What is software development?

Software development is everything from the conception of an idea to development and deployment. This process, from conceiving an idea to deploying software, is also known as the software life cycle.

There are several stages of the software life cycle: discovery, design, programming/creation, testing, and deployment/execution. It also includes everything else in the software development ecosystem such as maintenance, documentation, and bug fixes.

I won't go into detail here, as the subject of software development warrants its own article.

Current trends in Software Development and Computer Programming

Artificial Intelligence and Machine Learning

In recent years you’ve probably heard of terms like artificial intelligence and machine learning. Sometimes they’re used interchangeably, but are they the same?

No, they’re not quite the same thing. Machine learning is where a machine learns through experience. Whereas artificial intelligence is a broader idea that machines can execute tasks intelligently. Machine learning is a subset of Artificial Intelligence.

What is Artificial intelligence?

I’ve covered how programming languages work – the programmer writes a set of instructions for the computer to execute. Artificial Intelligence (AI) is a broader concept where computers can mimic the way a brain functions. It’s training a machine to “think” like a human.

The big question is: can you replicate human intelligence in a machine? Can you mimic the way a human learns, reasons, and perceives? Alan Turing asked this question in his article in 1950:

“Can machines think?”

(Computing Machinery and Intelligence, 1950 by Alan Turing)

In Turing’s article he proposed the “Turing test” in which a machine would be classed as “intelligent” if a person could not tell the difference between the responses of a human and the artificially intelligent machine.

After 70 years, AI developers, academics, scientists and researchers are still trying to answer this question and create an artificially intelligent machine. I don’t think we’re there yet. Have you tried having a conversation with Siri or Alexa? Conversations with these two devices are still basic. However, I’m sure it’s just a matter of time before the technology improves.

Companies like DeepMind are researching this concept and whether machines are capable of intelligence. DeepMind’s AlphaGo program made the headlines when it beat a professional player at Go. This was a huge milestone for AI.

What is Machine Learning?

Machine learning (ML) is a subset of artificial intelligence. ML is a different way of programming. It is the idea that the computer has the ability to learn without being explicitly programmed. Arthur Samuel first came up with the idea of machine learning in his paper in 1959:

“Programming computers to learn from experience should eventually eliminate the need for much of this detailed programming effort.”

When I was teaching my son how to recognize a cat, I would show him pictures of cats. I did this repeatedly until he was able to recognize a cat without me prompting him.

Machine learning is similar to this. You give your computer a hundred images (input) of cats. It then learns the patterns in the data and builds a classification system through repetition. If you give your computer more images of cats and other animals, it should be able to identify whether the animal in the picture is a cat or not a cat. It has essentially learned what a cat should look like.

ML is giving your computer data and examples, and in turn, it’s able to learn for itself like babies and young children do. Instead of developers giving the instructions to a computer, the computer creates its own set of instructions to follow – machine learning algorithms. Machine learning algorithms is a subset of ML, a concept known as “Deep learning”.

«ШІ є однією з найглибших речей, над якою ми працюємо як людство. Це глибше, ніж вогонь чи електрика ... "

(Сундар Пічай, Світовий економічний форум, січень 2020 р.)

Цитата Сундара Пічаї, генерального директора Alphabet Inc, підсумовує важливість AI та ML.

Яке майбутнє комп’ютерного програмування?

Цей заключний розділ буде моїми прогнозами щодо майбутнього комп’ютерного програмування.

Розробники продовжуватимуть створювати нові мови програмування. Мови програмування стануть більш абстрактними і, отже, доступними для людей, які навчаються кодувати.

Я вважаю, що у програмах початкової та середньої школи буде більше уваги приділятись кодуванню та програмуванню. Попит на розробників та програмістів буде лише зростати, оскільки технології та програмне забезпечення стають все більш інтегрованими у наше повсякденне життя. Програмування стане повсюдним.

We will see the continual rise and popularity of ML and AI to assist developers in the software development process. This includes automating testing, along with detecting and preventing vulnerabilities and bugs.

AI will revolutionize all aspects of our society, not just in programming and software development. For example, we’ve seen great strides in the area of AI and self driving cars.

One of the world’s leading companies developing self driving cars is Tesla, founded by Elon Musk. With the supervision of a human driver, a Tesla car can now automatically change lanes, navigate autonomously on limited access freeways, and the owner can summon the car to and from a garage or parking spot. Tesla's goal is to create a fully automated, self driving car without any human supervision.

As machines become more intelligent, we may come to a point where machines surpass the intelligence of human beings. This is referred to as singularity. It may seem like complete science fiction at the moment! But notable figures such as Ray Kurzweil predict that machines with human level intelligence will be available within the next 20 years. Kurzweil is known for his accurate predictions of how technologies will progress. He wrote a book on this: The Age of Spiritual Machines.

How will our society change as a result of super intelligent machines?

Final words

Technology influences and code touches almost every part of our lives. From our choice of entertainment (online games, streaming) and how we shop, to choosing what we eat and even how we date! Code is important and more jobs will shift and require people to have at least some basic understanding of programming.

Yet there are only approximately 23.9 million developers in the world according to the Global Developer Population and Demographic study 2019. To put this in perspective, only 0.3% of the world’s population knows how to program. As I discussed earlier, our dependency on software and technology is increasing. According to the US Bureau of Labor statistics, the demand for software engineers is expected to grow by 21% from 2018 to 2028. Therefore, we need to increase the number of developers.

If you’re thinking about becoming a developer, start today. It is an incredibly exciting time to do so! There are many learn-to-code resources online. There are self-paced platforms like freeCodeCamp. There's also a great post by Laurence Bradford which compiles all the best resources to learn to code for free. Do some research and find out which resource suits your learning style.

If you have any questions or just want to say hello, find me on Twitter @PhoebeVF.

A special thanks to Katerina Limpitsouni from Undraw for creating the illustrations for this article.