Borrowing from Object Oriented systems

Everything else that doesn't fall into one of the other PB categories.
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Borrowing from Object Oriented systems

Post by BorisTheOld »

AndrewM wrote:@BorisTheOld. What exactly does the example code in your recent post do?
This sample program demonstrates the use of macros, OOP, custom controls, and automatic resizing....
If you actually look at the code, and perhaps even execute it, you might find some answers to your questions about writing OOP-style programs with PB.

NOTE: This code will not work correctly with Windows when using PB 5.21 LTS. In certain situations, the Canvas "focus" events are not being created by PB.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Borrowing from Object Oriented systems

Post by USCode »

@BorisTheOld

What software products do you develop? Got a website?
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Borrowing from Object Oriented systems

Post by BorisTheOld »

USCode wrote:What software products do you develop? Got a website?
Custom programming. No website.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Borrowing from Object Oriented systems

Post by USCode »

BorisTheOld wrote:
USCode wrote:What software products do you develop? Got a website?
Custom programming. No website.
Ah, gotcha, thanks. I only asked because you mentioned here "applications" and "production code" and I assumed it was a product you were marketing:
http://www.purebasic.fr/english/viewtop ... 00#p418103

Do you find your customers are ever hesitant with you using PureBasic for projects?
What made you choose PureBasic to convert your code over to vs. others such as XOJO (REALBasic), etc.?
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Borrowing from Object Oriented systems

Post by BorisTheOld »

USCode wrote:I only asked because you mentioned here "applications" and "production code" and I assumed it was a product you were marketing
I was just refering to our in-house code generators, and the like.
USCode wrote:Do you find your customers are ever hesitant with you using PureBasic for projects?
What made you choose PureBasic to convert your code over to vs. others such as XOJO (REALBasic), etc.?
I don't give them a choice. Our customers, who tend not to be programmers, are more concerned about whether stuff works than what it's made of. We've done work in COBOL, PL/I, Assembler, VB, PowerBasic, and now PB.

Our main language for the past few years has been PowerBasic, but I wanted to move into Linux. However, PowerBasic needs to run under Wine with Linux, and the results are not very inspiring. About six years ago I ran some trials with RealBasic, but it was too big and too buggy. I like using languages that have many features, but which can be pushed beyond their normal limits. So although PB is missing some of the standard BASIC features, it has the ability to work with many different libraries, on three platforms. Plus it can access dynamic libraries created by other languages. PB is flexible enough that we can write our own versions of BASIC features, such as the Format statement and the Currency data type. The example I linked to above, shows the kind of stuff we're doing.

PB must have something going for it if, after 50 years of programming, I choose to work with it rather than anything else. :D
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Borrowing from Object Oriented systems

Post by USCode »

BorisTheOld wrote:... I don't give them a choice. Our customers, who tend not to be programmers, are more concerned about whether stuff works than what it's made of. We've done work in COBOL, PL/I, Assembler, VB, PowerBasic, and now PB.

Our main language for the past few years has been PowerBasic, but I wanted to move into Linux. However, PowerBasic needs to run under Wine with Linux, and the results are not very inspiring. About six years ago I ran some trials with RealBasic, but it was too big and too buggy. I like using languages that have many features, but which can be pushed beyond their normal limits. So although PB is missing some of the standard BASIC features, it has the ability to work with many different libraries, on three platforms. Plus it can access dynamic libraries created by other languages. PB is flexible enough that we can write our own versions of BASIC features, such as the Format statement and the Currency data type. The example I linked to above, shows the kind of stuff we're doing.

PB must have something going for it if, after 50 years of programming, I choose to work with it rather than anything else. :D
I evaluated REALBasic several years ago as well and came to the same conclusions: too buggy and a fat runtime.
Why not C++? Too much hassle? :wink:
What standard BASIC features have you found PB to be missing?
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Borrowing from Object Oriented systems

Post by BorisTheOld »

USCode wrote:Why not C++? Too much hassle? :wink:
What standard BASIC features have you found PB to be missing?
"C"-anything is too much hassle. In the 1960s I cut my teeth on languages like Assembler, APL, FORTRAN, ALGOL, COBOL, PL/I, and the original Dartmouth time-shared BASIC. I could never quite get my head around why people would want to program in a "toy" language.

As for what's missing in PB: a full set of signed and unsigned data types, from 8 bit to 64 bit, including Currency; OLE strings; Format functions for all data types, not just date; ByRef support for all data types; a Mid statement; etc. In other words, the core features that most modern BASICs have.

This isn't a big problem though. We just code our own versions, where necessary, to fill the gaps.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Borrowing from Object Oriented systems

Post by USCode »

BorisTheOld wrote: As for what's missing in PB: a full set of signed and unsigned data types, from 8 bit to 64 bit, including Currency; OLE strings; Format functions for all data types, not just date; ByRef support for all data types; a Mid statement; etc. In other words, the core features that most modern BASICs have.

This isn't a big problem though. We just code our own versions, where necessary, to fill the gaps.
Formal Pass by Reference support is definitely something I too would like to see.
Is this the type of Mid statement you are referring to, or something else?
http://www.purebasic.com/documentation/string/mid.html
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Borrowing from Object Oriented systems

Post by IdeasVacuum »

I don't give them a choice.
Exactly my approach. Only ever discuss the requirements of the software, that is what is important. If I buy some furniture, I never ask the supplier what make of tools he used..... OK, there are occasions when I use C/C++ because at the end of the project, the customer assumes ownership of the code and they want it in the same language as their other stuff, which is fair enough. I also do work for a CAD system that is coded in C/C++ and it is less hassle to work with the API in the same language.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Demivec
Addict
Addict
Posts: 4283
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Borrowing from Object Oriented systems

Post by Demivec »

USCode wrote:Is this the type of Mid statement you are referring to, or something else?
http://www.purebasic.com/documentation/string/mid.html
I think he is referring to this.
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Borrowing from Object Oriented systems

Post by BorisTheOld »

Demivec wrote:
USCode wrote:Is this the type of Mid statement you are referring to, or something else?
http://www.purebasic.com/documentation/string/mid.html
I think he is referring to this.
Correct.

The Mid statement is needed just as much as the Mid function. And it's quite a different animal from ReplaceString.

The following link explains how we get around the problem using macros.
http://www.purebasic.fr/english/viewtop ... 40&t=57197

So instead of coding:

Code: Select all

Mid(String1, Position, Length) = String2
we would use:

Code: Select all

MidSet(String1, Position, Length, String2)
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
USCode
Addict
Addict
Posts: 924
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle

Re: Borrowing from Object Oriented systems

Post by USCode »

IdeasVacuum wrote:... If I buy some furniture, I never ask the supplier what make of tools he used...
No, but you do ask what KIND of wood is used in the furniture ... e.g. Balsa vs Oak ... :wink:
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Borrowing from Object Oriented systems

Post by Danilo »

@AndrewM:
Just found this by accident in Apple's developer docs: Object-Oriented Programming
(part of Object-Oriented Programming with Objective-C)

I think this article explains it very well to people that don't know what OOP is good for.
User avatar
AndrewM
User
User
Posts: 39
Joined: Wed Nov 06, 2013 3:55 am
Location: Australia

Re: Borrowing from Object Oriented systems

Post by AndrewM »

Thanks Danilo,

It is a big article and I will mull it over for a few days.
Post Reply