It is currently Tue Oct 23, 2018 9:37 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: OOP tutorial added to the nxSoftware site!
PostPosted: Mon Feb 02, 2009 12:36 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10441
Location: Beyond the pale...
Hi,

just thought I'd let you know that I have just added the first tutorial to the nxSoftware site (in the form of a downloadable zip file).

This one kind of came at me by request and it interested me enough to cobble together a few words lacking in any kind of wisdom! :)

The tutorial aims to show how to use simple OOP techniques using nothing but native Purebasic code (i.e. no pre-processors etc.) It doesn't try to discuss general OOP techniques or program design or convince anyone that they should be using OOP above all other paradigms etc. It is simply intended to show how to implement a basic class in Purebasic etc.

This interested me because I now use OOP in all of my Purebasic programs; finding that PB's simplicity and clarity means that it's basic OOP is, for me at least, very effective and a boon for maintaining my code! :)

For those who use some of my OOP utilities and have studied the code therein, there will be no need at all to look at the tutorial as there will be nothing new in there for you. Ditto for those who have already used OOP in PB for themselves.

I hope it is useful in some way, but apologise in advance if it turns out to be a pile of unlaundered pants! :wink:

Regards.

Stephen.

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject: Re: OOP tutorial added to the nxSoftware site!
PostPosted: Mon Feb 02, 2009 8:39 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 27, 2007 12:38 pm
Posts: 589
Location: Finland
srod wrote:
This interested me because I now use OOP in all of my Purebasic programs

I do too, and it has boosted my productivity ten times over. Thanks for the tutorial -- interesting stuff :)


Top
 Profile  
Reply with quote  
 Post subject: Re: OOP tutorial added to the nxSoftware site!
PostPosted: Mon Feb 02, 2009 10:47 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10441
Location: Beyond the pale...
eesau wrote:
srod wrote:
This interested me because I now use OOP in all of my Purebasic programs

I do too, and it has boosted my productivity ten times over. Thanks for the tutorial -- interesting stuff :)


Aye, I would claim a similar boost in productivity simply because OOP forces me to think in far more depth about my program's design etc. Gone are the days of leaping head first into an application only to code myself around the equivalent of a u-bend to then have fangbeast come along and flush the toilet!

In a strange way I am glad that PB has not gone down the OOP path because with things the way they are it is just all so simple and, dare I say it, logical! :)

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 02, 2009 11:04 am 
Offline
Addict
Addict
User avatar

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3225
An excellent tutorial! I've been looking forward to this for a long time. Thank you for sharing. :D

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 02, 2009 12:44 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Fri Apr 25, 2003 6:03 pm
Posts: 3000
Location: Lincoln, UK
Amazing that people are starting to learn more about the benefits of OOP. See, it's not an elitist thing, it really does help. :wink:

Maybe Fred can start to think about PB v5 being fully OOP? :wink:

*Can open ...again* :twisted:

_________________
--Kale

Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 02, 2009 1:16 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 7983
Location: Fort Nelson, BC, Canada
Quote:
*Can open ...again*

Hehe, not really such a huge can I guess as long as it would be OOOP - "optional object oriented programming" 8)

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 02, 2009 1:30 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Apr 25, 2005 9:28 pm
Posts: 700
Location: $300:20 58 FC 60 - Vietnam
:D thanks a lot srod

**edit*** inside rectangleclass.pbi, the last line :
Code:
;-VIRTUAL TABLES.

DataSection
  VTable_RectangleClass:
    Data.i @RectangleClass_Area()
    Data.i @RectangleClass_Destroy()
    Data.i @RectangleClass_GetLength()
    Data.i @RectangleClass_GetWidth()
    Data.i @RectangleClass_IsSquare()
    Data.i @RectangleClass_LengthOfDiagonal()
    Data.i @RectangleClass_SetLength()
    Data.i @RectangleClass_SetLength()
EndDataSection


change to

Code:
;-VIRTUAL TABLES.

DataSection
  VTable_RectangleClass:
    Data.i @RectangleClass_Area()
    Data.i @RectangleClass_Destroy()
    Data.i @RectangleClass_GetLength()
    Data.i @RectangleClass_GetWidth()
    Data.i @RectangleClass_IsSquare()
    Data.i @RectangleClass_LengthOfDiagonal()
    Data.i @RectangleClass_SetLength()
    Data.i @RectangleClass_SetWidth()
EndDataSection


:wink:

_________________
“Fear is a reaction. Courage is a decision.” - WC


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 02, 2009 1:52 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10441
Location: Beyond the pale...
Thanks flaith - well spotted! :)

Updated version uploaded.

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 02, 2009 4:51 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sat Apr 26, 2003 1:11 am
Posts: 1386
well written, hands up !

_________________
SPAMINATOR NR.1


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 02, 2009 10:37 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Apr 25, 2005 9:28 pm
Posts: 700
Location: $300:20 58 FC 60 - Vietnam
Now I've got no excuses to make program in OOPB :D

_________________
“Fear is a reaction. Courage is a decision.” - WC


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Feb 03, 2009 2:26 am 
Online
Addict
Addict
User avatar

Joined: Fri Sep 21, 2007 5:52 am
Posts: 3316
Location: New Zealand
Very nice Srod, that deserves a beer!


Top
 Profile  
Reply with quote  
 Post subject: Re: OOP tutorial added to the nxSoftware site!
PostPosted: Tue Feb 03, 2009 3:56 am 
Offline
PureBasic Protozoa
PureBasic Protozoa
User avatar

Joined: Fri Apr 25, 2003 3:08 pm
Posts: 4239
Location: Not Sydney!!! (Bad water, no goats)
Quote:
Gone are the days of leaping head first into an application only to code myself around the equivalent of a u-bend to then have fangbeast come along and flush the toilet!


I would flush it but your head is still stuck firmly down the s-bend!!! Were you fishing for you steaming g-strings again??? :evil: :evil: :twisted: :twisted: :D :D :D :D :D :D :D

_________________
Amateur Radio, D-STAR/VK3HAF


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Feb 03, 2009 12:32 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Dec 18, 2008 3:35 pm
Posts: 228
Location: Wales, UK
Thanks ;)

Helped me alot to get my head around it all.

Good job :P

_________________
----------------------------------------------------------------------------
Commenting your own code is admitting you don't understand it.
----------------------------------------------------------------------------


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Feb 06, 2009 6:55 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Apr 25, 2003 8:57 pm
Posts: 329
So a Pure Object Oriented Program would be called "POOP"!

;)

Russell

_________________
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Feb 06, 2009 7:27 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10441
Location: Beyond the pale...
Amiga5k wrote:
So a Pure Object Oriented Program would be called "POOP"!

;)

Russell


Now that one is older than I am!!! :)

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye