From 75e9bf94499f344af33c7404eb7fb01b8dbdd077 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Wed, 15 Jun 2022 17:30:19 -0300 Subject: [PATCH] Planning a new project --- content/projects/rubidium.md | 43 +++++++++++++++++++++++++++- content/thoughts/the-types-of-oop.md | 15 ++++++++-- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/content/projects/rubidium.md b/content/projects/rubidium.md index ccec5e3..56a203f 100644 --- a/content/projects/rubidium.md +++ b/content/projects/rubidium.md @@ -77,9 +77,50 @@ pub struct Case { pub struct Step { name: String, + command: Command, +} + +pub struct Command { command: String, + name: String, } ``` After reading the data from the disk, the code could check if the step is "valid", -like checking if the command exists and can be called. +like checking if the command exists and can be called. The `Command` doesn't +exist in the configuration file, but it is generated while being loaded; the +command itself it is the command specificed in the runner configuration file, +but its main component is extracted and put in the name, to make it easier to +display to the user; for example `/usr/bin/ls -lha` in the configuration file +would have the same value in the `command` field, but the `name` would be +simply "ls". + +For every structure, they is a "sister" structure "Run", with the results of +the execution: + +```rust +pub struct CaseRun { + case: &Case, + status: CaseRunStatus, +} + +pub enum CaseRunStatus { + PendingSteps, // there are still steps to be run in this case + Completed, // no more steps available + Error, // one step failed and it shouldn't run anymore +} + +pub struct StepRun { + step: &Step, + status: StepRunStatus, + output: String, +} + +pub enum StepRunStatus { + Waiting, + Running, + Done, + Error, + Skipped, +} +``` diff --git a/content/thoughts/the-types-of-oop.md b/content/thoughts/the-types-of-oop.md index fa1559b..e939fe9 100644 --- a/content/thoughts/the-types-of-oop.md +++ b/content/thoughts/the-types-of-oop.md @@ -31,10 +31,11 @@ base class in a child class and overrides the method. And that's basically it. But, in real life, things are not quite like that. -Ok ok, there are examples in real life that are basically that, but I don't -think we *start* with that, we *use* that. +Ok ok, there are way more examples of things written in real life OO beyond the +ones I talk here, but in my experinece they are not that common. Of course, your +mileage may vary. -So, what do I mean by "Types of OOP"? +So, what do I mean by "Types of OOP" in "the real world"? ## The Grouping @@ -162,3 +163,11 @@ everywhere. {% end %} ## The Framework + +The last common OOP design I usually see is what I can call "the +framework". Usually, projects are not written in this style, but the framework +they use allows this. + +The framework is focused on having lots of methods in some class that you extend +and override a couple of methods. For example, if you are using Django, you may +use