Saturday's Reflexion!!!

Saturday's Reflexion!!!

(***********************************************************)
What innovation in programming tools or language features,
HAS BEEN CHANGED YOUR LIFE?
(***********************************************************)

Days ago I sensed nostalgic, cause I found a gadget that emulates or recreates my favorite eitghties home computer: "Sinclair Spectrum". I've searched things about... to make more hurting my nostalgic moment, may be. :(

Finally I found this project: https://sites.google.com/site/pauldunn/

It is an emulator of Sinclair Spectrum Basic, inside an application Made in DELPHI!!!!! Really compiled with FreePascal, but the defines speaks all the time about “{$Mode Delphi}". I've downloaded the code an with a little set of changes, I got it compiling on Delphi 10 Seattle.

Ready to make my contribution!!!!

When I revise the code, I found a surprise....

All the code is PROCEDURAL PROGRAMMING!!!!!

Yes!!! No Classes. No Objects. A lot of pointers. References with @ and ^. ...

The code is beautiful, very nice code. Well structured. Well commented. But... after more than 25 years thinking in objects, It's very hard and difficult to me "read pure procedural code again".

And here comes my "Saturday's Reflection".

What innovation in programming tools or language features,
HAS BEEN CHANGED YOUR LIFE?

OOP? "for ... in" loops? inline procs? Interfaces? .....

Share it with us!!!
https://sites.google.com/site/pauldunn/

Comments

  1. For me it is:
    - generics
    - anoymous methods
    - inline procs, types, classes
    - procedure of object
    - variant data type
    - and of course OOP (but I began with it)

    ReplyDelete
  2. I'm constantly declaring event handlers in my classes, that after, I use in the same way that delegates on .NET

    ReplyDelete
  3. Well, "changed my life" sounds a bit drastic, but learing about interfaces radically changed the way I thought about code.

    Next would have to be functional programming which I got a taste of in other languages, but which can be realized to some degree with the combination of generics and anonymous functions.

    ReplyDelete
  4. MVC (and all his derivatives).

    After take the habit of thinking in OOP, the next step was think in relations between classes. And the OOP patterns has been influenced my development very positively.

    ReplyDelete
  5. ¡¡¡Automated unit testing!!!! wow!!!!

    In my more critics projects, be sure that after an integration, we haven't breaked any of previous tested functionalities... this help me to sleep happy every night!!!

    ReplyDelete
  6. * RTTI
    * delegates (method pointer)
    * unit testing
    * distributed version control systems
    * AST-powered IDEs

    ReplyDelete
  7. George Bakhtadze
    Oh yes!!! of course!!!

    Has been Influenced me highly the Branching strategies with version control tools. Thanks to these tecniques, I've managed very big teams, without complex conflicts and with highly productivity.

    ReplyDelete
  8. Oh Juan, nostalgic for me too. I was SINCLAIR user since ZX81 ... Fantastic!!!

    ReplyDelete
  9. Oh, my - many thanks for your assessment of my code :)

    SpecBAS is a personal toy to mess around with - my fulltime job is coding in Delphi Seattle (though we're moving up to Berlin soon). It was written in Delphi XE8 but as one of the porting targets is ARM/Linux, I had to be very very careful to keep Windows-specific code to a minimum. That's why there's a few {$ifdef fpc} in there. I've recently added OSX targets to it, but that's also built using FPC because Delphi's OSX support is just so bad.

    No objects or classes, true - I had considered making a BASIC interpreter class to leverage allowing the user to multi-thread several BASIC programs at once, but that never really got off the ground - you kinda have to start with that goal in mind, rather than add it later on.

    There's a lot that can be improved - the program is stored in ansistrings, and executed by reading at a pointer inside those strings. That said, it's quite fast and has some nice optimisations in there such as peephole, caching etc. The actual "compiler" which builds for the virtual machine is very long-winded and needs to be refactored.

    I've been developing it for 5 years now, and no signs of stopping :)

    ReplyDelete
  10. You made a good job. Sure.
    It's admirable.

    Did you think that a fork of your project is possible?

    I thinking in an interpreter of BASIC inside a class.

    The scene may be like...
    - As programmer, you can create an object for the interpreter.
    - You can feed the memory of the interpreter with all the VARIABLES that you want from your own program.
    - After, you can execute the code of the SpecBAS, provided by the programmer too.
    - The result of the of the execution, may be a list of values of the memory variables in the SpecBAS object.

    The scene for the user is:
    - The user can create SpecBAS scripts to be executed as response of concrete events at the application.
    - Thank to SpecBAS, the user can create this programs interactively.
    - The program is executed in a sure environment for the application.

    May be, when this is running, add things like interact with the live objects inside the application.

    Currently I'm using FastScript from FastReport company, in the manner that I say. But the scripts languages are "something similar to VBasic", "something similar to JScript" and "something similar to Pascal Script". Is good but....

    Give to the users a tool like specBAS may be very very funny. don't you think?

    Can you see the specs of my application?
    "You can modify the default behavior of the application with scripts of Sinclair Spectrum Basic language".


    Nice to meet you, Paul.

    ReplyDelete
  11. That certainly sounds like fun :)

    I'd need to convert the current procedural system to an object/class - but that could be quite easy.

    You could just feed the class with a list of program lines which it then tokenises and executes, after which you could query the values held in variables without issue. The main problem is when the user creates an infinite loop, which spins around sucking up CPU and never exits... But that could be dealt with too if the class launches the interpreter as a separate thread.

    I'll have a think about that one :)

    ReplyDelete

Post a Comment