Presentation is loading. Please wait.

Presentation is loading. Please wait.

20081 Converting workspaces and using SALT & subversion to maintain them. V1.02.

Similar presentations


Presentation on theme: "20081 Converting workspaces and using SALT & subversion to maintain them. V1.02."— Presentation transcript:

1 20081 Converting workspaces and using SALT & subversion to maintain them. V1.02

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

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

4 Script form Up until V11 namespaces came in a single form. They contained functions, variables and other namespaces. 20084

5 Script form Starting with V11 namespaces also came in a script form. The contained functions, etc. are listed in text format: 20085

6 Script form The script and the functions in it can be edited via the editor, e.g. )ED ns2 )ED ns2.tfn1 20086

7 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

8 20088 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

9 20089 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.

10 200810 BAAD's SD2 product Unit is made of 2 main components: -a driving component -a weapons component

11 200811 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

12 200812 The simulator Battling units Units' Consoles Battlefield

13 200813 The simulator

14 200814 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)

15 200815 The simulator's structure R Here, namespace R is where all the Units' logic reside

16 200816 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

17 200817 Acceptable updating timeline Time Tester A Tester B load save change Sequential updates

18 200818 Unacceptable updating timeline Time Tester A Tester B load save change Tester A's changes are overwritten by Tester B even if the modified namespace is different

19 200819 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.

20 200820 Dyalog V11.0 This version allows namespaces to exist in script format. Instead of having a series of namespaces each with functions and variables

21 200821 Dyalog V11.0 You can have everything in script form, including the definition of variables

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

23 200823 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 Time load save change namespace A namespace B

24 200824 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

25 200825 Tracking changes Comparing files can be done easily in APL by SALT or by any 3 rd party program. Line a Line b Line c Line a Line X Line c

26 200826 Doing it The first step is to convert the workspace to the new form

27 200827 Start Dyalog, SALT should be there: Converting the workspace

28 200828 If it isn’t we have to make sure SALT is enabled: Converting the workspace

29 200829 )LOAD our workspace: Converting the workspace

30 200830 Make sure the workdir includes Dyalog: Converting the workspace

31 200831 Bring in the conversion tools: Converting the workspace

32 200832 NStoScript is a namespace containing code to perform conversion of regular (non sourced) namespaces. The function to use in it is. Converting the workspace

33 200833 For example, to convert namespace 'UTIL': Converting the workspace

34 200834 To convert several namespaces first )CS where the namespaces are: Converting the workspace

35 200835 Then use an expression like: Converting the workspace

36 200836 Explorer now shows us the namespaces with the new icons: Converting the workspace

37 200837 The workspace has the same functionality as before. It can be )SAVEd in this new format Converting the workspace

38 200838 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, because of the encoding, is a bit more complex. Again, SALT comes in handy.

39 200839 Saving the scripts as text files 1.decide where to put them 2.use the SALT Save function

40 200840 Saving the scripts as text files The Save function takes a string argument of: 'namespace location':

41 200841 Saving the scripts as text files To save all the namespaces at once do:

42 200842 Saving the scripts as text files If you want to save everything at once you can do instead

43 200843 Saving the scripts as text files Either way you should now have a folder with many scripts in it:

44 200844 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.

45 200845 Making changes Here's what one of the scripts' contents looks like:

46 200846 Making changes And here we make a change:

47 200847 Making changes SALT detected the change and offers to change the script file:

48 200848 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)

49 200849 Version Control This is the 2 nd 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.

50 200850 Version Control For a company it is preferable to use existing software like subversion. To use subversion we first need somewhere to put the scripts files.

51 200851 Version Control We picked folder \weapons as repository

52 200852 Version Control We now import the scripts into the repository: (we put our code in 'Troops')

53 200853 Version Control One of the testers now checks out a copy:

54 200854 Version Control Any other tester can do the same thing and update it independently. repository checkout tester x checkout tester 7 tester n tester 3 checkout

55 200855 Version Control He can see what's in his folder

56 200856 Version Control And use any portion (pattern) of it

57 200857 Version Control Then grab the 2 nd column (the names )

58 200858 Version Control Make sure his own folder is in the workdir list

59 200859 Version Control And bring in his files in the 'R' namespace

60 200860 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.

61 200861 Version Control He, 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

62 Modifying the code 200862

63 Viewing changes 200863

64 Viewing changes 200864

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

66 200866 Version Control He, 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

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

68 200868 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.

69 200869 Conclusion Any version control will probably do but subversion is well supported and well documented. And it's free.


Download ppt "20081 Converting workspaces and using SALT & subversion to maintain them. V1.02."

Similar presentations


Ads by Google