Introduction

General

Introduction

Over the years, there has been a gradual shift from standalone programs running on a host (mainframe, PC, tablet) to programs which have at least some network component. Often programs will interact with the 'cloud', which usually means that they will interact with some service running on some computer somewhere.

If you are a developer, you are increasingly required to write either the client side, the service side or both. You need to pay attention to the overall architecture of the system, to ensure that it is robust, secure, doesn't consume excessive bandwidth, is responsive, and when it crashes doesn't do too much damage.

But besides all of those, when it gets down to the nitty-gritty, you need to write your programs in some programming language. Which one? Often there are organisational constraints ("we only use language X here"), programmer knowledge ("but I only know how to program in Y") and probably many other issues. But just suppose you had the choice - then what guides you?

There are many lists of "popular" programming languages, such as Triobe . I have programmed in many of them (about 30, I think) but of course not all of them. For some of them my knowledge is deep, for many is shallow. But enough to have formed opinions about many of them.

Whenever I set out to learn a new language, like many programmers I have a 'standard' problem. For many years, this was to build a wine-cellar program. I never finished any of them, but that wasn't the point. More recently, I have gravitated to more and more network programming. At Monash University I taught a course in network programming and at the time the preferred language was Java. So I used that. Later, when I wanted to learn Go, I rewrote those notes using Go. But in the meantime I have used other languages, and there are others I want to learn.

So when a friend suggested I look at Julia, I thought, Hmm, that's three languages. Why not chuck in Rust, and why not include Python and Javascript? So this is what you might call a comparative book: how to do network programming in Java, Go, Python, Rust, Javascript and Julia. Then if some of those might be your possible options, you can compare them directly against each other.

But I've missed out some major languages:

C
The TCP/IP network routines came out of Berkely BSD Unix, written in C. Programming at that level is complex with many subtleties, as well as being O/S dependent. For Unix based systems such as Linux, the bible has been written already: WR Stevens UNIX Network Programming . I couldn't do a better job and wouldn't even like to try. So I won't.
C++
I once came across a quote "C++: a laboratory experiment that escaped." Yes, it's still on the loose. There are often statements like "Inside C++ is a smaller, safer language trying to get out." I'm happy to wait.
C#
I was disgusted to read the initial release of the C# reference manual: 500 pages, never once mentioning Java even though the language was a blatant ripoff of Java (Main() instead of main() - yeah, right!). Since I only program for Linux systems, I can maintain the moral indignation without any penalties :-).

So what is behind the choice of languages I have made? Firstly, they are languages I have used or would possibly like to use in future. They are all relatively platform independent and fairly high level. Some are interpreted, some compiled, and some compiled to intermediate code and then interpreted. That isn't a particular issue to me. In more detail,

Java
Java is one of the most widely used languages. It is solid and has a huge range of libraries. For many years it was my principal programming language, and is still a major choice for new projects. I still like it, although it is a bit klunky at times and the libraries no longer have a consistent approach. Maybe I should look at Kotlin as a replacement - some day
Go
Go is designed as a systems programming language, easy to build large and complex systems. It is an O/O language, but using structural inheritance rather than syntactic inheritance. It is nice and clean and a definite choice for future projects
Python
Python is actually older than Java, but languished for many years as the set of libraries was very weak - I always chose Perl for many years as it had great libraries. Once Python developed a decent of libraries it took over from Perl as a major language, and is my most common scripting language (after bash)
Javascript
Designed for use in browsers, it gained an additional lease of life when node.js allowed standalone applications. node.js has long been one of the languages I should learn, but I see that Deno is being proposed as a replacement
Rust
Another recent systems programming language, promoting safety. It has a bit of an uphill learning curve and has been slow to get significant adoption, but its proponents are very enthusiastic. It's time to get to grips with it
Julia
Julia is designed for data science processing. However, it is considered a promising general purpose language, so although it has little showing on the language lists yet, I thought I would give it a go too

The structure of this book is as follows: first there is a general section laying out whatever theory or common practice is needed. It is then followed by sections for each langauage. Where possible, I have adopted the same sub-structure for each language, so that there are comparable programs for each one. Then a summary, sometimes.

Java

Go

Python

Javascript

Rust

Julia


Copyright © Jan Newmarch, jan@newmarch.name
Creative Commons License
" Network Programming using Java, Go, Python, Rust, JavaScript and Julia" by Jan Newmarch is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License .
Based on a work at https://jan.newmarch.name/NetworkProgramming/ .

If you like this book, please contribute using PayPal