Converting workspaces and using SALT & subversion to maintain them.

65
2008 1 Converting workspaces and using SALT & subversion to maintain them. V1.01

description

Converting workspaces and using SALT & subversion to maintain them. V1.01. Introduction. This is an example of converting an existing application to SALT and using a version control system afterwards to maintain it. What is SALT?. - PowerPoint PPT Presentation

Transcript of Converting workspaces and using SALT & subversion to maintain them.

Page 1: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 1

Converting workspaces and

using SALT & subversion to

maintain them.V1.01

Page 2: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 2

Introduction

This is an example of converting an existing application to SALT and using a version control system afterwards to maintain it.

Page 3: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 3

What is SALT?

SALT is a tool to deal with code outside the workspace in text (Unicode) format.

Page 4: Converting workspaces  and using SALT &  subversion  to maintain them.

Script formUp until V11 namespaces came in a

single form.They contained functions, variables

and other namespaces.

2008 4

Page 5: Converting workspaces  and using SALT &  subversion  to maintain them.

Script formStarting with V11 namespaces also

came in a script form.The contained functions, etc. are

listed in text format:

2008 5

Page 6: Converting workspaces  and using SALT &  subversion  to maintain them.

Script formThe script and the functions in it can

be edited via the editor, e.g.)ED ns2)ED ns2.tfn1

2008 6

Page 7: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 7

How do we do it?

• We'll see the conversion process and• how to use subversion, a third party

product, to control its versioning

Page 8: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 8

The situation

• BAAD is a military weapons manufacturing company

• One of its best sellers is the SD2, a device used to search and destroy specific targets

Page 9: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 9

BAAD's SD2 product

• This unit is self contained: its behaviour is set once and does not require external input.

• There are several (possibly 1000s) models, each with a different code name. The logic (code) of each is unique.

Page 10: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 10

BAAD's SD2 product

• Unit is made of 2 main components:

- a driving component- a weapons component

Page 11: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 11

Testing the product

• Obviously, testing these devices in real life presents a problem

• In its infinite wisdom the company has decided to use a simulator written in (what else?) Dyalog APL

• A single workspace holds all the system

Page 12: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 12

The simulator

Battling units

Units'Consoles

Battlefield

Page 13: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 13

The simulator

Page 14: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 14

The simulator's structure• The workspace is divided into

namespaces• One namespace contains all the

units' logic, here its name is 'R' (for Robots)

• Each unit's logic is also contained in a namespace whose name is the name of the unit (like CARLA or AI2)

Page 15: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 15

The simulator's structure

Here, namespace RR is where all the Units' logic reside

Page 16: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 16

Updating the workspace • This involves modifying individual

units' code in their respective namespaces

• and resaving the entire workspace when finished with the changes

• This prevents other users from updating the workspace at the same time

Page 17: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 17

Acceptable updating timeline

Time

Tester A

Tester B

load

load

save

save

change

change

Sequential updates

Page 18: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 18

Unacceptable updating timeline

Time

Tester A

Tester B

load

load

save

save

change

change

Tester A's changes are overwritten by Tester Beven if the modified namespace is different

Page 19: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 19

Tracking changes

Another problem with this model is that changes are irreversible.

Even tracking changes is difficult.

Finding differences in code is hard to document.

Page 20: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 20

Dyalog V11.0This version allows namespaces to

exist in script format.

Instead of havinga series of namespaces each with functions and variables

Page 21: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 21

Dyalog V11.0You can have

everything in script form, including the definition of variables

Page 22: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 22

Scripts files

Keeping namespaces in scripted form allows us to save them in (Unicode) text files outside the workspace.

workspace

Page 23: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 23

Updating can now be done in parallel for different namespaces

Tester A

Tester B

load

save

change

Tester A's changes are NOT overwritten by Tester B

Timelo

adsave

change

namespace A

namespace B

Page 24: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 24

Tracking changes

It is easier to track changes now that files are in human readable format.

By saving multiple copies we can see the difference between each modification.

workspace

Page 25: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 25

Tracking changes

Comparing files can be done easily in APL by SALT or by any 3rd party program.

Line aLine bLine c

Line aLine XLine c

Page 26: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 26

Doing it

The first step is to convert the workspace to the new form

Page 27: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 27

Start Dyalog, SALT should be there:

Converting the workspace

Page 28: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 28

