WWDC2004 Session 636
Transcript
Kind: captions
Language: en
ladies and gentlemen and welcome to
session 636
if you would please to turn off all cell
phones and to remind you once again if
you would please no recording or taking
pictures during this session and with
that said please welcome now Tyler stone
[Applause]
thank you good morning it's friday the
last day of the conference I hope it's
been going well for all of you we've had
a very good conference I think this year
as Apple has started returning to the
enterprise we find ourselves
encountering more and more customers
developers out there with visual basic
applications and they've been asking us
for a migration path how can they port
their visual basic projects over to Mac
OS 10 so this session has been designed
with that in mind I'd like to introduce
Hank Marquis from slave fire software
he's going to talk to you a little bit
about how to port visual basic projects
to Mac OS 10 thank you morning everybody
I know everyone was up late last night
was every bit up late last night yeah
this is a resounding audience do your
arms work do they move okay so you're
still functional my name is Hank marquee
is Tyler said I'm going to talk about
moving applications to Mac os10 how many
people in here have ever seen visual
basic good how many people here have
seen indoor use real basic good so this
you're probably in that you're probably
in the right place first I want to talk
a little bit about what we're going to
do the idea is that you're a developer
and as Tyler said you have an
application written in visual basic and
for one reason or the other you want to
move that over 20 s 10 or perhaps even
Linux it's there's there's a number of
different operating systems obviously OS
tennis is the one that we're here to
talk about today what I'm going to talk
about is a process you can follow to
move your applications over and actually
have it work at the end you're sitting
here and you say I have visual first of
all what version how many people are
using visual basic five or six not so
not many
how many people are using net feel like
net I got to see a lot of this going on
well if you're not familiar with how
what Microsoft did there with visual
basic five and six and all the way back
I've been involved in visual basic since
it was vb dots which was actually a
professional development system and
quick basic and things like that so back
in 91 I got involved with with visual
basic and every single version of visual
basic up until dotnet could open the
previous visual basic source code and
just compile it executed and run no
problem and dinette was the first time
where you couldn't do that anymore so if
you're sitting here with a visual basic
application and you're thinking to
yourself you need to move it forward and
you think about net you have pain you're
going to have to go through a conversion
the language is different things don't
exactly work the same and at the end of
it it runs on Windows and what we're
going to talk about here is the way if
you're looking at that decision to be
able to say well why would I do that
when I can go through a much easier
process with a language which is much
more similar to visual basic and at the
end of it I can have something that
works under windows of course but as
well more importantly other areas like
OS 10 and others and so that's we're
going to talk about how to make that
happen I've been developing for a really
long time my mother was a systems
analyst for IBM she was in the mainframe
programmer back in the 60s 1969 is the
first time i saw a mainframe and i went
with my mom to do key punch so i know a
basic assembly language was in fact i
started off as an assembly language
programmer and by the time i was in like
eighth grade I knew Fortran and stuff so
I've been programming for a really long
time and i'm going to use real-world
examples and experiences so i'm not a
marketing person who has got the latest
words du jour i'm actually going to talk
about the real world and real things
that you're really going to you're
really going to you're really going to
hook up with so what i'm going to do is
tell you how to port your application to
OS 10 and i'm going to tell you how not
to port it and if you actually follow
this process you will be successful and
then again if you're if you're someone
who doesn't want to be successful for
whatever you're vested interest is and
you could just do the opposite of this
and then it will never port and there's
actually a pretty funny book out there
that tells how to do stuff like that so
at the end of the day I want to save you
time pain in my
so who am i as I said I've been around
for a while I've written a couple of
books they've published lots and lots
and lots of articles and I was involved
in the component vendor consortium I
don't know if you know about that but
it's a it's a third-party organization
that analyzes components and give them
sort of like an underwriters laboratory
of approval I was the chairman of the
Quality committee and did the the
initial quality screening program if you
will founded a number of software
companies most recently the one I had
founded was a with a company called new
mega technologies was done acquired by
compuware and written other projects and
I'm currently now completely involved in
the OS 10 world with the product real
basic and we have a suite of
productivity tools for real basic that
are all about debugging so I almost know
what I'm talking about when it comes to
actually doing this and making it work
so there's some assumptions one of them
is that you have visual basic
applications and we saw by the raise of
hands that you did and the other is that
you actually want to port them over to
OS 10 and you said that you did
hopefully you know something about
visual basic and real basic 5.5 and for
those that might not be fully aware of
real basic real basic is a modern
object-oriented language it runs under
OS 10 or a variety of Mac OS really
windows a variety of windows and you can
compile for OS 10 windows and linux and
I don't think I'm letting it out of the
bag to say that the next version will
run on Linux as well probably maybe I
don't know the guy's a real basic will
tell me the guys nodding so I guess I
won't be shot at the end of this and you
can all continue to live so so then
you're going to have this complete
complete capability to move back and
forth it's very very similar to visual
basic but there are some differences as
well so I was going to tell you the top
10 things like everyone likes top 10
lists and then I decided to throw in an
extra one so the things that we're going
to so you get 11 c11 for the price of 10
you come for the price of none so what
are the big things we're going to talk
about well language keywords the things
that you use every day to do things in
the language how you put them together
into syntax the data type
how we structure data and work with it
the structure of the language itself
user interface obviously it's going to
be a big thing and one of the biggest
challenges to having a portable
application it is the user interface the
structure of the projects physically how
are these things composed platform api's
how many people in here is use Visual
Basic that use windows API calls in it
right okay so right away you got a
little bit of a learning curve you've
got to go figure if you have to say how
am I going to deal with that Windows API
call on another platform so am I going
to just do a one-off build that only
works here but if i want to go to OS 10
then i have to find an equivalent one or
in some cases you'd be surprised how
much you can do staying within the
constraints we were able to build all of
our slave fire products without using a
single API call and they run on all
three platforms so if you use some
rethinking needs to be done but a lot of
times you can do it in real basics
pretty powerful usability things you
want to do to make your application
actually usable and Mac users have an
expectation that Windows users don't so
if you're moving a Windows visual basic
application to OS 10 there's there's
some things that you're going to have to
deal with platform guidelines tools
structure lots of cool things let's just
jump right into it there are a whole lot
of words that work exactly the same the
learning curve from Visual Basic the
real basic is I don't know if you're a
vb developer in your good 20 minutes if
you're new to well not a couple hours in
all cases it's going to look really
familiar right out of the box things
like left right ask Easter these all
work exactly the way you think they
would and they should by the way this
presentation actually has code in it
positive feedback thank you thank you
there are however just a few differences
here and there that you will figure out
one way or the other one of the ways is
by paying attention to this and uses
some of the tools real basic offers and
the other way is to beat your head on it
for a little while until you figure it
out on your own that's what I did
because I'm thick-headed but for example
the keyword mid works just like you'd
expect it to work except in visual basic
mid can be used to drop it insert into a
string at a point and in the in the in
the real basic implementation currently
today it does not now to real basics
credit as they're moving forward with
this visual basic migration story in
fact I've been able to have input to the
product and they're really great about
soliciting input so things like that get
get resolved so these little Sidious
incra seas are slowly being removed from
the language one of the big things that
maybe be great and evil at the same time
was the whole dynamic nature of it hey I
can make a variable right now right if I
don't have option explicit on I can just
I can just make a variable whenever I
want dynamic casting dynamic creation
and that's actually not a good thing I'm
sure someone in here would say no it's a
great thing because I'm you know i can
write good code and so on and so forth
and I can handle that but at the end of
the day it's not really good to have
variables that aren't declared you know
you're not going to last forever some
you know someone somewhere someday is
going to look at your code and go well
what am i doing with this so real basic
is much more modern in that regard with
regard to object orientation and making
you be explicit than visual basic is so
we're going to see that how you can use
that real basic is a very rich language
graphically as you can imagine from its
heritage as an OS 10 or a mac OS
application visual basic you know
graphic wise just you know this isn't
there it's funny a funny thing a visual
basic application by default can't even
pick up the windows XP themes on its own
so like your vbx look like Windows 3 dot
1 apps when you run them on XP though
it's just that graphically it's not very
cool but real basic is really
graphically rich and there's lots of
games and things like that that are
probably right around
here right now that are all written they
have 2d and 3d rendering graphics
engines built into the language so
there's a lot of things you can do there
what that means is that some of the
words that are for example keywords in
visual basic are not available anymore
so like the string keyword well there's
a string class in real basic and so on
so you're using the string keyword and
visual basic that's not just going to
pour it right over you're going to have
to do a different thing to make that
work so there's some of those things you
have to deal with so there's words
there's keywords that are exactly the
same there's keywords that are exactly
the same only they do things slightly
differently and then there's keywords
that are completely different visual
basic has space and int those two things
don't exist in real basic so you say
well gee how do I make a how do i make a
padded string five characters long well
for i equals 1 to 5 x equals x plus g HR
32 right next so that's how you do that
so you might have to go make yourself a
little module but someone's the good
news is that's already been done for you
for example the space key word is
there's a module of visual basic things
that are not in real basic you could
just plug in and use on the other hand
visual basic has some cool things that
we always have to write and I mean if
you've written in visual basic for any
amount of time you've got dozens of
classes of reusable stuff that you just
drag and you keep using over and over
again a lot of that can go away because
uh because real basic has a lot of
keywords at visual basic doesn't and
then there's these sort of maddening
little differences who knows who's right
it doesn't matter who's right but real
basic called it uppercase and visual
basic calls it you case so you may say
that's not so bad I can just go through
my vb code to a global edit replace you
case with uppercase and i'm happy like
or i could import it into real basic and
do a global UK's to uppercase so you can
deal with it but something you have to
deal with so at the end of the day
you're sitting you're looking at a
development path and you say can I do
this I think the answer is yes similar
keywords it's similar but you know rtm
everyone know what that acronym stands
for it no you don't know someone else
read the manual right if you're going to
pour I suggest you drop a dime in a
couple of dimes and buy a book or two
and I haven't published a book in real
basic so I'm not pushing my own book but
there are other books in the real basic
documentation itself read it become one
with it understand what the language
does so that you know all I remember
reading about that and you can move on
so a lot of times because you're just
like me i mean i get a piece of software
i get the box i never even open it i
downloaded i install it and I'm just
like brute force I'm going to make this
thing do what I want because that's how
I am but in this case you know like my
dad used to say when all else fails read
the directions you know and then my dad
would watch me do something I'd be
beating my head my dad is a hardware guy
my mother was a software go and so I do
something all along my dad would watch
me and then at the end it wouldn't work
he go you know I probably wouldn't have
done it that way so now that I'm getting
you know towards middle age I you know
I'm starting to realize she may be yeah
I maybe I should have you know not when
all those girls read the directions
maybe I ought to read the directions up
front especially if I have to do it so
you can read as well as I can on the
rest of them code syntax next big area
these are the kind of things that will
drive you batty but they're the things
you need to know about in this case for
example this is a real subtle kind of a
bug by the way you can just drag and
drop code from visual basic into real
basic real basic can open modules and
just load the code right up and show it
in its editor and it actually looks
pretty cool but here's an example of
something that would it would terrorize
you and and it's only because you were
sloppy on the vb side now remember
visual basic and i was one of those guys
who the long time ago and visual basic
first came out people are like well you
can't do that only you know there's only
good for prototyping you eyes and you
can't write a real program and I was
like yeah watch this i crack my knuckles
and I do something that couldn't be done
in vb you know like a file on a race
program that did direct dis manipulation
to be able to recover deleted files and
people like we can only do that in
assembler or c and like oh yeah check
this out so so yeah there's you can be
sloppy in visual basic or you cannot be
sloppy but visual basic is forgiving
that was one of the things about it so
that means it's easy to be sloppy so
let's say for example like this in this
example here you've got visual basic
code on top and you've got a definite a
true Z and that means that for every
variable declared in the rest of this
code module if I don't explicitly
declare it to be a data type the
variable will default to integer because
that's my default integer so anything
that starts with a through z that's a
variable that isn't explicitly cast
default to an integer that's all well
and dandy because on the second line of
the first line of that form load up
there I have dim x comma y as string now
you might look at that because you know
vb and go well sure x is an integer and
why is a strength now load that code
into real basic and go dim and by the
way real basic doesn't allow you to do
module level global declarations like
everything that starts with a through z
is a particular datatype so it looks at
X comma Y as string and it says oh well
they're both strings you want XYZ as
string okay so I just kind of get you a
little bit so all the sudden the code
that works fine up on top you know a
message box why you're going to get a
type mismatch error you know because X
is no longer integer X is a string now
and you can't assign a numeric value to
a string so the moral of the story here
is that you should begin to become as
explicit with your visual basic code as
you can and by that I mean you're going
to want to clean it up and that's kind
of the the moral of how to do how to
port start by cleaning up your vb code
we all know what good programming
practice is just not for me good yeah we
all know what the right thing to do is
and you need to go back and do those
things to your visual basic programs now
there are a few places where the syntax
of the words are different we're into
the syntax now in visual basic if you
want to count down for i equals 1 to 10
a 10 to 1 step minus 1 it works
backwards right it's intuitive except in
real basic you don't do it like that you
say for i equals 10 down to one there's
no step minus one in real basic so
you're gonna have to do a little bit of
you know in fact you can actually you
know you can actually
we have that code in there the ten to
one step minus one the loop just never
gets executed it skipped right over it
because I is already one or less than
one when it starts so that's an example
of something that needs to be fixed
here's another example logic now in.net
they did a very similar thing to what
real basic did so the folks in visual
basic for the longest time or and xor
not these are both functions and +
operators you know i can say a or b c
equals a or b and it does the bit
manipulations and in fact a whole lot of
api code that you write for windows uses
that kind of end not in or functionality
to do bit manipulation Wow it doesn't
work that way in real basic real basic
actually has true bit manipulation so
you're going to have to recode those
things and use the bitwise class I mean
it still has or and not for for logical
partitions for example a or b if a or b
then but you can't say you can't use a
or b for example to set flags to pass to
another call one example so the
difference is don't make too much of a
burden what was the main thing for you
to understand the difference is that i
talked about if you could just say it
rtm are damn you guys are looking at me
know what's going to say it all right Oh
Artie I'm good thanks right very good
yeah read the manual and begin to clean
up your basic code get rid of all your
death whatever's and turn on option
explicit you've got a nightmare ahead of
you come on not a nightmare but you have
you know at least a couple hours of f5
splash okay f5 splash f5 is how you
start a BB program in the IDE and it'll
it'll like start to compile and go and
then you'll have to oh yeah that's right
X dim x as integer or dim why I string
so you're going to want to go through
and do that you want to get rid of your
dynamic typecast this is the dollar the
pound the ! the ampersand at
the end of a variable name real basic
doesn't allow you to indicate what a
variable is by having a control
character at the end of it so you can't
have like X dollar in real basic you
could have X as a string which is what
it is in visual basic but you can't have
the dollar at the end of it the dollar
signs you want to remove all that look
for loops look for those four loops I
talked about just remember mark them
that you're going to have to deal with
them so that's not so bad let's talk
about data types there's a whole bunch
of data types in real basics that don't
exist in visual basic visual basic
actually has a pretty limited now you
know you could think it's rich but I
think real basic has a much richer set
and it also has ND an awareness that
visual basic doesn't have because
remember if you starts going across
different platforms all the sudden the
order of bits and bytes stored on disk
aren't the same anymore so you have to
be able to say well is this thing read
from left to right or is it read from
right to left visual basic has the
concept of a user-defined type and I've
actually been interacting with real
basic to to to talk about maybe getting
that into the real basic language
because there are no user-defined types
per se in real basic what you do have in
real basic is this concept of a memory
block which is where you can allocate a
chunk of memory and you can read any bit
of it as any collection of anything that
you want I can read the first four bits
the first eight bits the first 16 the
first 32 sort of at my leisure and I can
do whatever I want so I can achieve the
same result as I do with a static
user-defined type with a dynamic memory
block and I actually wrote a class that
allowed me to because I kind of like
being able to have the logic of of
something that's you know having a type
with a name like type dot name so i
actually created a class that kind of
gives that same functionality let you
create user-defined types and add in
excess their excess their members
logically by name and so if you want you
can email me or you can contact us
somehow there's email addresses around i
could i can email that to you
realbasic is object oriented and it
really is object oriented like seriously
object oriented in its classified so not
not like for security but you know like
if it's a boolean then it's either true
or false and those are the types of
values that it can have so if i was in
visual basic i could say and how many
people have done this i could dim
something as a boolean and then i can
say if the bullying equals zero then
beep well that'll work because everyone
in visual basic knows that zero is false
and minus one is true that's that's what
visual basic things well unfortunately
that's not actually technically right
and in real basic faults does not equal
zero and true does not equal negative
one and true doesn't equal one either
true is true true is a state and there's
an actual keyword operator called true
in one called faults so you want to go
clean up your code you're going to say
everywhere I have bullion's and I say if
this equals one or this equals zero or a
boolean is greater than or less than
zero or something like that I want to go
back and make it use true and false so
by cleaning that up ahead of time you
you're going to wind up a lot easier so
here's an example of the real basic IDE
with the variety of things you can do
with the memory block which is a whole
lot of different values so you can do a
lot so conclusion one of the big things
that kind of got me going a little bit
was that in visual basic there's a
concept of an integer and a long integer
16 bits long 32-bit well that's true
maybe for the wind tell platform but
it's not always true on other platforms
so in the case of real basic an integer
is the only kind of integer they have
and it's 32 bits there's no currency
type but again we can we can emulate one
of those pretty easily and you can also
create your own data types the bottom
line is you've got to use memory box
instead of UDTs it's easy there's a
class it's already been done and so
that's that's it so then as we move into
say for example language structure now
we've gone through the keywords and
we've gone through the data types and
those are kind of the constructs now
let's see how we put them together to do
something for example file i/o or air
handling or object instantiation and
things like that
here's some code that shows how you
would open a file and real basic and how
you would open it in visual basic just a
little bit different visual basic
brought forth the quick basic concept
that you open something in the context
of file i/o you open a file you open a
channel to the file or you open a port
for example real basic is a little more
object-oriented it has this sort of
folder child relationship concept and
that makes a lot of sense because not
everybody has the same kind of
organizational structure that you find
under windows so so the real basic way
is a cross-platform way and the
Microsoft way is the Microsoft way so
there's a little bit of work that needs
to be done for your file i/o and things
like that it's not that hard and I hope
you're not getting depressed at all
because I'm going to talk in a minute
about a tool that's available from real
basic that does most of this stuff for
you called the BB project converter
anyone here ever used that a couple
people yeah it's a pretty cool little
toy it'll do a good job tool it'll do a
good job for you so as we start looking
at the language structure here we can
see for example how the structures of
the methods and functions and events are
put together real basic supports message
functions and events just like visual
basic does a little bit of difference
here in there in real basic to exit
something you would say exit function
exit sub I'm sorry in visual basic you
say exit function exit sub in real basic
you just say exit or return it is the
way to do that and the other interesting
thing is that in visual basic if I have
a function and it returns the integer I
would say the name like the function
would be called function 7 i would say
function 7 equals the result of my
function and that would be the return
value in real basic you say return
whatever the value you want to return is
so you don't assign the value of the
function to a function named you
actually say return that value so that's
a little a little bit of a difference
but not that great but you can still do
things like create properties with asset
and a get method if you will and it
works
it works fine and I've had no problems
you know taking classes from visual
basic and moving them over with a little
a little King the same thing with events
most of the ways you raise event are
going to be similar here's an example in
visual basic and to do the same thing in
real basic not not that not that
different they both support by ref and
byval but there is a little bit of
difference in the declaration of events
and it will take you a little time to
sort that out but you know start small
and you'll be able to do it so with
regard to constructs there are no
enumerations in real basic and I know a
lot of folks people here use enums and
your visual basic programs anybody only
one or two ah and you don't worry about
it but if you use them you like them and
I've been lobbying real basic to put
them in there and you know one of the
lead development people from real basic
is here so we can gang up on them and
lobbying they all offer constants one of
the nicest thing yeah the quartus is
like new so one of the coolest things
about real basic that I like is this
whole cross-platform thing I can create
a constant and then I can have that
constant have a different value based on
the platform that the program runs on
visual basic has no concept of that at
all and you find these kind of things in
real basic all the time just when you
think about something as a
cross-platform tool and not a Windows
specific tool some of these other really
interesting things show up and have
found their way into the language that
orders are pretty awesome and they're
really good so constants are going to
work and you have even more capability
with conference like for example you
could do localization with your
constants as well not only can you say
what platform it is but what language it
is and that's all sort of built into the
language editor the UDTs are going to be
you know something that will throw you
for a loop initially but I already fixed
that it's already solved email me and
I'll be happy to send you a real basic
class that let you do the equivalent of
user-defined types no extra charge one
of the differences in air handling that
realbasic haves versus visual basic is
visual basic has this really arcane
thing that came at a G
w basic which is like millions of years
old for those who remember it which is
the whole on error goto syntax and they
still use that by the way well real
basic doesn't use the on error goto
thing you can declare an exception in an
exception handler or you can use try
catch and yet your choice which ones you
want to use there are no line numbers
supportive and real basic and i have
used line numbers traditionally use line
numbers for debugging purposes so you
can sort of get an output of where you
are and what's going on but there are no
line numbers and the interesting thing
is they both use raise to raise an error
you can create and raise custom errors
so your air handling subsystem is in
fact most people let's face it most I'm
just going to go out on the limb okay no
one in this room but other developers
you know who use Visual Basic don't use
air handlers right yeah and one of the
really nice things about real basic is
that in the application open in the
application object every real basic
application has a top-level application
object and there's an error handler in
there that you can turn on so that if
any of your other code does it have an
error handler it'll chain back to that
one so you can just write one error
handler and have a graceful dump it
sounds like an oxymoron right graceful
dump that that's a lot better than it
just splat so at least you know is so
there's there's some really good things
about the air handling and real basic
that make it worthwhile one thing that's
a little interesting to get used to is
the whole dim new as new concept that
real basic has versus visual basic the
words are similar but not exactly the
same it all has to do with object
instantiation and in some cases you
condemn something and then try to use it
it'll it'll it'll splat because you
didn't say new set equal the new thing
so the the object instantiation is
slightly different but once you
understand it it becomes second nature
it's and it's not that that difficult
there's no set statement in real basic
there's a new visual basic uses nothing
and real basic uses nil and there's no
let statement in real basic at all so I
don't know most people don't use letting
that's like old-school let a equal
one you know I don't think too many
people do that anymore so in conclusion
you're going to do some work you're
going to do some work if you move to.net
I'm going to do some work if you move to
real basic at the end of net you have
this thing that runs on windows if you
go to real basic you have this thing
that runs on Windows OS 10 linux and
it's my belief that that's probably a
better way to go so at the end of the
day the good news is it's not that hard
I personally found it easier than trying
to do net there's enough things to make
it possible and your best bet is to get
the manual read it play with real basic
first get a feel for it learn every
language as its own little
idiosyncrasies it'll take you a little
while to get away from the visual basic
dropdowns with the procedure names in it
to having a list of them on the side so
just play with it get the hang of it and
then you'll be able to move on user
interface well you know suffice it to
say anything that was designed and built
around the Mac has a user interface that
knocks the socks off of anything that
came out of windows I you know I'm an
IBM guy you know from my mom you know
for millions of years but I just got to
admit it you know it's um it's just it's
heads and tails above it you know real
basic has two-dimensional and
three-dimensional rendering engines
built into the language and it's just
you can do some amazing things one of
the other things I find amazing is again
that cross-platform mentality made it so
that if I write a program you don't even
take Oh take take a vb program and make
it so it runs under windows and i
compile it on windows 2000 it's got that
windows 2000 look you know that like
three dot window three dot one look that
well if i take that and go run it on
windows XP it just picks up themes and
it looks like it's a native XP app so as
far as real basic is concerned there are
different platforms and it does the
appropriate thing and it does that for
Mac as well does the same thing for
linux i wrote a class that will take my
application interface and size buttons
and move things around based on where it
runs so not only does it have the
graphical look and color scheme and
borders and so on but the actual button
size and position themselves
appropriately because when i get back to
like mac users have the
expectation that buttons have different
titles and they're in different
locations and and you know windows likes
to do the whole abort retry you know
hang yourself thing which you know you
don't do in the macworld and things like
that so anyway user interface is mostly
the same except it's a lot richer vb has
a thing called a picture box the
equivalent thing in real basic is
probably a pitcher well or canvas canvas
has a lot more flexibility as the thing
you can sub class and make your own
thing control the picture well just hold
the picture both support by the way your
active x components will move to windows
if you use real basic but activex
doesn't exist in macs and therefore it
won't work in that you don't have to
deal with that real basic has this
concept of plugins but the plugin is not
an activex so there's there's these two
sort of different methodologies but real
basic supports activex but if you're
going to move to apply owner doesn't
support active x and calm and that whole
windows infrastructure it doesn't work
so the funny thing is is that when you
get done porting your visual basic
program into real basic not only will
you have say OS 10 compatibility you'll
have a program that handles windows
better than visual basic does that's
funny i just think that's funny ok so
again you can read as well as i can if
you're using things like tree view and
list view it's going to be one of the
biggest issues you have there is no tree
view and list view equivalent in the the
Macintosh world McIntosh has like I
forget how many is like thirty six or
eight different constructs that you can
use for for user interface widgets or I
forget the exact number so you're going
to want to try to find a model because
it's generally frowned upon to create
your own controls you can create
controls as long as they follow the
model that you know Mac has this look
and feel thing that you got it you got
to kind of roll with so you're going to
have to create your own and do that you
may need that we call roll your own
another good thing to do is to just
stick with the intrinsic controls if you
only use the controls that are there by
default the ones that are built in that
you don't have to ship an activex dll
via comm object with then that's pretty
much going to roll right over because
those intrinsic controls are fine i
already talked about the XP themes
project structure when visual basic
first came out it created a single big
binary file and then they and then it
used to get corrupted all the time and
people would hang themselves and after
enough developers you know if people
would just it was terrible you had to
start over and you had to have backups
and it was just bad and then they
brought in other formats and now would
be be five and six the text savings
except for FRx files are pretty much the
standard real basic is the same way it's
got a big binary file but you can also
stay but it's XML if you want an XML is
a nice format because it actually is
nicer than working with text files so
from a structural perspective you can
use the XML or the binary file the app
module is unique to real basic and it's
pretty cool and once you get the hang of
what it's about the whole object will
basically ended truly and once you begin
to get the feel of that you're going to
have you know to be able to you're gonna
be able to do some things you couldn't
do in visual basic that are good menu
creation and structure is a little bit
different than visual basic and real
basic they both have editors but they're
just a little bit different and then
there's the MIDI SDI MDI issues not so
much an issue anymore because Microsoft
is pulling back from the MDI concept if
you know the latest versions of Word and
Excel and PowerPoint from someone for
example aren't MDI allocations anymore
they show up down as individual copies
of the application so you can make em di
applications if you want in real basic
but there's there's really no need to AP
is we talked about this a little bit as
we as we got going but one of the
interesting things about real basic is
that kind of like who remembers vb for
ya go to old old school guys out there
yeah we're still here um well they had
this and even in vb five you had this
this the strange ability to be able to
say if it's 16-bit code do this and if
it's 32 bit code do that well it's the
same kind of concept here but it's like
if I'm OS you know nine or carbon or
whatever do this if I'm OS 10 do this if
I'm Linux do this if I'm windows do that
and so you have these declarations and
what you can do then is you can use
Windows API sore ever a p.i you want you
just have to do a block of them for
whatever the particular application is
that you want so it's um it's actually a
lot more flexible
okay some of the other considerations
you're going to have to deal with we you
know don't forget the fact that there's
a different expectation for Macintosh
users versus Windows users they get the
look and feel there's the way things
work the way things look the way things
are named there's a there's a process
flow that you want to pick up so you're
probably going to want to go download
the platform development guidelines and
things like that tools how many people
use tools for that you know in their vb
world space like optimizers or debuggers
or things like that nobody don't need
them only a few people gonna have to
find them program structure issues we
talked about it so well at the end of
the day I think that if you're a you
know a three-quarters decent visual
basic developer that made you been
writing in visual basic for a year or
two or maybe maybe a little bit more you
should have absolutely no problem
porting almost anything you've done in
visual basic to real basic it's going to
take some manual tweaking and you have
to decide up front because we've I've
spoken to some people that have said
well you know what i wanted to me that
this thing's been dragging along since
vb3 and i've wanted to like redo this
for a really long time and i'm just
going to start from scratch and real
basic but i don't have to throw all my
code away because i got some classes or
some modules and some things i've done
that i want to reuse so you have to
decide once you look at it whether you
want to you want to toss it in come from
scratch but in most cases at least some
of the code will move forward if not
everything almost all of your user
interface will just come right over just
show right up and look fine and like I
said window specific custom controls
will be the the biggest problem you have
you know dealing with dealing with that
so and also you're going to need some
tools well you don't need it but
wouldn't it be nice if there was
something you could get for free that
would translate your visual basic
program into real basic for you and give
you a starting point go like this oh you
guys did stay up way too late last night
we should have that music you know thing
they call it the cone you know like the
orchestra music in the background visual
basic project converter what is it where
does it come from it's a free tool from
real software it's got a drag-and-drop
interface on it and it will attempt to
convert your visual basic stuff to real
basic stuff and it works like this you
drag your real basic stuff over you drop
it you click button out squirts real
basic stuff as converted as can be done
given the constraints that we just spoke
about if nothing else in some cases
things just load and work and there's a
trick using the project converter
that'll make it easier for you and in
some cases it loads up and real basic
and it won't work for 15 or 20 minutes
while you oh I got it oh that's right
that should be as integer all you know
and you got it you got to do a little
tweaking but it brings it right over
it's not perfect but you know what it's
a lot better than not having it so I am
we're going to talk about exactly how it
works so before you use visual basic
project converter you need to clean up
your BB code and this is where like how
many people I don't know how many times
I've done this but it's like it's you
know especially newer vb developers got
sloppy you know using variants and using
ampersand instead of plus and not
casting things and just generally being
sloppy and writing code that C
programmers always laugh at us for well
it's you know it's easy to be sloppy as
we said if you didn't do that you're way
ahead of the people who did because now
you're going to have to go back and
unlock your code and for example you
want to get rid of ampersand for
concatenation of strings that's wrong in
the first place it's really slow its it
use you know use plus you want to get
rid of all those you know dollar signs
and the other things we talked about you
want to dimension all your variables
hopefully on a single line for your own
your own sanity dim x as string then y
as integer that would be really good get
rid of all your def x def in depth long
whatever you've been used and get rid of
it and just remember that whatever you
have cast as an integer in visual basic
will become an integer in real basic but
an integer in real basic is four bytes
long not two bytes long like an integer
and visual basic
try to get out of using currency and
bite if you can otherwise you're going
to have to work around them when you get
it over you can use the char ASCII
combination as a bite replacement
usually you can do some manipulations to
be able to do that substitute double for
currency okay before anyone starts
slinging I know there are rounding
differences between doubles and currency
that's why currencies like it is the
real basic developers know that in fact
about two or three months ago we had a
another session like this in a real
world which is the real basic trade show
and you know with great detail several
real basic developers very nicely
articulated the issue I you know they're
going like this it was funny and so I
know it's being worked on the error
handling that you have in your vb code
is just going to go away it's all going
to become commented by the project
converter so you're gonna have to find
it and fix it after that so things to do
beforehand get rid of go to I mean you
can use it but you know if you don't
need to don't I mean you can still use
it but you can't say go to a line number
you can go to a label move things from
forms into modules bust up your code if
you can into into chunks of related
function if you haven't if you've got
the all-singing all-dancing vb4 map you
know you must have seen them if you've
been around long enough it's like you
know form one and it's 6 megabytes big
takes forever to load and it's just
everything to try to break it up there's
no such a thing as ghosts of and real
basic so functions and methods and logic
are going to be required and real basic
does have the database engine and has
sequel capabilities it's different than
the sort of Microsoft model you know the
a do control model that visual basic has
but the sequel logic will largely be
compatible you know select star from
whoever things like that will work fine
so what was the experience using it well
it always creates a project now real
real basic doesn't have individual
modules as we already said I mean they
do logically but when you save it on
disk it's one big file whether it's XML
or it's a binary project so if I just
bring over one module of a visual basic
code that I want to pour
it'll port it and it'll create a real
basic project with an application object
it will have a default window in it and
it will have my module so you're going
to have to take that and then save that
module out on the side that's not that
hard to do some things are going to be
problems like I when I was doing some
conversions I had I had a variable in
one of my programs called graphics
actually with the class I think so I had
it whatever I was using the word
graphics well graphics is a reserved
keyword in real basic because they
actually have a paint event where you
get a graphics handle would you have to
use API is for and in visual basic
actually just happens by default there's
an argument pass through the pain of
benefit of an object or a forms like ah
here's the graphics object and that's a
graphics dot this or graphics about that
so that keyword is you know they've got
to worry about worry about those things
so my advice use the vb project
converter to convert one file at a time
after you've converted a file export it
or make what real basic calls make
external which is how you can have
external files and how you share files
between projects make it external and
then debug report that code this gets
back to busting my code up into modules
and things I can exercise and you know
just do it again and again until you're
done it's called programming in the end
you can do it it works I'm living proof
of that and just remember that real
basic is is object oriented it's in my
opinion a better language than visual
basic and why do I say better because it
made me get cleaner about the code eyes
would write and I'm just I'm just I'm
programmed now you know I'm like I'm
going my lightsaber shines green instead
of red you know I'm over the dark side
so um uh you know I find myself dimming
everything and everything's a class and
I'm just you know I just this whole
object oriented thing is taking me over
it's cool I like it at my age you don't
learn new things very often so again you
can read as well as I can i talked about
most of these things import one piece at
a time test as you import build them up
as external pieces and now you've really
moved your visual basic code into a
stage where you can compile for any
platform you want not the least of which
is OS 10 and of course
that's where this gentleman comes in
come back up for a second thank you very
much Hank thought it might be nice to
talk about a couple marketing
opportunities after you've done the work
Hank outline for you and you have a
publicly available app whether it's
commercially available or freeware
shareware application you might want to
get the word out about that having taken
the time to come to a new platform so
here's a couple free marketing
opportunities that are available for you
the first is the real basic showcase so
the folks at real software have put
together our part of their website real
basic calm / showcase and you can go
there and list your application and one
waits for customers to find out about it
the other is the Macintosh products
guide so it's a shot of it there there
are 25,000 products in the Macintosh
products guide you can list your product
for free and there are also pay
opportunities to get some of these
larger ads that you see there and that's
it guide apple com and that is very much
the storehouse of record for all the
products available for Mac OS 10 and I
would encourage you again if you have a
publicly available application to list
them in these two different areas take
advantage of these freako marketing
opportunities for more information
you're welcome to contact myself Tyler
stone developer relations you can see
here Hank's email address up there which
is Hank at sleigh fire calm and you can
also contact the folks at real software
mat qua Liana has volunteered his
address matta real software com you want
more information about the real basic
tool itself we're doing pretty good on
time here let's run through these a
resource library reference library I'm
sorry so we have some resources
available for developer tools / it's Lee
fire com there's actually a good
comparison of different IDEs out there
at the coated food with the rosetta site
and and go to the real software side if
you want to see it kind of a
point-by-point comparison real basic to
visual basic from a feature point of
view