Skip navigation.

Memel

Infinite Power Computing Theory & Practics

Posts tagged with "IPCT"

Tag-Oriented Programming (TOP)

This is quick dump of thougths, so please don't push me hard.

Object-Oriented Programming (OOP) has one main and big disadvantage. Application object hierarchy is mostly static and must be (well) developed at design time. Even though it reflects the initial problem very well, it's inflexible for future problem changes. In other words OO isn't change-oriented. In real world not many things work that way. That's why I prefer procedural or functional over OOP.

But if we add some sugar to OOP and make objects somehow not strictly connected to the program logic flow, we may overcome that OOP limitation. Let's call it TOP (Tag-Oriented Programming). I found only one mention of this term on Internet, and it was in the project called AJAXTOP. The idea is similar, but not the same. Please forgive me for using this term for my needs.

As it's known, procedural is about Verbs: i.e. doSomething(noun, noun), and OOP is about Nouns, i.e. Something.do(Noun). Now we will try to take advantage of both these camps.

Suppose we have to create an Invoice. Let's define the process (or task) of invoice creation as 'createInvoice'. In p/f (procedural/functional) world there would be a long process, consisting of 100s lines of code and a number of function calls within. Suppose we have:

function createInvoice(var, var, var, ...) {
    prepareForm(var);
    ...
    importOrder(var);
    ...
    checkWithInventory(var); 
    ...
    addClient(var);
    ...
    sumTotals(var);
    ...
    printInvoice(var);
}  


There we have 5 different actions, which may or may not be useful in other processes.

In OOP world there would be 5 objects probably created to supply inteface for these 5 actions:

class Form;
class Order;
class Inventory;
class Invoice;
class Client;


These objects may also be used for other tasks. Then the process of invoice creation could be programmed as follows:

    
    ...
    Form.prepare(var);
    ...
    Order.import(var);
    ...
    lambda = Order.checkInventory(var) {
        Inventory.parse(var);
        ...
    }();
    ...
    Client.add(var);
    ...
    Invoice.sumTotals(var);
    ...
    Invoice.print(var);
    ...


Everything is fine until it must be changed. In both cases changes must be done within the process. Could it be some way to make changes without altering the process code? Yes. Tagging.

In the world of TOP the code of createInvoice could look like follows (in pseudo-Javascript semantics):

object createInvoice(config) {
     tags: new Array();
     
     addTag: function() {....},
     removeTag: function() {....},
     replaceTag: function() {....}
     
     excecute: function(param) {....};
}

Now we add tome tags to the process:

addTag('INVOICE', 'create');
addTag('FORM', 'default');
addTag('ORDER', 'import');
addTag('INVETORY', 'checkOrder');
addTag('CLIENT', 'add');
addTag('INVOICE', 'sumTotals');
addTag('INVOICE', 'print');
....
createInvoice.execute(param);


There also can be an alternative set of tags created, for example:

addTag('INVOICEcreate');
addTag('FORMdefault');
addTag('ORDERimport');
addTag('INVETORYcheckOrder');
addTag('CLIENTadd');
addTag('INVOICEsumTotals');
addTag('INVOICEprint');


We don't mind which set of tags we use and what form of tag logic we would execute. It can be on the client-side, server-side, multiply servers/processors, OPUs (see my previous articles), etc...

Now what about Tags? It might be regular objects, regular functions or whatever regular. These may be either preprogrammed, or created on the fly. It could be even non-existing tag object at execution time, and default or testing/debugging action would be performed in such case. Tags may be freely added or changed at any time, could be read from DB, read from special tag-filesystem and so on. The execution flow order could be any: ordered in some way, semi-parallel, fully parallel.

Now, when we need to change our program logic, we just change the set of tags! However, in case we need to perform some new operation, we'll always have to create a new tag handling object/procedure. But this tag's object logic would be no more so statically connected to an existing object class and our process, as it is in regular OOP.

Tag-oriented programming looks somehow similar to the actors parallel programming model. Maybe I'm not the first coming with this. However, I see not too much speaking about this programming model in a meantime.