If it isn’t we have to make sure SALT is enabled:

Converting the workspace

Page 29: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 29

)LOAD our workspace:

Converting the workspace

Page 30: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 31

Bring in the conversion tools:

Converting the workspace

Page 31: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 32

ConvertCode is a namespace containing code to perform conversion of regular (non sourced) namespaces.

The function to use in it is <Convert>.

Converting the workspace

Page 32: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 33

For example, to convert namespace 'UTIL':

Converting the workspace

Page 33: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 34

To convert several namespaces first )CS where the namespaces are:

Converting the workspace

Page 34: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 35

Then use an expression like:

Converting the workspace

Page 35: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 36

Explorer now shows us the namespaces with the new icons:

Converting the workspace

Page 36: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 37

The workspace has the same functionality as before.

It can be )SAVEd in this new format

Converting the workspace

Page 37: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 38

Filing away

The next step is to store those namespaces in Unicode files.

Altho is it relatively simple to read/write text to file, their management is a bit more complex.

Again, SALT comes in handy.

Page 38: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 39

Saving the scripts as text files

1. decide where to put them

2. use the SALT Save function

Page 39: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 40

Saving the scripts as text filesThe Save function takes a string

argument of: 'namespace location':

Page 40: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 41

Saving the scripts as text filesTo save all the namespaces at once

do:

Page 41: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 42

Saving the scripts as text filesIf you want to save everything at

once you can do instead

Page 42: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 43

Saving the scripts as text filesEither way you should now have a

folder with many scripts in it:

Page 43: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 44

Making changes

SALT 'remembers' where each script was saved.

Changing one of them now means SALT will change the file as soon as the script is modified through the editor.

Page 44: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 45

Making changesHere's what one of the units' logic looks like:

Page 45: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 46

Making changesAnd here we make a change:

Page 46: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 47

Making changesSALT detected the change and offers to change the script file:

Page 47: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 48

Making changes

You should )SAVE the workspace here.

Like this SALT will remember where the edited namespaces are stored and detect if changes have been made outside APL (e.g. with Notepad)

Page 48: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 49

Version Control

This is the 2nd part of the work to do.

SALT comes with its own versioning of files and comparison functions but it is primitive compared to state of the art version control systems like subversion.

Page 49: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 50

Version Control

For a company like BAAD it is preferable to use existing software like subversion.

To use subversion we first need somewhere to put the scripts files.

Page 50: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 51

Version ControlWe picked folder \weapons as

repository

Page 51: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 52

Version Control

We now import the scripts into the repository:

(we put our code in 'Troops')

Page 52: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 53

Version Control

One of the testers now checks out a copy:

Page 53: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 54

Version Control

Any other tester can do the same thing and update it independently.

repository

checkout

tester x

checkouttester 7

tester n

tester 3

checkoutcheckout

Page 54: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 55

Version Control

He can see what's in his folder

Page 55: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 56

Version Control

And use any portion (pattern) of it

Page 56: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 60

Version Control

He can now repeat this procedure each time he )LOADs the workspace or )SAVE his own copy (e.g. 'tester1robots') which can be )loaded instead.

Page 57: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 61

Version ControlHe, and any other tester that has

done the same thing, can now test the system and update it independently.

repository

tester x

tester 7

tester n

tester 3

Page 58: Converting workspaces  and using SALT &  subversion  to maintain them.

Modifying the code

2008 62

Page 59: Converting workspaces  and using SALT &  subversion  to maintain them.

Viewing changes

2008 63

Page 60: Converting workspaces  and using SALT &  subversion  to maintain them.

Viewing changes

2008 64

Page 61: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 65

Version Control

When changes are ready to be checked in you do (here DANIMAL has been changed)

Page 62: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 66

Version ControlHe, and any other tester that has

done the same thing, can now test the system and update it independently.

repository

tester x

tester 7

tester n

tester 3

commit

commit

commit

commit

Page 63: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 67

Version Control

The VC should be able to handle conflicts, report on differences and generate complete new systems from the current repository.

Page 64: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 68

Conclusion

For local or smaller systems you may choose to use SALT's limited versioning and comparing abilities but a solid Version Control system is a must for large systems.

Page 65: Converting workspaces  and using SALT &  subversion  to maintain them.

2008 69

Conclusion

Any version control will probably do but subversion is well supported and well documented.

And it's free.