Blog

Components of the computer

In previous posts, I have given a small introduction about the computer and its evolution, as a general purpose machine, and some basic brushstrokes about its architecture. The next posts will deal in detail with the different components of the computer, but before that, I think it will help to make a small list with these components, so that the student can get an idea of what is to come.

Continue reading Components of the computer

The architecture of computers

Talking about the architecture of computers, we refer to the set of all the blocks (one or several components) and the communications between them, which make the computer work in a coordinated way, serving a common purpose. Each block fulfills one or more tasks, which orderly and coordinated contribution makes the computer fulfills the function for which it was designed.

Continue reading The architecture of computers

Classifying computers

We have a natural tendency to pigeonhole and classify things, and computers are not an exception. In this post, we are going to see the most common way of Classifying computers.

If we wonder what type of computer our laptop is, you might think that it fits perfectly into the category of minicomputer however it isn´t, it is really a microcomputer. But how important is this for me? What matters if my laptop is a minicomputer or a microcomputer? Well, even if you are never going to work with another computer than your laptop, it is always good to know that there are other categories of computers with other features, many more than those of your laptop. Who knows, maybe on some occasion you will have to face some task too big for your laptop.

The most common way to classify computers is according to their performance. We distinguish 5 types or categories.

Continue reading Classifying computers

Control Structures in Java

The control structures in java will be used to modify the sequential flow of a program. That is, the order in which the instructions on it are executed.

In a program, instructions are executed from top to bottom, and from left to right, depending on the order in which they appear. The different instruction blocks of our program will follow this sequential flow to execute the instructions. The instruction blocks shall be delimited by braces brackets:

Block {
instruction 1;
instruction 2; instruction 3;
instruction 4;
}

However, in some cases we will need to break this sequential flow. Reasons for that can be many, we may need to make a decision between one or several possible options, or maybe we need to perform some instructions several times. Therefore, we need certain structures that allow us to interrupt the sequential flow of the program, and move on to execute other blocks of code.

In this post, we will study the operation of the following control structures:

  • Decision making: if-then, if-then-else, switch.
  • Loop: for, while, do-while

Decision making structures

Continue reading Control Structures in Java

Computer generations

A common way of showing the evolution of computers is to resort to the so-called generations, temporary periods of computer development. One generation begins with a disruptive technological advance and ends when another advance appears surpassing the first one and begging a new generation.

Traditionally there are 5 generations, although there are those who already speak of 6. I in principle continue speaking of 5 although I mention the technological advances that are already here and will surely end up closing the fifth generation and giving way to the sixth. These advances are Artificial Intelligence and parallel processing.

In my classes I use the slide below to introduce the generations of computers:

Computer generations
Continue reading Computer generations

What is a computer?

We all probably have an answer to the question: What is a computer? If you are reading this post, you are probably using one.

At the beginning of the program, I usually start the Computers Architecture course by asking my students this question. Even though the answers are very diverse, we usually reached the following consensus: “A computer is a programmable general-purpose machine”.

To properly understand it, you have to imagine the world with machines that perform only one task, as it was before the age of computers. For writing a document you have to use a typewriter, executing a mathematical calculation you use a calculator and for watching a video you use a video player connected to our television. Those were amazing times! Today, we use the computer for all these tasks and many more.

And programmable, because through programs we prepare the general-purpose machine to carry out a specific task of the many that it can perform. Continuing with the previous example, assuming we are on Windows, we would use Word to write one document, Excel to do the math, and Windows Media Player to watch the video.

With this brief discussion in class, I think a good starting point get established to get into the exciting world of computers.

If you want to know the architecture of these machines that we use today for everything, read the post computers architecture

NOTE:

This post is part of the collection “Computer Architecture” that reproduces the class notes that I use to teach the subject at ESIC. You can see the index of this collection here.

Operators in Java

Operators in Java are used to perform operations with values, usually saved on variables. These values used in the operation are called operands and the operation performed with the operands is defined by the operator.

Java has different types of operators:

  • Arithmetic.
  • Comparison.
  • Logical.
  • Assignment.

Arithmetic operators

Continue reading Operators in Java

Exercises with variables in Java

After the previous post about variables in java, in this one, I leave some exercises to practice what I explained then. This will be the way of acting for the rest of the Java topics, firstly I explain the topic and then, in the following post, I will propose a series of exercises and their solutions.

There are several possible solutions to solve the same problem, some more efficient than others. Here you can see a possible solution for each proposed exercise, which is not the only one possible.

Continue reading Exercises with variables in Java

Variables in Java

In this post, I am going to talk about variables in Java. I will explain how to declare and initialize them, the types of primitive variables that we handle in Java, how to change the type of a variable and its scope.
But before we start, we must introduce a series of preliminary concepts:
• A variable is a container, a memory location, that stores a value while a program is running.
• We put a name to each variable, so that we can reference it in our code, and use the value it stores.
• Variables are of one type. The type of data that we intend to store in the said variable. For example, if a variable is of type int, it will be used to store integer values. However, if it is of type String, it is used to store a string of characters, that is, text.
• Variables have to be declared. In this declaration, we indicate the type of the variable and its name.
• A variable has to be initialized to be used in our program. Initializing a variable is putting a value in it.

Continue reading Variables in Java

Starting with Java

As we are starting with Java, the first thing we will have to do is download the official version of the JDK (Java Development Kit). For this, we are going to go to the Oracle website, which is the owner of Java, and we download the JDK.

Oracle recommends NetBeans as IDE (Integrated development environment) for programming with Java. So in this course, we will use said IDE that you can download together with Java from this URL.

However, for the first lessons of the course, we will not perform any installation, we will use an online Java compile, with which we can practice from our browser.

Compiling and running Java Online.

There are several Java compilers online. Just type in Google: “java online compiler” and we will list several actions.

Continue reading Starting with Java