Tag Archives: JavaScript.

Untangling the Web

I’ve mentioned before that I’m not entirely convinced about the suitability of this trendy new ‘World Wide Web’ as a development platform:

https://andywootton.wordpress.com/2015/07/18/can-you-hear-knocking/

I recently went on a ‘Web 101’ course to dilute my ignorance, by doing some HTML, CSS & JavaScript myself. I discovered that I’d been making an incorrect assumption. Because I was familiar with client-server computing, I’d been assuming that if you had a web client, you had to have a web server to get anything done. You don’t. We didn’t go near a web server until our fifth session. We edited files on our file system and displayed them in our browsers.

Because I wanted to try my CSS on a different client platform and form factor, I saved my files to Dropbox, so I could access them from my Linux PCs or my Android tablet. I was ‘web teching’ without any web. Links don’t have to be HTTP. We could do things better, without throwing everything away.

 

 

 

 

Asynchronicity Traps

Don’t you love it when lack of planning comes together?

Last Thursday, I learned about JavaScript callbacks, which reminded me of OpenVMS Asynchronous Traps (ASTs.) I learned to code in a world of single-threaded processing, so this was an advanced topic, along with my interest in occam and Communicating Sequential Processes. Back then, only real-time coders and those looking to the future cared about parallelism. I remember not really seeing the point of Yourdon ‘state-diagrams’. I’d never experienced the complex state network that a GUI with a few option buttons can generate.

Last night I came across debates about the advisability of abandoning JS callbacks for the HTML5 ‘promise’ construct; “callback hell”, they called it. Promises are functions. This is another area where the elegant simplicity of functional programming appears to offer hope. Functions are mathematical constructs, so in functional languages perhaps all possible states that code might enter can be identified.

Alongside this, I’ve been reading about research into the energy requirements of computation. For a long time, computer scientists thought that every logic operation would have a cost in terms of energy and hence entropy, but that appears not to be true. It is information deletion that costs energy, so immutable data is more energy efficient. I’m only up (down?) to quantum bits, so I’ll have to let you know how the cat gets on another day. I worry when physics starts to look like mystical religions.

2014, My #YearOfCode

I used to program professionally in the 1980s, in Pascal, BASIC and FORTRAN after learning Algol 68 and a little LISP at university. I was what was known as a ‘3rd Generation language’ programmer. I wrote programs that ran on ‘dumb terminals’ and IBM 3270 ‘sreens’ for organisations that could not yet afford to buy relational database software. I stopped programming just as I’d helped my employers select their first Oracle database, so I only ever coded for the native file-system of the operating systems I worked on. I didn’t stop coding completely because I became a system manager of DEC VMS systems and continued to write ‘scripts’ in DCL (Digital Command Language) for several years. I eventually drifted off to work on technical projects, information risk management and several years ago, I moved to business process modelling in a graphical language called UML (Universal Modelling Language) and business analysis, most recently with Agile development teams. Agile teams work best when they are made up of ‘generalising specialists’ so I decided a while ago that it was time I got back into coding.

I’m a bit jealous of my friends who have the current software skillz to go on hack-days, help at a @CodeClub and otherwise ‘make’ the world a better place. Since I was ‘Senior Programmer’, software development has changed considerably. To start programming again now, I need to gain experience of databases and object-oriented design. I have the option of programming back-end server systems, for desktop Graphical User Interfaces or for web browsers. The languages I used are no longer appropriate for this new world and the programming environments and software libraries have changed.

I need to start from scratch and re-learn everything practical I learned in the computer science half of my degreee and more. How hard can that be?

I have options. I won’t be programming for native Microsoft or Apple environments on moral grounds, though I haven’t comletely runled out C or C#. As I like open systems and Free software, I could learn the scripting language of the Linux bash shell (Bourne-again shell) first. I could use Python as it is widely used in free software projects and is becoming a popular language for teaching, so there are plenty of tutorials available, or Java which is more widely used and still popular as a professional language. The best reason to learn Java is probably that it is the Google-approved language for the Android platform and can be used to write portable software. Or I could look to a web-centric future by learning the new open standards of HTML5, CSS and JavaScript, with a choice of environments, including PhoneGap and Mozilla OS.

So the options are quite simple really :-/

This week the government announced that 2014 is #YearOfCode. I’m going to take that as the kick I need, before I’m over-taken by 8-year-olds so I just told young @LottieDexter that if she can learn to code in an hour then so can I and I’ll start tonight. I decided I wasn’t going to bed until I’d written something that worked, so concluded that it was best to cheat.

Based on http://www.w3schools.com/js/js_examples.asp, here is my first JavaScript code.

<!DOCTYPE html>
<html>
<body>

<h1>World Wide Welcome</h1>

<script>
document.write(“<p>Hello world!</p>”);
</script>

</body>
</html>

See, Lottie was right. It IS easy! <Checks rear-view-mirror for kids>