Saturday 4 July 2015

brief object-orientated vs bko example

So, I was reading the not so great computer/programming jokes here, and one example was "this is how a programmer announces a new pregnancy":
var smallFry = new Baby();
smallFry.DueDate = new DateTime(2012,06,04);
smallFry.Sex = Sex.Male;
//TODO: fill this in: smallFry.Name = "";
this.Craving = Food.Cereal;
this.Mood = Feelings.Excited;
Hubs.Mood = this.Mood;
So, as a quick exercise, I decided to convert the same knowledge into BKO:
due-date-of |baby: smallFry> => |date: 2012-06-04>
sex-of |baby: smallFry> => |gender: male>
name-of |baby: smallFry> => |>
craving |me> => |food: cereal>
mood-of |me> => |feelings: excited>
mood-of husband-of |me> => mood-of |me>
Some notes:
1) BKO doesn't need "new SomeObject". context.learn() takes care of that if it is a ket it hasn't seen before (in this case |baby: smallFry> and |me>)
2) the BKO representation is "uniform". They all take the form of:
OP KET => SUPERPOSITION
3) there are some interesting similarities between object oriented and bko, as should be clear from the example. Though BKO is more "dynamic". In object-orientated, if you want your objects to support new methods you have to dig into the relevant class(es). In BKO this is never an issue.

2 comments:

  1. Chuck Moore's Problem-Oriented-Programming paradigm built with his colorForth has a VERY similar philosophical ordering to your BKO scheme. No?http://colorforth.com/POL.htm

    ReplyDelete
    Replies
    1. thanks for the link. I'll try and have a read sometime, it is quite long. I might just cheat and see what wikipedia has to say.

      my language also has a similarity to APL in that you can get a lot done in one line of code by using a long series of operators. I think in APL you step from array to array as the operators process, in BKO you are stepping from superposition to superposition. On the command line you step from text file to text file. And I think in Powershell it is full objects - I think.

      Delete