Following on from the great talk Drew Foglia gave at discovery conference Europe (Object-Oriented JSL – Techniques for Writing Maintainable/Extendable JSL Code), I am trying to write my first object oriented JSL.
I am able to use the ObjectClass.jsl (from the core example files provided by Drew) to get and set properties to an object I have created.
My question is does anyone have some simple examples they could share to see ways this idea is implemented. For example how might the following example look as objects (considering in the real world I am likely to want to store details like table name, no. cols, column names, no. rows, label columns etc. for each table)?
NamesDefaultToHere(1);
dt1 = Open("$SAMPLE_DATA/Cars.jmp");
dt2 = Open("$SAMPLE_DATA/Cars 1993.JMP");
//join tables (assume some function was used to find the matching column names)
dt3 = Data Table( dt1 ) << Join(
With( Data Table( dt2 ) ),
Merge Same Name Columns,
By Matching Columns( Column(dt1,1) = Column(dt2,1), Column(dt1,2) = Column(dt2,2) ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 )
);
//display result
win1 = dt3 << Graph Builder(
Size( 534, 447 ),
Show Control Panel( 0 ),
Variables( X( :Size ), Y( :Name( "Wheel Base (inches)" ) ) ),
Elements( Points( X, Y, Legend( 38 ) ), Box Plot( X, Y, Legend( 39 ) ) )
);
//tidy up
win1 << On Close(dt1 <<Close Window;dt2 <<Close Window; dt3 << Close Window(No Save) );
When would I decide to create a new class? The generic ObjectClass would work just fine for tables provided I can remember which property I have assigned to which key!
Thanks,
Stephen