Programing, on Creating Abstractions, OOP vs FP
On Creating Abstractions, OOP vs FP
in programing, some programers think in terms of creating abstraction for the task.
- i tend to never, define a function such that it abstract the task.
- in other words, i tend to not ever create a so called domain specic mini lang.
- i fight against it.
- All my functions, is oriented towards, in terms of what the prog lang does. Namely, my function is composition of the lang's operations. That is the fundamental philosophy of my functions. As opposed to, an 'abstraction' that better suites the task.
- here's a concrete example.
- Say, u want to parse url. Or parse say file path. e.g. get file name extension, or dir part, etc.
- Now, with the abstraction mindset people, they create function names such as as protocol part, get domain, etc.
- In more math style, u create functions such as string get prefix, get suffix, etc.
- By the function names, u can see the philosophical diff.
- One is more catered to the task. E.g. get protocol part of a url, means u get the substring starting with everything up to colon slash slash.
- But with math style, u don't create extraneous concepts such as protocol, domain. What the fuck r they? They r not defined in the lang.
- So instead, u have string get prefix, etc. U have string, which is a concept defined by the lang. U write functions, that manipulate this thing.
- No extraneous concept.
- So, in the oop heads, they create these 'abstractions'.
- Which, when u read their code, u need to learn many extraneous concepts. Concepts of the task.
- while, with math style for lack of better term i can think of, all ur functions and program, is based on the definition of the prog lang.
- this is my attack, of the steve idea, in my opinion, utter idiotic idea, which beget him the idea of 'create abstractions' and how struct is basis of oop, etc shit.
- the culmination of this abstraction ideas, is the oop crowd. cpp and java.
- where, to do one thing, u need hundred lines and abstractions, and classes.
- a simple thing as regex, u need a regex class.
- u see, in these abstraction oriented heads, u need a regex class, because, the task is about regex, so, u need a dedicated thing for the task.
- but in math oriented design, regex is simply a string. just use string.
- u no create an extraneous concept for the task.
- similar situation happens with numbers and arithemetics.
- u see, in functional math mindset, u just have a few primitives. number, string, list.
- but in the abstraction oriented mindset, each thing, is a thing of an task mindset. so, even string and regex r really the same data, they need to separate them.
- so, url is its own thing. file path becomes its own thing. text becomes its own thing. even though they are all just string.
- so, in steve mindset, u need to create abstractions, for each of them.
- roughly, these diff mindset, we can say it's oop vs fp.
- as opposites.
- where, for the lispers, where they fall is a matter of degree. eg regarding list of cons or list of vectors.
- so to steve, when he sees the semantics of the vector components are different, he think better is using cons, because vector is meant to be so called homogeneous element types.
- but in math mindset, no. because, vector by the prog lang's def, the elements can be diff types.
- and so in oop mindset, u need to create data handlers, to access the vector components, because it contain diff type and diff semantics with respect to the task.
- in math or functional mindset, no. because the lang defined vector type. u simply create functions for ur task. it is perfectly natural, to use nth to extract any part of the vector. u no create extraneous concept such as 'handlers'. the very idea of 'handler', is offensive.