OS -> Google Web -> Nothingness = Parallel Net

,

Does this title seem quite cryptic? Here I'll try to decrypt it.

I remember, in early 90-ties, Linus Torvalds told a great phrase. I don't remember it exactly, but he told something like this:

We don't need any kind of backups anymore, since there is an Internet. 1000s of FTP servers are constantly doing backups of my Linux system pretty well...



That quote went rather unnoticed so far... Probably I was one of few, who took it for serious. Meanwhile, the recent events show us that this starting to be a reality. Particulary with new Google browser. Most of JRM (J.Random Men) may think that this is just "yet another Web Browser". And it may look like that...

Day 1.

In the beginning it was OS... OS worked on a single computer (or mainframe) and it was Ok. All Powers of Universe (CPU) was concentrated within small separate boxes, and everyone could have a little of that power in their working room or even at home. One near-god called Moore has created a Growth of Power, and since then the Power had double-increased ones and every 18 month. Another semi-god called Gates has created a conglomerate of Computer and OS and everything went Ok until...

Yes. It is Google that broke the rules. To be fair, before that there was another sub-god(s) living in CERN who created Internet. In fact, that was a side effect of trying to create a document publishing system, but who cares...

Day 2.

Google created the Web Browser. Did him? No. Not really. Not at all! There were other small and big Gods who been creating web browsers all the time before. So what in real did Google created? None! Nothing! To be more precise - Nothingness!!! (See below). First of all, Google stole the OS from other God's Computer. And put it to the Server (which hasn't been created by any-God, and was just a sink for homeless extra Power). See the results:

Gate's Computer'n'OS - OS = Computer <=> Google Web Browser
Server + OS = Google Web OS

Next equation is not so obvious:

