Monday, 13 June 2016

The Real World

In the Real World, While and Until don't necessarily mean what programmers take them to mean.

I had a discussion with someone with a card that said, Valid until June 2016.  Does than mean it is valid until the start of June 2016 and then stops being valid?  No, because this is the inclusive "until".   It stops being valid after the point it is valid until.  This works with dates because it is unambiguous what is "after" June 2016.

Same with my weekly bus ticket.  Where it says it is valid until Tuesday that means including Tuesday and then stops being valid on Wednesday.  In code you would write this as "valid until date > Tuesday" not "valid until date = Tuesday".

People in Hull often use the word While where you might expect Until.  For example, you might hear "it was posted on Monday so it won't arrive while Thursday".

Wednesday, 16 March 2016

New Heroine

Interesting... following a link from Lambda The Ultimate to this Model View Culture article

I had no idea that the Sacred Language itself (ie Assembler) was created by a woman, Kathleen Booth.  So I have a new heroine to put next to Grace and Ada.


Unlimited Respect!

Tuesday, 8 March 2016

A lot to learn

A change is as good as…

I've put Linux on the laptop.  Specifically, Mint 17.3, from the cover disk on the February issue of Linux Format magazine.  This went on amazingly quickly and, er, just works.  I've plonked Emacs on here as well and Haskell and Git.

I went through a humiliating evening trying to create a restore disk for Windows 7 and for some reason this wouldn't work.  There were workarounds that involved logging in with increasing user permissions but in the end I thought I'd risk it and load Ubuntu anyway, with the aim of dual booting with Windows 7.  However the Ubuntu installation crashed and took access to Windows with it.  I could still run Linux from a live CD but boot nothing from the hard disk.  Serves me right. Somebody smarter than me could perhaps have got Windows back.  But then I thought, hang on, just how much would I miss the Windows stuff if it all went away?  So I stuck the disk in and said to Mint, go ahead, all yours, and here we are. Looks good!  And there is a lot to learn...

Friday, 12 February 2016

So right then what next?

Right then what next? Do I look at Elm and start doing things in a browser? Nothing I do in my day job goes anywhere near the web. But if your next language does not make you think differently then why bother? What about Elixir? That is back in the days of Erlang. If you want types in Erlang then there is a separate tool that does this for you. But surely that's not the same thing as having proper types in your language. I am sold on the idea that you need a static type system. Also I am sold on the idea that the either and maybe types are the billion pound solution to the billion pound mistake. Why would anybody not want static types? Why would anybody not want pattern matching? You can or I should say you must use Dialyzer. Who thought of that name? I can't read the word without a mental image of pipes pumping blood around. Aaarg. Elixir looks like it has lots of good ideas. And you get all the concurrency capability of Erlang. But I like the lisp way of writing, where you have one opening bracket at the start of the idea and a close bracket at the end of the idea. What is the problem? Why would you not want that? If it's not there in the code then you have to think where each part starts and stops. You either write the brackets or you have to imagine them all the time. And it lets you have hyphens in object names which is the sanest way to write multi-part identifiers. You can use hyphens in Cobol too. Using underlines is ugly and using capitals midway through the word is not much better and gets much worse if the identifier starts with a lower case letter. That is an idea worthy of the camel that they say invented it. In Basic on the Sinclair Spectrum you could have spaces in identifiers - beat that. Do I say now this is the time to do the deep dive into Haskell that I have been postponing all along? In honesty are all other languages just attempts to postpone the day you have to learn Haskell? So far with all this stuff I have just been moving across the face of the waters. Hmm. And I've got Smalltalk loaded on a machine somewhere. And there's Scala. Scala looks suspiciously enterprise to me. But it's supposed to be scalable so maybe there's a lighter side to it. I note there is a book specifically about functional programming with Scala. So here we are floating above the JVM again. Java is another one I've not touched, though there's no reason to go there now that I can think of. When I looked at the idea of embedding a high(er) level language in bingo equipment I thought Forth would be ideal. Only Scheme comes close. In fact I still think Forth would be ideal. How much does a clarinet cost, and how long would it take to get reasonably good at it? There again there's Clojurescript now for your browser which ties in directly with Clojure which I quite liked. They're are doing all kinds of clever stuff. When you have to call your solution Om you know enlightenment is near. Either that or madness. So right then what next?

Thursday, 1 October 2015

Wise words on encapulation

From nklein software...
Encapsulation is about protecting the person who has to read your code. It’s not about protecting your code.
That is to say, if you have some complicated data structure and you diligently hedge it about with getter and setter functions, the benefit there is to those who will read and write code that uses that data structure. Which includes you of course. By using the access functions it is clear in the code what you are actually doing.  Your functions give meaning to the operations.

The reason often cited for using encapsulation functions - that it lets you change the implementation at a later date without needing to change the interface - is nugatory - that situation hardly ever arises.

This is a good point, well said.