When you turn on a computer, how does it work? If you suspected that black magic was the cause, then you were on the right track. There is an operating system (OS), a software program that quietly incants the daemons in the background so that the software continues to run without your direct control. Damned to the seventh circle of hell in Dante’s Inferno, they run around responding to network requests, hardware activity, or other programs by performing some task, never seizing to toil until you shut off the computer.
An operating system should be expected to do the following:
- control the hardware, software, peripheral devices (e.g. printers, storage devices)
- support efficient time-sharing, by scheduling multiple tasks to execute during the same interval
- be the intermediary between input and output, and allocate memory to each program so that there is no conflict among the memory of any programs running at the same time
- prevent the user from damaging the system. For instance, prevent user programs from overwriting the operating system or another program’s memory. (You can still design your own operating system if you want. For example, to support a simple single-board computer powered by a 6502 microprocessor. But it is probably quite difficult.)
The operating system loads, or boots, when the computer system is turned on and is intended to run as long as the computer is running. Examples of operating systems are macOS for Apple’s Mac family of computers, Microsoft Windows, Unix, and Linux.
Windows has evolved from a single-user, single-task DOS operating system to the multiuser, multitasking, universal app enabling Windows 10. Unix and Linux were designed from the beginning to be multiuser, multitasking operating systems.
Computer applications obviously affect nearly every aspect of our lives. They run your life in those moments when you are a statistician who needs to calculate a logistic transition function, when you are a South Korean rapper producing a record, when you are a scientist who needs to do generalized iterative scaling, when you are a biological engineer who needs to model catalysis, when you are a professor who needs a place to submit his political history papers, when you are a hacker participating in a bug bounty program. These all require applications. On your personal computer you may run an Ethereum wallet, Wikipedia, an app for books, or software that allows you to watch Croatian football.
Someone, usually a team of programmers, wrote those applications. If you’re reading this, you probably gained the intuition that writing applications is in demand, and you would like to write some yourself. Perhaps you have an idea for the countrie’s next great defense applications or just some simple app for a local contractor who specializes in stone masonry work.
Here, we’ll cover the basics of writing applications. We’ll stick to Java as our programming language. Keep in mind, however, that ascending to a god-level programmer will require more than mastery of rules, or syntax. On the path to true mastery, it is also necessary to nail basic programming techniques. These constitute established methods for performing common programming operations, such as finding an average, calculating a total, or arranging a set of items in a particular order.
On this path, it is also great if you can manage to absorb a sharp aesthetic. That is: make sure your code is easy to maintain, readable, and reusable.
Easy to Maintain and Reusable
The specifications for any program are continually changing. Not very many programs have only one version. It is reasonable to extrapolate this pattern into the near future. Therefore it makes sense to write code which allows us to incorporate prewritten and pretested modules into our program. The need for speed calls our name. Organizing tidy sockets also tends to yield code which contains fewer bugs and higher levels of robustness. Luckily, Java has a vast amount of prewritten code that we are free to copy-and-paste into our programs.
Just as in natural language, we try to keep good form. We write clear sentences not merely out of submissive love for our grammar teacher, but so that the reader stands a good chance of figuring out what we intend to convey. A similar attention to readability should be brought to code. This is especially the case if we wish to advance in our careers, because coding nicely eases the transfer of a project to other eyes when the day comes for us to move on to higher responsibilities.
Programming is exciting. It can be very satisfying to face a monstrous task and hack into pieces, then gather up these computer instructions and transmute them into a living program. But just like with alchemy, it’s a bummer when it doesn’t do anything or produces the wrong output.
Writing correct programs is therefore critical. Someone’s life or the future of all mankind may one day depend on the correctness of your program. Reusing code helps to develop correct programs, but we must also learn testing techniques to verify that the output of the program is correct.
On this site, we’ll concentrate not only on the syntax of the Java language, but also on partaking of the most-blessed holy trinity of programming consisting of three distinct parts. Not in one alone, but only in the joining together of the three attributes does one partake in programmer Godhood:
- Programming Techniques
- Software Engineering Principles
- Effective Testing Techniques
But before diving in, it might be a good idea to understand something about the body on which the program actually runs. The platform. That is: the computer hardware and the operating system. The program uses the hardware for inputting data, for performing calculations, and for outputting results. The operating system unleashes the program and provides the program with essential resources such as memory, and services such as reading and writing files.