Computer'n'OS - OS = Google + Power (I'll leave you here with your further allusions),

but when you realize that most of the Power was needed to run the OS, you'll simply get this equation.

DAY 2 HAS COME A WEEK AGO. But this is not the last one. Day 3 is coming...


Day 3.

JRM were feeling happy having no more deals with Backup for their data and applications and totally trusting in semi-Gods of Google and some other Gods nearby Google Olympus. They could access all they need from many kinds of devices wherever they could have been sitting, sleeping, eating... Nobody, not anymore, cared about Computer, which left without its Power. The Power now was everywhere in Internet in a form of homeless wild Power. Nobody have seen it since in the form of Processor or CPU. Now it was in a form of the Net. Their small devices had only a small fraction of old-days Power, which was equal to what they have had 10 years ago... (Google's been constantly improving all its Power Horses, called JavaScript, so the devices had been becoming more and more powerless, rapidly approximating to Nothing (compared to overall Power). All is needed - to be able to run Google Browser.

And here came Nothingness. Him was not of any God's kind. Him was a child of Backup and ZFS (edit: not a mistake, not GFS!). (Remember? Google, like they or not, had created Nothingness). Google probably had had things out of control in letting to meet them both... And this was very dangerous.

Nothingness set the Google's Power free and let it into the wild of Net.

JRM even didn't realize this! They still had their documents and apps off their devices and worked as usual. But now they had a lot of Backups! No. Not really Backups. They had Nothing! No, not really. They had their documents Everywhere! But not even one contiguios peace of the whole document or app was ever found at one place. The chunks of documents now were scattered among 1,000,000s of Servers across the Net. What could they dream even more? Now they have an Ultimate Backup, which would never ever be broken, missed or burnt! And doesn't belong to any particular or trusted site.


The Day After.

I'm not a God. So I didn't create anything (yet). But I can see a gigantic Parallel Net. It becomes more and more real with every coming day. We now are at the Day 2. That's it. Take it - or leave it.

I can also see how JRM are switching on their devices, which have only a small Browser OS inside, and start a Document. Browser asks the Net to assemble a Document application. It comes from the Server of unknown. Nobody knows how this Server is assembling the parts of application - it just searches for the parts and their corresponding versions. Some bigger parts of application may be pre-assembled on other Servers, and so on. The application self-parallelising algorithm may assemble it on demand. Some of parts even can never reach the final assembling point! Those will be just executed at place. The whole Net will be just a gigantic super-computer, performing all tasks for everyone. On the other hand - the document, which is saved by device, comes out to the Net too, split into many small chunks, and stored across millions of Servers by same parallel algorithms in a RAID manner. This should be really super RAID!

The resulting Document will be existing Everywhere and Nowhere at the same time.

This will be Parallel Net.

Shell I ask for Reward?

, , ,

It happened exactly as I expected. I found a plagiary of my original work on parallel computing at Microsoft's MSDN site . And they even have made a quick-hack implementation for .NET pratform, and aslo exactly in the way as I've proposed in my paper.

When I first published my work one of anonymous commenters asked me whether I had received an offer form Microsoft. It sounded as a joke. And I answered that Microsoft will NEVER contact some unknown small company, especially if it is located in the middle of nowhere...

So far the rethoric question still is: should I ask Microsoft for rewards? Or, at least, for being mentioned in their work?

Programming as Phylosophy. Part 2.

, ,

2. When you think you're programming...

And what it really is:

  • Tweaking the code to run innermost loops a little faster: this is preparing for competition in the market;
  • Resolving border conditions, fencepost errors and race conditions: debugging
  • Rearranging and structuring the code, merging duplicated parts, making functions shorter and clearer: preparing for better product maintenance
  • Indenting code, providing comments: preparing for presentation
  • Optimizing the code, rewriting parts of code: consequences of bad initial design
  • Fighting with tools and frameworks, making workarounds, avoiding known bugs: debugging, testing
  • Creating sophisticated constructs, such like "one-liners" in Perl: no point at all; overcomplicates further maintenance
  • Writing the initial code from scratch: yes - this is a part of programming!



To be continued...

Programming as Phylosophy

, ,

Introduction

I decided to start here a sequel of articles on how I understand Programming. It may be useful for some Programmers (note the capital letter), or may be not. In fact it doesn't matter. I believe that any shared points of view are somehow useful. Even if some of them are totally wrong. And this is a part of my phylosophy too.

To begin thinking about Programming from an existential philosophy point of view I can give some starting theses here:

  • 1. The decision making during any programming project is nothing different from any other everyday's life decisions we make (or like to make) every day.

  • 2. The programming process is only a certain slice of view on real (or imaginary) problem. The result of the process is only one of many possible results, most of which could be well acceptable too.

  • 3. In conclusion - nothing special is in Programming comparing to all our other activities in life.



Disclaimer: I will write these series in a form of short brain-dumps in unformal way, with no respect to conventional wisdoms, encyclopedic knowledge and famous idols. I can call such my style as a Optimistic Controverse. In order to confirm my right to behave so shamelessly, here is a short list of facts of my life in Programming:

First program written: October 1975
First language learnt: Fortran
First OS: IBM 1400, IBM/360
First UNIX experience: 1987
First Linux Experience: 1994

Languages in use: Fortran, Algol, PL/I, C, LISP, Perl, Shell, JavaScript, 4GLs
Languages learnt, but ignored: C++, Java, Python
Last language learnt: JavaScript, in 2000
Preferred languages: C, JavaScript, 4GL

Technologies in use: (D)HTML, XML, Ajax, TCP/IP
Technologies ignored: UML, SQL


1. The definition of Programming

What to say about Programming...?

I am often being asked to speak on that. Now I shell try to explain my feel of Programming more seriously. The main and first thing I realized to myself in years - it is NOT just coding. In other words - it is much more than coding.

Let me define Programming as a kind of non-material philosophy.

All what you program in your life - doesn't really exist in material world (except the huge set of magnetic distortions on various media devices, which have nothing to do with your ideas, thoughts and emotions when you are inside the process of Programming). You cannot become a Programmer just by will. It's as much as you cannot become an aristocrat or artist. You can only born with it. Otherwise - you are a coder, or even worse - developer. Unfortunately, these states of "programmers" are prevailing in modern times. But let them be, - we need them too.



To be continued...
December 2009
M T W T F S S
November 2009January 2010
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31