A r t i c l e s
Navigation

Note: This site is
a bit older, personal views
may have changed.

M a i n P a g e

D i r e c t o r y

Slave Oriented (SOP) Make Fucking Directory Now


And if you think I'm on crack for saying such things, see this PDF file. Modula/Oberon programmers agree with my philosophies, it seems. The PDF file states that objects are not Holy Cows, and that sometimes we are better off using modules and procedures.
While building a large parser system I needed a way to grab some html pages from the net and throw them in a directory. I wanted the files to be in a sub directory that was dated. I wanted the directory to be named the date that I grabbed the files on, because I may grab these files in the future on a different date and I don't want the previous files overwritten.

Eventually I might even migrate these files into a database and would put in a "date" column on the database table, which could be easily linked to the old files in the dated directories. That's later stuff that we don't need to worry about now.

So what's the first thing that came to my mind?

Listen, you fucking computer, Make a Fucking Directory NOW, labelling the directory as the current date. And do it NOW, as I tell you, as I think, as I say. Do as I say. You are my slave. I own you.

I don't have time to piss around with funny mumbly jumbly polite doublespeak junk like sending the File object of the OS object of the system object a nice message that then creates an instance of an instance which is abstracted to finally make the damn directory through a factoryFileCreationer, but first having to create the stringHolderItemMinorFactory in order to store the HTML somewhere, and then having to instantiate the fileCreationConnector which connects the file system to the programThingy.

Just let me do this:

  MakeDir(path);
SLAVE ORIENTED PROGRAMMING (SOP).

Programmer tells computer to do the job as it is, not as it could be.


By the way, this was the loop I was working on:
const
  DIRSEP = '/'; 
  SAVETO = 'output/html/';
  STATES: array [1..51] of string =  (
    'al', 'ak', 'az', 'ar', 'ca', 'co', 'ct', 'de', 'dc', 'fl', 'ga', 'hi', 'id', 
    'il', 'in', 'ia', 'ks', 'ky', 'la', 'me', 'md', 'ma', 'mi', 'mn', 'ms', 'mo',
    'mt', 'ne', 'nv', 'nh', 'nj', 'nm', 'ny', 'nc', 'nd', 'oh', 'ok', 'or', 'pa', 
    'ri', 'sc', 'sd', 'tn', 'tx', 'ut', 'vt', 'va', 'wa', 'wv', 'wi', 'wy'
  );

// Get Urls? Pardon me? Not a factoryUrlGetterSystem abstracted object?
procedure GetUrls;
var
  i: integer;
  tmp: string;
  fname: string;
  curdate: string;
  curdir: string;
begin
  // yes, the time, right NOW!! That's all I ask
  curdate:= FormatDateTime('DD-MM-YYYY', NOW);  
  curdir:= SAVETO + curdate + DIRSEP;
  // make the damn directory and do it as I say
  MakeDir(curdir);
  for i:= low(States) to high(States) do
  begin
    fname:= curdir + States[i] + '.htm';
    if FileExists(fname) then continue; // skip if we already got
    // GET THE HTML AND DO AS I SAY
    tmp:= GetHtm('http://somesite/' + States[i]);
    // SAVE THE FILE AND DO AS I SAY
    StrSaveFile(fname, tmp);
    statusmsg('got page ' + States[i]);
    // SLEEP! COULD IT BE MORE FUCKING OBVIOUS? NO.
    sleep(500);
  end;
end;

And it worked great. No complaints. Missing some error checking, but don't care, as it is a temporary thing I need to do to analyze some html.

You see, when I tell the computer to SLEEP, I mean SLEEP.. and SLEEP NOW, for 500 milliseconds, or else. When I say SLEEP, I do not mean to send the system object and instantiate the abstracted console acceptor object to message the factorySleeperSystem. I just mean, SLEEP, and do it now.

And when I say MakeDir, I mean, make a fucking directory RIGHT NOW as I tell you. I don't mean to send the system object and instantiate the abstracted console acceptor object to message the factoryDirectoryCreatorSystem. I just mean, MAKEDIR, and do it now.

Do as I say, computer, not as I could say. Do as I SAY!

And the computer doesn't even ask for money or food.

About
This site is about programming and other things.
_ _ _