Archive

Monthly Archives: July 2017

Originally this blog aimed to cover both technical aspects and the philosophy issues related to my Theodorus project (which I’m somewhat shameful to say isn’t really progressing as I’m busy with other stuff, such as blog-writing). So this post is going to be very technical and probably won’t interest some of the demographics, yet as I write to my own amusement you may choose to skip this one, or not.

As most of modern day programming languages (ES6 included) have classes, we’ve grown used to them, but as originally javascript works differently, I believe it forces us to a better understanding of what classes actually are. The original “C” didn’t have classes either, but it had “structs”, which is a collection of other structs and basic type variables, like integers and array of characters (later to evolve to strings). And then someone came up with the brilliant idea of adding methods into those structs, and thus C++, the upgraded version of C, had classes. So now we have classes which are strongly related to Object-Oriented-Programming (OOP). The idea is to encapsulate methods and information regarding a certain business-logic concept. This assures “safer” interaction between several concepts as they are forbidden from touch each other private parts.

OOP is bad. But our head is so wrapped around it, it’s kinda hard to think past it, and here is where javascript comes to the rescue. Javascript, being the only prototypal language, talks about different scopes, where each function creates a new scope on top of the current scope, while keeping all underlying scopes available, so this code will work:

(function external() {
  var foo = 1;

  (function internal() {
    var bar = 2;
    console.log (foo+bar); // output 3
  })();

  console.log (bar === undefined); // output is true
})();

The “bar” variable existed only within the internal function and once it passed, it died. but note that “foo” variable was available in the internal function as well. How about this code:

(function the() {
  var foo = 1;
  
  (function plot() {
    var foo = 2;

    (function thickens() {
      console.log (foo); // output 2
    })();

    (function further() {
      var foo = 3;
      console.log (foo); // output 3
    })();
  })();

  console.log(foo); //output 1
})();

As the scopes are stacked one on top of the other, each function will first find the nearest variable with the name it’s looking for. It’s worth mentioning, though, that accessing lower levels of the scope is more expensive than the immediate levels so it is better to pass the variables along.

However, despite creating layers of scope, the magical word “this” which is often used in many languages still points out to the enclosing object, and in our example – it’s the same object. But we can create a new enclosing object using the word “new”:

function Bar(){}

Bar.prototype.whoAmI = function () {

return this;

}

var foo = new Bar();

console.log(this); // output "Window"

console.log(foo.whoAmI()); // output "bar(){}"

you might have noticed the word “prototype” there. Javascript functions have an object attached to them called prototype, which is a collection of functions that all new instances of the enclosing object will “inherit”. And that’s great, because I can create an object, let’s say “foo”, which is an instance of “Bar” and if now I’ll add a new method to Bar’s prototype, foo will be updated as well!

function MyClass(){}

var instance = newMyClass();

console.log(typeof instance.myMethod); // output "undefined"

MyClass.prototype.myMethod = function () {
  return true;
}

console.log(typeof instance.myMethod); // output "function"

So unlike any other language, with javascript I don’t need to initially declare all the class’ capabilities. I can do it whenever I want, if I want. I can also have my class inherit several prototypes. so my Robo-dog can have both dog and robot attributes, and not forces to extend only one of them.

So finally, look at this code:

function MyClass() {
  this.constructor.apply(this, arguments);

  // list all exposed functions:
  this.main.foo=this.external.bind(this)

  return this.main;
}

// list all functions, internal should start with '_'
MyClass.prototype = {
  constructor: function () {
    console.log(arguments); // output: 1,2,3 along with other stuff
  },
  main: function main () {
    return 'main function running';
  },
  external: function external() {
    console.log(this._internal());
    return 'bar'; 
  },
  _internal: function internal() {
    return 'internal';
  }
};

myInstance = new MyClass(1,2,3);
myInstance(); // output 'main function running';
myInstance.foo(); // output 'internal' and 'bar'

This code has some nice gems in it as it obfuscate (but not fully hide) code you don’t want everyone to access. It’s puts away the constructor in a separate, more manageable, function; it clearly lists all the function we would like to expose, and allow us to have external name (in our case “foo” is internally called “external”) and if we expose only the created instance and not the class itself, no one would be able to see the code of “_internal”.

So in conclusion, Javascript classes are not so much about OOP-driven, rather than a tool to manage your code better. It’s not about working hours on end to define your interface and abstract classes only to realize the world isn’t modeled as you think (been there, done that), rather than a way to group functions together and say “hey, dataObject, I want you to bark().” –

DataObject.prototype.bark = bark;
dataObject.bark();

 

