HeX0R wrote: ↑Sat Nov 05, 2022 12:37 am
I can only speak for myself, but I never found out what a "Dev-Object" might be, not even when looking at that parent case you are talking about in the first post.
And since I'm not willing to simply test it, only to understand what it is doing, that attitude will not change.
You probably should try to advertise its advantages a little better, otherwise people are jumping in and out quite quickly.
See, this is the kind of feedback I'm waiting for. I will see what I can do. That being said and to answer the questions about what Dev-Object is and what it can do for you. But first and foremost, YOU NEED TO HAVE THE WILL TO WRITE CODE WITH OOP STYLE IN PureBasic which is difficult, error prone and require a lot of work.
Dev-Object is a kind of Computer Aided Programming or CAP tool. The equivalent I have seen in C++ is a Class Wizard tool integrated into Code::Blocks IDE that can be used to generate a header file (*.h) and an implementation file (*.cpp). As you know in PureBasic a single source code can do the job and this is what Dev-Object do for you. This answer the question about what Dev-Object is.
Now let's talk what it can do for you with an example. For a specific project you need a 3D vector of float values library. And it has to be coded OOP style and I tell you what methods are needed :
- Getters
- Setters
- A method that Update or Set all components at once
- A method to set all components of a vector to 0.0
- A method to make a vector Equal to another (Style A = B)
- A method that will return a new Vector3f by adding the component together (Style R = A+B)
- A method that will return a new Vector3f by subtracting the component together (Style R = A-B)
- A method that will simply add the component to an existing Vector3f (Style : A + B)
- A method that will add and Scale the component to an existing Vector3f (Style : A + B * Scale)
- A method that will simply subtract the component to an existing Vector3f (Style : A - B)
- A method that will multiply the components of a vector3f by a scalar value (Style : A * Scalar)
- A methods that will perform a Lerp calculation between two vectors and return the result as a new Vector3f
- A copy method
- A compare method
- A destructor method
- And finally the Constructor
I'm kind of a good guy and I give you this head start and please don't forget to start a chronometer when you begin coding and stop it when it's done.
Code: Select all
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : Vector3f library
; File Name : Vector3f - OOP.pb
; File version: 0.0.0
; Programming : To be done
; Programmed by : HeX0R
; Date : November 5th, 2022
; Last Update : November 5th, 2022
; PureBasic code : V6.00 LTS
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
DeclareModule Vector3f
Interface Vector3f
EndInterface
EndDeclareModule
Module Vector3f
Structure Private_Members
*VirtualTable
i.f
j.f
k.f
EndStructure
EndModule
; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<
And let's see if you can beat Dev-Object fair and square in terms of time required to write the code with the given inputs. Because with the given inputs Dev-Object write the code in 1 millisecond and look like that :
Code: Select all
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; AUTOMATICALLY GENERATED CODE, DO NOT MODIFY
; UNLESS YOU REALLY, REALLY, REALLY MEAN IT !!
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Code generated by : Dev-Object - V2.1.0
; Project name : the project name here
; File name : File name here
; File Version : 0.0.0
; Programming : In progress
; Programmed by : StarBootics
; Creation Date : November 5th, 2022
; Last update : November 5th, 2022
; Coded for PureBasic : V6.00 LTS
; Platform : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
DeclareModule Vector3f
Interface Vector3f
Geti.f()
Getj.f()
Getk.f()
Seti(i.f)
Setj(j.f)
Setk(k.f)
Update(i.f, j.f, k.f)
Clear()
Equal(*Other)
Plus.i(*Other)
Minus.i(*Other)
Add(*Other)
AddScaled(*Other, Scale.f)
Subtract(*Other)
ProductByScalar(Scalar.f)
Lerp.i(*Other, Proportion.f)
Copy.i()
Compare.i(*Other)
Free()
EndInterface
; Declare Free(*This)
Declare.i New(i.f = 0.0, j.f = 0.0, k.f = 0.0)
EndDeclareModule
Module Vector3f
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Structure declaration <<<<<
Structure Private_Members
VirtualTable.i
i.f
j.f
k.f
EndStructure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The observators <<<<<
Procedure.f Geti(*This.Private_Members)
ProcedureReturn *This\i
EndProcedure
Procedure.f Getj(*This.Private_Members)
ProcedureReturn *This\j
EndProcedure
Procedure.f Getk(*This.Private_Members)
ProcedureReturn *This\k
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The mutators <<<<<
Procedure Seti(*This.Private_Members, i.f)
*This\i = i
EndProcedure
Procedure Setj(*This.Private_Members, j.f)
*This\j = j
EndProcedure
Procedure Setk(*This.Private_Members, k.f)
*This\k = k
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Update operator <<<<<
Procedure Update(*This.Private_Members, i.f, j.f, k.f)
*This\i = i
*This\j = j
*This\k = k
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Clear operator <<<<<
Procedure Clear(*This.Private_Members)
*This\i = 0.0
*This\j = 0.0
*This\k = 0.0
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Equal operator : A = B <<<<<
Procedure Equal(*This.Private_Members, *Other.Private_Members)
*This\i = *Other\i
*This\j = *Other\j
*This\k = *Other\k
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Plus operator : R = A + B <<<<<
Procedure.i Plus(*This.Private_Members, *Other.Private_Members)
*Result.Private_Members = AllocateStructure(Private_Members)
*Result\VirtualTable = ?START_METHODS
*Result\i = *This\i + *Other\i
*Result\j = *This\j + *Other\j
*Result\k = *This\k + *Other\k
ProcedureReturn *Result
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Minus operator : R = A - B <<<<<
Procedure.i Minus(*This.Private_Members, *Other.Private_Members)
*Result.Private_Members = AllocateStructure(Private_Members)
*Result\VirtualTable = ?START_METHODS
*Result\i = *This\i - *Other\i
*Result\j = *This\j - *Other\j
*Result\k = *This\k - *Other\k
ProcedureReturn *Result
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Add operator : A = A + B <<<<<
Procedure Add(*This.Private_Members, *Other.Private_Members)
*This\i + *Other\i
*This\j + *Other\j
*This\k + *Other\k
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The AddScaled operator : A = A + B * S <<<<<
Procedure AddScaled(*This.Private_Members, *Other.Private_Members, Scale.f)
*This\i + *Other\i * Scale
*This\j + *Other\j * Scale
*This\k + *Other\k * Scale
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Subtract operator : A = A - B <<<<<
Procedure Subtract(*This.Private_Members, *Other.Private_Members)
*This\i - *Other\i
*This\j - *Other\j
*This\k - *Other\k
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The ProductByScalar operator : A = A * Scalar <<<<<
Procedure ProductByScalar(*This.Private_Members, Scalar.f)
*This\i * Scalar
*This\j * Scalar
*This\k * Scalar
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Linear Interpolation operator <<<<<
Procedure.i Lerp(*This.Private_Members, *Other.Private_Members, Proportion.f)
*Result.Private_Members = AllocateStructure(Private_Members)
*Result\VirtualTable = ?START_METHODS
*Result\i = *This\i + Proportion * (*Other\i - *This\i)
*Result\j = *This\j + Proportion * (*Other\j - *This\j)
*Result\k = *This\k + Proportion * (*Other\k - *This\k)
ProcedureReturn *Result
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Copy operator <<<<<
Procedure.i Copy(*This.Private_Members)
*Copy.Private_Members = AllocateStructure(Private_Members)
CopyStructure(*This, *Copy, Private_Members)
ProcedureReturn *Copy
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Compare operator <<<<<
Procedure.i Compare(*This.Private_Members, *Other.Private_Members)
ProcedureReturn CompareMemory(*This, *Other, SizeOf(Private_Members))
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Destructor <<<<<
Procedure Free(*This.Private_Members)
FreeStructure(*This)
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Constructor <<<<<
Procedure.i New(i.f = 0.0, j.f = 0.0, k.f = 0.0)
*This.Private_Members = AllocateStructure(Private_Members)
*This\VirtualTable = ?START_METHODS
*This\i = i
*This\j = j
*This\k = k
ProcedureReturn *This
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Virtual Table Entries <<<<<
DataSection
START_METHODS:
Data.i @Geti()
Data.i @Getj()
Data.i @Getk()
Data.i @Seti()
Data.i @Setj()
Data.i @Setk()
Data.i @Update()
Data.i @Clear()
Data.i @Equal()
Data.i @Plus()
Data.i @Minus()
Data.i @Add()
Data.i @AddScaled()
Data.i @Subtract()
Data.i @ProductByScalar()
Data.i @Lerp()
Data.i @Copy()
Data.i @Compare()
Data.i @Free()
END_METHODS:
EndDataSection
EndModule
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Code generated in : 00.001 seconds (297000.00 lines/second) <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<
So to make a long story short, Dev-Object can reduce your workload by a huge factor, giving you a good head start and let you focus on very specific code that might be needed to add. In the case of a Vector3f, the Cross product method, the Dot product method, the Length or Modulus of the vector method and so on.
I hope it is more clear for all of you now.
Best regards
StarBootics