I have gone through the OOP pain and things or wording is misleaded sometimes.
- OOP is a paradigm; You can do OOP in Assembler, C or PB
- OOP is ...orientation...; things are seen different between JAVA, C++ or CLOS
- "OOP" as a word is a bu..sh.. word for management: "What apps do You build?" "Web" (in intranet!); "What language do You use?" "TypeScript" "Aaah, OOP!"; "What framework?" "VanillaJS" "O.k.!"
- PureBasic is not only not OOP it is also not a typed language! You can send a *Person.SPerson to a getName(*User.SUser) without compiler complaining
- OOP is sometimes single inheritance and sometimes multiple inheritance or multi-methods (CLOS) or interface inheritance only (VB6)
- OOP means encapsulation of concerns which You can do with modules, too
- OOP means a world of objects (and waht about processes, functions, algorithms?)
- AOP means, oops, too much in too many classes
- OOP is mostly objects for the GUI; yes, it makes sense to call one method 'draw' for many objects
- OOP encapsulation is about vendors being able to sell AND hide components from component users
- C++, etc. OOP means generics, AOP, iterators, etc., etc. all pressed in an OOP paradigm even it does not fit
- next big thing is functional programming (FOP) -> "functional programming is slower than procedural" What????
- FOP: IMHO write once, read never again
- recursive call to procedure: should be forbidden! Every recursive algorithm can be written iterative AND is then better liable!
- back to OOP: the biggest problem for me -> hierarchy; there is only one hierarchy possible; did You ever had a one and for ever lasting folder structure on Your system? Or a shared between colleagues folder structure in office without a mess at the end?
- OOP: is never alone; You need a lot of design patterns to work around the fixed structure of this concept
- OOP is always said to be "not the one solution to all problems" but I think most of people/management thinks exactly that!
Asking for OOP in PB is not the right question.
How shall the PB team change the overall procedural architecture into an OOP one?
Like C -> C++? Desaster!
This is OOP in PureBasic:
Code: Select all
procedure draw_Control(*C.SControl, Type=0)
protected T
if Type=0
T = *C\Type
else
T = Type
endif
select T
case #Type_Button
draw_Button_Control(*C)
case #Type_ComboBox
draw_ComboBox_Control(*C)
;etc.
default
AncestorType = get_Ancestor_From_Is_Type_Map(*C\Type)
procedureReturn draw_Control(*C, AncestorType)
endSelect
endProcedure
; You can imagine the use...
Disadvantages:
- manual writing of overridden procedures
- manual definition of selection
- slower execution than direct call (but You want to use a dynamic method, right?)
- no autocompletion possible
Advantage:
- no super-tricky macro system -> debugger works
- easy decision what is drawn first and "fastest"
- leaving virtualization in GUI context
- You can optimize code where it needs to be optimized
So, before complaining about missing OOP in PB, PB shall implement a complete type system. Next discussion...
Then, we need a big voting about what should be contained in OOP and in what way.
And, furthermore, this OOP-discussion is a decade too late; today we are in a functional discussion.
I say: we have to come to a logical programming discussion and an interpreter discussion.
The most successful language today? -> JAVASCRIPT
JS is a herit of LISP! (btw. and not JAVA)
OOP brings more problems than it solves!
I need to do my job now and tomorrow.
And that means building, changing, error checking, changing back, testing, changing forward again and all that done yesterday.
With an OOP approach the doing would not change but OOP makes a bigger mess at the end.
But one thing is obvious in this discussion about OOP in PureBasic:
PureBasic is so smart, easy, fast and good that people want to have the things from C# or Java in it!
I think this comparison is not fair.
PB is a fast and easy to use compiler.
If You want more You can not find in market, build it!
I propose to do it in a pure beginners all purpose symbolic instruction code way

But don't forget that PB is more like C than like BASIC...