Advertisements
Usually the distinction between fantasy and science fiction stems from the first including wizards and dragons while the latter is all about technologies and spaceships. I would claim that fantasy stories more often than not are about a journey in which the hero matures while science fiction is trying to deal with some hypothetical question. “Star wars” in my distinction is actually a fantasy story, despite having spaceships and droids, while “Captain America: civil war” had the potential to become an excellent sci-fi movie had it contemplated on the privacy-vs-security a bit further and not break down to sheer brainless action.
That said, I think Netflix’s “The Circle” is a very good (and horrifying) science fiction movie. Although that unlike “Brave new world“, where it’s actually quite difficult to put the finger on what is exactly wrong in this engineered-to-perfection society, “The circle” isn’t that sophisticated and just like its protagonist, it’s partially excited about the upcoming technological advancements but it’s also terrified of them at the same time. Ignoring the acting and plot and whether they were un/inspiring or un/predictable, I enjoyed contemplating the deep questions that the story raised. I think it’s an interesting story to talk about, much like the movie “Idiocracy” which I found to be incredibly… well… idiotic – it’s not the portrayal of the story rather than the question that lies underneath it that are interesting. In the “Circle” case the questions would be “are we ok with key individuals owning all our information? are we ready to give up on our freedom and privacy for the sake of security and brain-numbing entertainment?”
The movie discusses people’s behaviour when they know they’re being monitored. The protagonist claims, without anyone refuting her or suggesting an alternative, that people become better and don’t do “bad” things when they know they’re being watched. I disagree as it boils down to the question of “who decides what is good or bad” – is having sex is good? is protesting against the government good? Being monitored doesn’t make a person “good”. It makes her “obedient”. Being monitored will prevent the average citizen from breaking the law, from fear of being penalized. Changing people’s behaviour by fear means surveillance is a form of terror. And what if the law is bad? if you’re pro-abortion and the law forbids it? if you meat-eater and the law forbids it? when you have different religious views from the state? or you’re simply a dancer living in Bomont? In its fundamental form, Law is an assertion of power by the people who have it over the rest. Surveillance just gives them more power. You might say that you live in a democracy so by definition you’re the one making the law, but seriously – when was the last time you passed a bill?
Laws aren’t “good”. They might even be “bad” as they’re limitation of power. Laws are a necessity made to limit exploitation of power and we should look carefully against who are they being used because more often than not, people with true power are exempt.
I haven’t read the “Circle” book, which I guess elaborate or portrays the scene differently but at some point the protagonist commits a crime (as she mistakenly believes she’s being unsupervised) but when caught, she confesses and accept to have a “transparent life”, broadcasting her every daily activity (with limited time to go to the toilet). In the movie it might be portrayed that she converted and is now happy with this verdict but personally, I saw it as a punishment. Imagine your life being constantly monitored by anonymous crowed who can comment on your behaviour and looks. After the commons turned AI into nazi, do we truly believe that such form of constant feedback is “mostly” positive?
I was curious who is actually following the protagonist as she received comments from all around the world. Emma Watson is an attractive-looking lady, I’m pretty sure she’ll get many more followers than, say Patton Oswalt (who also plays in the movie), but it’s an interesting to note that her character in the movie didn’t follow anyone herself (so no “following-everyone” culture). Probably because it didn’t contribute to the plot but also because it’s boring to watch someone watching the life of others. The protagonist accept a role of a “content-provider” with millions of watchers – all of which are boring bored people who have nothing to do but wait for the second she gets online in order to greet her “good morning”. That’s another horrible dystopian faith lurking – will our lives absolves into nothingness and watching “big-brother“, being too lazy, tired and broke to actually do something ourselves. A long time ago I read a Canadian blog in which the author counted his favourite activities – reading, writing, walking and meditating. All are free; all require time. But who has time when you’re too busy working to get paid and watching television with the money you’ve earned? But modern day workplace doesn’t allow you to work just as much as you need – a full-time job is required and the “circle” demands even more. it demands your soul (so it seems).
Surveillance issue aside, a workplace that requires 24-7 commitment and expects its employees to attended the non-mandatory events voluntarily should be called “prison”. Perhaps it was a satire but it pretty much resembles my experience when visiting a real-life EvilCorp. This really makes me appreciate my current work-place: Despite my general preference of telecommuting, my current office is in the middle of lushes fields, 20 minutes drive from the home; I work 8 hours a day, including lunch break and approx. a 1hr run twice a week or so. As for the rest of the time – it’s mine to choose what I do and with whom I do it. My work isn’t measured by a punch-clock nor by level and commitment and loyalty to the company, rather than by the output produced. At the end of the day – this is all that should matter. It seems to me that the circle is not a good place for introverts as they to value their privacy too much. Set aside that constant surveillance at the work place is downright illegal, one might claim that “good” employees have nothing to fear, but in reality it curbs creativity for the fear of making a mistake, it creates distrust (as clearly the employers don’t trust their employees), motivates employees to “keep their head down” regarding things that bother them (thus making them bitter) and it prevents the use of aggressiveness as a form of response – usually it’s a good thing, but sometimes less so.
Constant surveillance at the workplace wasn’t the only privacy violation portrayed in the story. For some reason the story didn’t talk about their legality, rather than merely raised an eyebrow. I felt that it somewhat trivialised these crimes; In one scenario the protagonist is informed she drank a medical sensor after it’s already inside of her, without her consent. That’s a doctor’s malpractice. Another scenario was of the protagonist checking her parent’s home-installed cameras until she bumps into them in the middle of some sexual act – pretty much like entering somebody’s home without their approval or knowledge. Nowadays such a privacy violation is purely illegal.
As part of their discussion, the protagonist suggest, to the dismay of her friend who had a change of heart, that everyone should be forced to vote and voting should be done using the privately owned Circle service. Set aside that not-voting is a legitimate way to express the dismay from the political system and its candidates, forcing everyone to share their political opinion to a non-accountable third-party will in no way lead to proper functioning democracy. Forcing people to vote in an oppressive regime is how you get 99% votes in favour of the current dictator. This is how tyrannies work. The protagonist also suggests running government functions, such as paying taxes and voting through privately-held infrastructure, without addressing its legalities, and instead talk about forcing citizen to be registered to the system. It’s worth referencing the Israeli’s attempt to create a unified biometric database of all its citizens and the threats that arise from such an atrocity (imagine this database hacked, where will the citizens get a new fingerprint?). There are two politicians presented in the Circle story – one who questions the company’s motives and quickly find herself under an FBI investigation (as an example of power-exploiting) and the second one that embraces its full-transparency paradigm, at least officially. A legislator explained to me once why he rejects open-doors conferences – “because then the conference will become a circus show and all the deals will take place in shady alleys”. I disagree with him of course – yes, shady political deals will always happen – but it doesn’t mean we should encourage them by providing them a nice and comfy, well-lit room.
I do still think there is a solution that can work in such a technological world, and it lies with the understanding the information has ownership. I should be entitled to know where my information is being used, by whom and for what. There’s not much of a difference between a person stalking me and learning about my routine in order to gain advantage on me and a computer doing the same thing surgically. There should be a law telling me what does the machine knows about me; tell me who has access this information and will allow me to better moderate my behaviour than simply fearing that my data is accessible to everyone at any given time. This is my information and my consent should be required if anyone wants to pry to into it. Imagine that Facebook had a premium version in which your personal data is not accessible to anyone – not even Facebook themselves (I can filter out my own newsfeed, thank you) and it would cost – say 10$ per month. users will then have the option to pay for FB service or enjoy their service for free, in exchange of selling personal information for the same price. Keep in mind that today Facebook’s service is free in exchange for not only giving away personal preferences but foremost being exposed to ads.
There’s nothing technically wrong with digital voting, if you ignore the fact they are much more prone to fraud. The problem with the idea they suggested in the movie is the over-centralisation of all the information (knowledge is power, remember?) to private hands. So why not decentralise it?
can’t we have similar voting tools but running separately? Let every county and every state run its own system, which is open-source and crowd-sourced (not to have a single owner with his own back-door), but still online-accessible?
Apparently the movie was a flop in the box office, presumably because people were not impressed by the dystopian very-near-future it represents, citing that it’s already here, although my conspiracy-theory is that EvilCorp encouraged the media to suppress it by belittling its performance and dismissing the idea behind it (“we probably already live in a scarier world […] than the one The Circle presents as a cautionary tale“). As I said I didn’t bother with the film’s quality on its own so I’m left to be disturbed by the fact people find it an acceptable reality. placing surveillance equipment wherever some pervert or a shadow-government wants should not be ok, not matter how wonderful it is when it saves lives. Even when a stalker saves his victim from some harm – it does not means that stalking should be an acceptable act.
It is not clear in the movie whether the protagonist accepts the company zero-privacy paradigm as it seems through-out the story that she is appalled by it – does she embrace it as a positive thing? deter from it, or reluctantly accept it? This ambiguity fits well with the movie fairy-tale ending, which is different from the book’s grim and hopeless ending. And maybe that’s the movie biggest shortcoming as it tried to both attack the zero-privacy culture on one hand but to embrace it with the other, claiming that zero-privacy can be done “properly”. I claim that it’s not, and once people’s nude photos are exposed from their private personal cloud there is no going back.
Perhaps zero-privacy should be an acceptable as it is inevitable but we as civilisation should first embrace zero-intolerance towards anything that might be hidden, less we accept living in fear that we will be branded out because of our exposed secret (sexual preference? psychological misbehaviour? political opinion? religious belief?). The movie ends in a somewhat disappointing place where the protagonist accepts reality with no privacy but with the help of deus-ex-machine makes the world a little bit more equal (I dare not spoil), while the book has a grimmer ending in which she accepts the indoctrination without the miraculous “zero-privacy is bad but we can make it work”. She just shrugs her shoulders and moves on. Pretty much like the movie’s reviewers…