Home
Home
Map
Map
Download
OS++
Down
Load
Doco A
Doco_A
Videos
Youtube
Chat
Chat
News
News
Shop
Shop

//#! Declaration: http://osplusplus.org/2022standard/Kludge

TLDR; The top line, is a standard declaration using the format (CODE.org/STANDARD/GRADE). You are using this declaration to notify future readers that the following code is written in OS++, with the 2022 syntax standard. But while the code works satisfactorily, it is technically inferior, resource expensive or just not scalable.

The declaration just happens to be an HTML link, which has more information.

Format What it means Notes
CODE.org Is the code language type OS++
STANDARD Is the year of the standard 2022
GRADE Means the code grade or quality Requires attention

For a list of standard declarations and a better explanation. Please visit http://osplusplus.org/2022standard/professional
To see the Language documentation for this language. Please visit http://osplusplus.org/2022doco


The Kludge grade

TLDR; Kludge, Declaring it works, but it’s not a pretty solution

If you make this declaration, it is important to outline the nature of the Kludge so it can be corrected later. A quick REM at the top of the code is sufficient. After all you are the expert in this area and you need to alert other stake holder as to the nature of the situation.

This declaration allows a professional programmer to flag code as being inferior and to solicit advice from the community.

What is this?

Kludge is where a procedures is just wrong. You feel it in your bones. But it works. You are not proud of this. Please note that some Kludges are the best way to solve a problem with the technology at hand. Time will be the final arbiter.

Real life Example

OS++; started life as a openscad cube module that could be rendered like a cylinder. A cube grows from X=0,Y=0,Z=0. A cylinder grows from the X=Middle of shape, Y=Middle, Z=0. So a cube that could be rendered like a cylinder would grow from MM0. I called the module lib_cube_MM0(X,Y,Z). Soon I wanted to render a cylinder and a sphere like a cube ie from 000. This resulted in lib_sphere_000 and lib_cylinder_000. But if a 0 is the first point, and M is the middle point. What is the Last point? I decided “9”. The last digit in the decimal system.

Now, Since we have 3 axis. Each with 3 points. We have 3^3 or 27 cubes, sphere and cylinder modules. A total of 81 modules ie 333. I used awk and bash to generate all the modules, starting at “000” and ending “999”. This was quite a large library. This was a kludge (the library, not it’s generation method). It’s called “inline programming”. Essentially rather than loops,functions and variables you just lay out the code, in a long list. This Kludge worked well. It was fast. And it allowed me to test the concepts and get on with 3dprinting. However it was not scalable. Later versions used more characters. If 0,M,L (which replaced 0,M,9), from the initial code, is considered a base 3 system, then the latest generation supports base 12 (A,B,C…L), and base 10. Let’s forget about p&P and you have 23 chars (0,M,L,1-9,A-K) for each axis. 23^3= 12,167 different procs for cuboid alone before you include all the different Rcuboids. Therefore this programming technique, that I used in generation 1 was a kludge as it could not be used in later generations.

TLDR; I used inline programming on the first generation of code. This was a Kludge as it worked well in that situation. But it was not scalable to the later generations. The process of declaring code as a Kludge, allows a programmer to ask for help and get input on making their code better. Since I work alone, that someone is an older and “wiser me”.


Site summary (added to bottom of every page)

Web links    
 The_Download = UNIX - The_Download - OS++ Framework
 The_Download = Windows - The_Download - OS++ Framework
 Front_door = OSplusplus.org
 2022standard = OSplusplus.org/2022standard
 Grade EG = OSplusplus.org/2022standard/Professional
 Doco = OSplusplus.org/2022doco/
 Terms & datatypes = OSplusplus.org/2022term/
  =  
 Youtube Channel = https://www.youtube.com/channel/UC5GqhceNMLX4iDNClEWT0Fg
Code map    (Download page)
 Examples = /Example_lucky_dice_succinct_v2_0_0.scad
 Templates (Use this) = /Template_minimal_v1_2_0.scad
 Templates (too long) = /Template_verbose_v1_1_0.scad
 Project_template (Use this) = /project_template
 Libs root = /z_lib/
 3rd party code = /z_lib/addon
 Cuboid = /z_lib/lib_cuboid
 Cones = /z_lib/lib_cone
 Spheres = /z_lib/lib_sphere
 Cone Maths = /z_lib/L0_cone
 Cone Math/Cyl = /z_lib/L0_cone/z_ref_Cyl
 Libs_unit_test = In directories above
   
Hard_code_learning (Play/Learn by example)
  Download 2022standard, Uncompress, untar.
  Open Openscad (AppImage 2021.01-x86_64).
  Load Learn_Hard1A_v1_0_0.scad
  Press F6. Nothing happens.
  unRem block, Press F6 and render.
  See code example come to life.
  Change parms. Destroy code. Reload. Repeat.
Procedure for use
  Download 2022standard,uncompress,untar.
  Delete all files in root except template
  Copy template to new file name
  Edit new filename
   
Author
 Stephen George
 3rd March 2023
Contribute (LOL)    
 Buy me a coffee =
 Talk to me = Sure! Buy me a coffee. I think there is a message feature on the coffee site.
 Bugs & Finance = TBA
 RFC = TBA