Does Purebasic have an equivalent to the "CHAIN" statement

Just starting out? Need help? Post your questions and find answers here.
Mahan
User
User
Posts: 35
Joined: Sun Jan 25, 2009 10:12 am
Location: Sweden

Re: Does Purebasic have an equivalent to the "CHAIN" statement

Post by Mahan »

What I think about when you mention the main-menu and then chaining in other program parts while still having some (global?) variables accessible is very similar to schemes I've used while back in the 80s and early 90s.

The general idea to modularize the code is very good, but you might need to review the reasons why you would like to modularize: If the applications you intend to write are quite huge you might want to do this because of 1) compiling speed (if the application is incredibly huge) or 2) just to "keep things in boxes they belong". 3) Other?

If you want to do this because of compiling speed you can use DLL's and/or COM to achieve it, but the learning curve is a bit steep. You need to know several "C-like" things like function-pointers (see the prototype keyword in pb) and/or understand COM-interfaces etc.

If you just want to "keep things in boxes they belong" you could either (easy solution:) develop a standard consisting of naming-conventions and rules for when and how you declare (and name) global variables and how you split code into several source-files. This might work good for small to medium systems written in pb.

(harder solution:) However if you are writing really huge serious systems, I'd really encourage you to take a look at OOP (Object Oriented Programming). Once again you got quite a steep learning curve to become good at OOP but once you grock it you'll be able to write entire enterprise applications with just a handful of globals (if any). OOP is all about boxing all code (and data) into nice named boxes (called classes) that describe certain entities or flows. Since pb is a procedural language you got no OOP support in it. (some people might say you can do OOP in pb, and I agree you can but there is no native support for it as in a real OOP language, that's just a fact.)

If you are interested in OOP but still want fairly easy programming (as in basic-like), I'd recommend you take a look at Microsoft Visual Basic for .NET (express editions are even free). The .NET part also provides a very elegant solution to the compiling times, as you only need to re-compile the source-files you've been editing, all the others are ready since the last compilation and can be executed as they are. (actually I'd really recommend Java/C# but since you said you disliked C you'll not like them very much, I deem.)

Note1: I like pb a lot and advocate it for all the tasks that are perfect for it - generally quite small to medium applications that you want to write fast and easy. I don't however recommend pb for writing huge applications, because of the lack of OOP and serious namespace-compartmentalization support.

Note2: With "small to medium applications" i mean < 500k lines. With "huge applications" i mean 500k ~ 1000k lines. With "incredibly huge applications" i mean 1000k lines (+). I've been lead developer in "huge applications" and I've participated in developing "incredibly huge applications" and I cannot overemphasize the importance to keep code clean and "boxed" if you want to keep code manageable and extendable at such sizes.

Note3: This are my opinions. i.e. feel free to disagree with me, but don't start flame wars over this ;-)
nigel
User
User
Posts: 62
Joined: Tue Feb 23, 2010 8:39 pm
Location: Canada

Re: Does Purebasic have an equivalent to the "CHAIN" statement

Post by nigel »

Guys

I am NOT looking to pass information from one program to another, I am NOT trying to enable any interprocess communications.
This thread seems to be taking on a life and direction all of its own.
infratec
Always Here
Always Here
Posts: 7582
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Does Purebasic have an equivalent to the "CHAIN" statement

Post by infratec »

Hi Nigel,

but....

the reason are you.

Sinnce you only told us you want to know how the CHAIN command can be implemented in PB.
And you not told us, that you only want to start an external program without sharing variables.

So please be more detailed in your next questions.

Best regards,

Bernd
nigel
User
User
Posts: 62
Joined: Tue Feb 23, 2010 8:39 pm
Location: Canada

Re: Does Purebasic have an equivalent to the "CHAIN" statement

Post by nigel »

Mahan

Thanks for your comments, and don't worry I have no intention of starting any flame wars with people on this forum. Purebasic users appear to me as genuine helpful individuals more than willing to provide assistance and wisdom to people like myself who are new entrants to the world of GUI applications development based upon the client-server model. I appreciate your input.

infratec

I have never used a dialect of BASIC where the CHAIN statement included any functionality for passing data or variables between programs. One of the commenters mentioned doing this with a "BUSINESS BASIC" dialect he had used and was curious if this was relevant to my question. As I have never seen a CHAIN statement which facilitates interprocess communication, you may understand why I would fail to mention this.

I always used the COMMON statement for passing data between programs and this is unrelated to the CHAIN statement. I will not need to deploy an equivalent to the COMMON statement in the Purebasic GUI programming environment.

Notwithstanding the above explanation, I would not wish to discourage comments which add further insights volunteered by others.

Thanks
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Does Purebasic have an equivalent to the "CHAIN" statement

Post by ts-soft »

nigel wrote: I have never used a dialect of BASIC where the CHAIN statement included any functionality for passing data or variables between programs.
But this is exactly that what does CHAIN into most languages!
Your Question is not clear on this, if you mean a CHAIN in a special language.

Greetings
Thomas
Mahan
User
User
Posts: 35
Joined: Sun Jan 25, 2009 10:12 am
Location: Sweden

Re: Does Purebasic have an equivalent to the "CHAIN" statement

Post by Mahan »

[...]the world of GUI applications development based upon the client-server model.
Just a comment on this: C/S-model is starting to get a bit dated now. This technique was popular around 95-00 IIRC. I'm actually in the process of modernizing a C/S business application to become more n-tier based.

If you are interested in the subject of getting a bit "up to date" in todays information technology, I'd really recommend you to google a bit and check out "n-tier" and "mvc" (as an example. there are several other similar design-patterns too.)

The C/S way of doing things was mostly abandoned due to: 1) business logic and presentation logic was often intermixed. 2) Sometimes led to high bandwidth requirements between Client and Server 3) Since client was often "thick" (i.e. most of the app-code ran there) you needed CPU-muscles on the clients. (compare with todays Web2.0 apps where the client is not used for any processing at all, so you can run the app on a iPhone with similar speeds as on a workstation.)

edit: spelling
Post Reply