news • technology • tricks • interview mdt magazine · • munit 3 support plug-in– a...

8
MDT Magazine MAGAZINE FOR SMALLWORLD™ MAGIK SOFTWARE DEVELOPERS ISSUE 4 · SPRING 2012 ASTEC, POLAND Transforming into an Enterprise Multitool New Extensions MUnit 3 Support plug-in – a mecha- nism that allows for writing and run- ning tests for applications written in Magik language. It is responsible for automatic generation of test cases, run- ning tests and presenting their results. It is very helpful in discovering errors and mistakes already in code produc- tion phase. UML2 Modeler plug-in – a tool to be used for modeling of whole systems with the use of UML2 language. Its main functionality is to model system architectures as well as dynamic gen- eration of Magik source code accord- ing to previously created models. It helps to combine the work of archi- tects working with UML language with the tasks given to Magik developers. New Features New Mixin, New Slotted Exemplar Wizards those wizards have been added for easy and semiautomatic crea- tion of Magik elements such as Mixins and Slotted Exemplars. With their help you can now create entire blocks of code including automatic creation of method stubs, pragma statements and comments. Type Overview – a kind of read-only editor that allows you to see the source code of an entire class in case it is spread between many files. Type Overview col- lects all information directly from the session, so the shown code is always up-to-date. It groups the methods com- ing from the same files and marks them with different background color so they are easily distinguished. Dear Readers, NEWS TECHNOLOGY TRICKS INTERVIEW ADVANTAGE THROUGH INFORMATION with MDT PE 3.0-3.1 release by Błażej Sytar, Sales & Support Leader, ASTEC In the second half of the last year we have focused strongly on possible extensions to MDT, which would allow the entire development teams to benefit from it. In pursuit of this goal we have implemented a dedicated tool for testers and something for archi- tects. With the support of Mylyn MDT can now serve for different tasks within a team. Of course that is not all, here’s a short overview of the new stuff: Inside... Last year was full of little accomplishments. We have gained many new customers from different enterprises and continents. We have also heard many words of appreciation. This drives us further and keeps motivated to work even harder on improving Magik De- velopment Tools. In effect we are happy to place in your hands the 2012 Issue of MDT Magazine. What’s in it? First of all you can learn about what’s new the recent releases 3.0 and 3.1 have brought in. And there is something to be proud of: MUnit 3 Support and UML2 Modeler plug- in have been published. Further you can read about our newest endeavor, which is the MStyle plug-in - a tool that will help you improve the quality of your code in many different ways. Next you can find an article about many handy Magik tricks that we are sure you will find useful in your work. They have been gathered over the years by one of our devel- opers who has been working with Magik for a long time. With a little incentive he agreed to share them with You. We also invite you to look into the interview section. One with a couple of representatives of our very good business partner – Ubisense Germany. They will share their opinion about MDT.The other is with Dr. Jun Gang from GE Smallworld. She will tell us a lit- tle about her impressions after attending our dedicated training: “Development tech- niques with the use of MDT”. Best wishes, MDT Team, ASTEC Are You new to MDT? Visit MDT online if you would like to know Visit us today at www.mdt.net » why MDT is the most intuitive IDE for Magik development, » how it will increase your programming efficiency and » why is it being used by companies all over the world. Try out the 2-month trial, watch our video tutorials and subscribe to the newsletter. Transforming into an Enterprise Multitool with MDT PE 3.0-3.1 1 MStyle plug-in – Coming soon! 2 MDT in Ubisense 4 Magik Tricks 5 Training Feedback 7 ............ ........................... ................................. ........................................ ................................

Upload: others

Post on 08-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NEWS • TECHNOLOGY • TRICKS • INTERVIEW MDT Magazine · • MUnit 3 Support plug-in– a mecha-nism that allows for writing and run-ning tests for applications written in Magik

MDT MagazineMagazine for SMallworld™ Magik Software developerS iSSUe 4 · Spring 2012 aSteC, poland

Transforming into an Enterprise Multitool

New Extensions

•MUnit 3 Support plug-in – a mecha-nism that allows forwriting and run-ning tests for applications written inMagik language. It is responsible forautomaticgenerationoftestcases,run-ning tests andpresenting their results.It is veryhelpful indiscovering errorsandmistakes already in code produc-tionphase.

•UML2 Modeler plug-in–atooltobeused for modeling of whole systemswith the use of UML2 language. Itsmain functionality is tomodel systemarchitectures as well as dynamic gen-eration ofMagik source code accord-ing to previously created models. Ithelps to combine the work of archi-tectsworkingwithUMLlanguagewiththe tasks given to Magik developers.

New Features

•New Mixin, New Slotted Exemplar Wizards – those wizards have beenaddedforeasyandsemiautomaticcrea-tionofMagikelementssuchasMixinsandSlottedExemplars.Withtheirhelpyou can now create entire blocks ofcode including automatic creation ofmethod stubs, pragma statements andcomments.

•Type Overview – a kind of read-onlyeditorthatallowsyoutoseethesourcecodeofanentireclassincaseitisspreadbetweenmanyfiles.TypeOverviewcol-lects all information directly from thesession, so the shown code is alwaysup-to-date.Itgroupsthemethodscom-ingfromthesamefilesandmarksthemwithdifferentbackgroundcolorsotheyareeasilydistinguished.

Dear Readers,

NEWS • TECHNOLOGY • TRICKS • INTERVIEWadvantage tHroUgH inforMation

with MDT PE 3.0-3.1 releaseby Błażej Sytar, Sales & Support Leader, ASTEC

In the second half of the last year we have focused strongly on possible extensions to MDT, which would allow the entire development teams to benefit from it. In pursuit of this goal we have implemented a dedicated tool for testers and something for archi-tects. With the support of Mylyn MDT can now serve for different tasks within a team. Of course that is not all, here’s a short overview of the new stuff:

Inside...

Lastyearwasfulloflittleaccomplishments.Wehavegainedmanynewcustomers fromdifferententerprisesandcontinents.Wehavealsoheardmanywordsofappreciation.Thisdrives us further and keeps motivated toworkevenharderonimprovingMagikDe-velopmentTools.

Ineffectwearehappytoplaceinyourhandsthe2012IssueofMDTMagazine.What’sinit?Firstofallyoucanlearnaboutwhat’snewtherecentreleases3.0and3.1havebroughtin.And there is something tobeproudof:MUnit3SupportandUML2Modelerplug-inhavebeenpublished.

Further you can read about our newestendeavor, which is the MStyle plug-in -atoolthatwillhelpyouimprovethequalityofyourcodeinmanydifferentways.

Next you can find an article about manyhandyMagiktricksthatwearesureyouwillfind useful in your work. They have beengatheredovertheyearsbyoneofourdevel-operswhohasbeenworkingwithMagikforalongtime.WithalittleincentiveheagreedtosharethemwithYou.

Wealsoinviteyoutolookintotheinterviewsection.Onewithacoupleofrepresentativesofourverygoodbusinesspartner–UbisenseGermany. They will share their opinionaboutMDT.TheotheriswithDr.JunGangfromGESmallworld. Shewill tell us a lit-tle about her impressions after attendingourdedicatedtraining:“Developmenttech-niqueswiththeuseofMDT”.

Bestwishes,

MDTTeam,ASTEC

Are You new to MDT?

Visit MDT online if you would like to know

Visit us today at www.mdt.net

» why MDT is the most intuitive IDE for Magik development,» how it will increase your programming efficiency and» why is it being used by companies all over the world.

Try out the 2-month trial, watch our video tutorialsand subscribe to the newsletter.

TransformingintoanEnterpriseMultitoolwithMDTPE3.0-3.1 1

MStyleplug-in–Comingsoon! 2

MDTinUbisense 4

MagikTricks 5

TrainingFeedback 7

............

...........................

.................................

........................................

................................

Page 2: NEWS • TECHNOLOGY • TRICKS • INTERVIEW MDT Magazine · • MUnit 3 Support plug-in– a mecha-nism that allows for writing and run-ning tests for applications written in Magik

MStyle plug-in – Coming soon!Introduction

Code reviews are essential to maintainsolid code quality. Manual reviews arenot efficient due to human limitationsandthesizeofprojects.Toimprovetheoverallcodequalitywithlittlecost,everyreviewshouldbeautomatic,especiallyincase of well-known problems typical tospecificprogramminglanguages.

Large-scale projects always involve bignumbersofprogrammers,manyofthemvarying in skill level and oftenworkingremotelywithoutdirectcontactwitheachother.Thisgreatlyaffectsthesourcecodeof end-userapplications.Manual reviewofmillionsofcodelinesisatediousjob,though. Ultimately as exhausting as itmustbethorough.

To meet those needs we were planningtodevelopacode-checkingplug-infromsometime.Itwasahardtasktoaccom-plish, because rules specific for Magiklanguage are neither commonly knownnor widely accessible and also rarelyused. Fortunately, in our travels to GEconferences,wecameacrossacoupleofrepresentatives fromRealworldSystems,a well-known and respected companywithin Smallworld community.They re-vealedtousthattheyhavebeenusingasimple,internalplug-in,calledCodeDefi-nitionHandler,thatcheckstheircodeforspecific violations.They agreed to shareitwithus so its sourcecodeandcodingrulesstoredwithincouldserveasfoun-dationsforourownMStyleplug-in.

How does it work?

MStyleplug-inisatoolforcodeanalysiscreated to help developers write Magikcodeconformwithcodingstandardsspe-

Fig. 1 Preferences

Fig. 3 Violation marked in the editor.Fig. 2 MStyle Problems View

cifictotheirtasks.Withitteammembersare able to create internal, customizableand exchangeable code verification pro-cesses.MStyle automates the process ofcheckingMagikcodeandhelpstodiscov-ermanywell-known code violations al-readyincodeproductionphase.Itmakesitidealforteamswhichwanttoenforceaspecificcodingstandardandkeeptheircodeclean.

MStyle in an extension toMDT and itis based on its Magik grammar parser.To launch it you have to select any re-source container (project, folder or file)tocheckitscodeusingdefinedrules.Our

plug-incancheckmanydifferentaspectsofsourcecodelikemetricrules,somein-valid/depreciated source code elementsandrunitonspecifiedprojects.

MStyle allows for introducing modernteamstandardstoMagikprojectsthroughfullycustomizableprofiles.Rulescanbealsoimported/exportedandeasilysharedin team environment. After runningacheckthelistofviolationsispresentedinseparateviewallowingquickaccesstothem.After jumping to them violationsarealsomarkedintheopenededitor.

2

TECHNOLOGY

Mdt Magazine - Magazine for SMallworld™ Magik Software developerS

by Wojciech Trocki, Software Developer, ASTEC

Page 3: NEWS • TECHNOLOGY • TRICKS • INTERVIEW MDT Magazine · • MUnit 3 Support plug-in– a mecha-nism that allows for writing and run-ning tests for applications written in Magik

TECHNOLOGY

iSSUe 4 · Spring 2012 aSteC, poland 3

www.mdt.net

Rules

MStyleplug-in consistsofover30 ruleswhich check the code against differ-entkindsofviolationsorsocalled“badsmells”.Herearesomeofthemostinter-estingones:

•Unassigned Local Variable–ifavaria-bleisdeclaredwithoutassigningitwilltake_unsetvalue.Inmostcasesthoseare junk declarations. Local variablesmustbefirstassigned tobe laterusedinexpressions.

•Responsibility Class – calculates met-rics for class responsibility usingweighted number of non-private classmembersandchecks ifmetricsdonotexceedvaluedefinedinpreferences.

•Wrong Magik File Name–checksifthefilenamediffersfromthenameofthecontaining exemplar. If filename con-tainsmorethanoneexemplar,thisrulechecks ifoneof themmatches thefilename.

•Method Name Too Long /Exemplar Name Too Long–longmethodsorex-emplarsnamesmakethecodedifficulttoreadandunderstand.Longmethodnames are sometimes related to toohigh responsibility of an element. Forexample method name: calculate_and_restore_pointsmayberefac-tored into calculate_points andrestore_points. The rule checksiflengthofmethodorexemplarnamedoesnotexceeddefinedvalue.

•Nesting Depth – a metric used for amethod which counts the maximumnumber of encapsulated scopes insidethe body of the method. Statementslikeif,fororlooparerecognizedasnestingblocks.Ifnestingdepthexceedsthe defined value, next nested blockshouldbeextractedtoanewmethod.

•Chained Instructions–checksifsourcecodecontainsmultiplechainedinstruc-tionsbasedonreturnvaluesfromin-vocations. Multiple invocations arenot recommended and oftenmay risedoes_not_understand condition.Return values are not stored in localvariables,sodebuggingsuchstatementscanbeverydifficult.

•Valid Pragma Statement–pragmaclas-sifylevelandusageshouldalwayshavepropervalues.Ifpragmasarebeingen-teredbyhandsometypographicerrorsmayoccur,whatcancausethemethodtobecomeunclassified.

•Method With Class Name Invoca-tion–sometimesacheck isneededtoseeifanobjectisaninstanceofaspe-cific class. Checking its type by usingclass_name method does not guar-anteeuniqueresults.Withthisrulewecaneasilytracksuchinvocations.

• Invalid Comparison–adevelopercansometimesuseimproperoperatorwhilecomparingvalues.Thisrulechecksifel-ementsareproperlycompared.Stringsandnumbersshouldbecomparedusingthe=and<>operators.Symbolsshouldbecomparedusingthe_isand_isnt.

Youcanalsodefineyourownrulesbasingonprovided regular expressions.MStylereads all files with extensions linked tosuch rule and checks if the file contentsmatchtheprovidedpattern.

On-the-fly checks or Continuous Integration

MStylecanbeusednotonlytocheckthecode locally, on-the-fly within one IDE.Withsomeadditionalmechanismsitcanbe also used for continuous integration

Fig. 4 List of available rules to be added.

Fig. 5 Sonar dashboard.

supporting popular systems like Sonar.This allows for reports generation andfast trackingof code changesorquicklyspottingofdecreasingcodequalitywithintheentireproject.

Coming soon!

MStyleplug-inisstillunderdevelopment.Internalreleaseshavebeenalreadytestedandtheresultsaremorethanpromising.Still, there is much more hard develop-mentwork ahead of us.The official re-lease is planned for the second half of2012.Wewill keep you posted, so sub-scribetoourNewsletteratwww.mdt.net.Ifyouwouldliketoparticipateinthebetatestingprogramyouarewelcometoapply([email protected]).

Page 4: NEWS • TECHNOLOGY • TRICKS • INTERVIEW MDT Magazine · • MUnit 3 Support plug-in– a mecha-nism that allows for writing and run-ning tests for applications written in Magik

INTERVIEW

Mdt Magazine - Magazine for SMallworld™ Magik Software developerS4

Hans-Peter Barth, byfriends called “Hape”,isanexperiencedMagiksoftware developer. Hestudied Geodesy at theUniversity of KarlsruheinGermany.Hehasbeenworkingonseveralinter-nationalprojectscarried

outforbigtelecommunicationproviderstodocumentanddesigntheirnetworkinven-tory.Hismainfocusstaysonrequirementsspecificationandapplicationdesign.

Michael Pahlke studiedAppliedMathematics atthe Hochschule Darm-stadt (University ofAp-pliedSciences),wherehereceivedhisB.Sc.degreein 2010. He has beenworking with Small-world GIS for about 2

years.Hestartedasamemberof the testteam,nowhedoes softwaredevelopmentworkinthesameprojectasHape.

ASTEC has been a business partner of Ubisense Germany for many years. We have done many of Smallworld projects together and successfully im-plemented various applications to customers from different enterprises. They convinced themselves to start using MDT in Spring of 2011 and have been applying our tool to more and more tasks ever since. Below you can read through a short conversation between Błażej Sytar (ASTEC) and two of Ubisense’s developers: Hans-Peter Barth (Hape) and Michael Pahlke.

MDT in Ubisense

[Błażej] Good day Hape, Michael. Thank you for agreeing to answer some ques-tions. For starters I would like to ask you how long have you been working as a de-veloper/Magik developer?

[Hape]I’vebeenworkingasMagikdevel-operfor12years.

[Michael] I’m a young professional. Ihavestartedmyworkinthebeginningofthe year 2011 and begun developing inMagikjusthalfayearago.

[Błażej] What do you think about how trends in software development have changed over the past years and how Magik programming goes by them?

[Hape] Ingeneral softwaredevelopmentbecomesmoreandmoreagile,butMagikprogrammingistooinflexibletoreactonthesechangingneedsbecauseit’sahighlyspecific development environment andthereisnobigcommunitythatconstantlyimprovesit.

[Błażej] What was a bigger challenge in your case, convincing the board or chang-ing the mindset of your colleagues and yourselves?

[Hape]Ithinkthehardestpartistocon-vince yourself. Once we (developers)wereconvincedthatwewillbenefitfromworkingwithMDT,theboardwaswill-ing to follow thisdecision.Additionally,theboardrealizesthatit’sreallyhardforbeginners (like people coming straightfromuniversity)tobecomefamiliarwithEmacs development environment. UsingMDThasabigadvantage-it’sbasedonawell-knownplatformandthereforecouldspeed-uptheadjustmenttothetasksofaMagikdeveloper.

[Michael] I can only agree with HapebecauseIknewEclipsefrommystudies.Emacs seems tobe tooold-fashioned tome and therefore I am really glad thatthereisaMagikpluginforEclipse.Ire-ally get on well with MDT due to myexperiences with Eclipse. The decisioncamejustattherighttimeforme,sincedevelopingwithEmacswouldhavebeenatoughnuttocrack.

[Błażej] What exactly has changed your mind and convinced you to switch from Emacs to MDT?

[Hape]Ihopedtobenefitfromthemanyavailable tools (code assistant, refactor-ing,debugger,etc.)thatMDTofferswith-inoneintegratedenvironment.Addition-ally,Ithoughtitcouldbeveryhelpfultofamiliarizewithanenvironmentwhichisused as standard environment for otherlanguagesaswell.

[Błażej] What is the general attitude to-wards MDT today? Do you think you will be ready to make a full switch even-tually?

[Hape] Honestly, my feeling is that I’mstill not 100% comfortable usingMDT.Especially, thereareareasI’mjust fasterusing familiar Emacs short keys. But Ithinkthisisjustamatteroftimeandcon-figuration. I’mconvinced Iwill getusedto it.What still prevents me from fullyswitchingisthefactthatpreparingyourruntime/environment seems to requiremoreeffortandisnotasflexibleaswithEmacs.

[Błażej] Did you experience any chal-lenges with configuration or adaptation? How long did it take you to feel comfort-able using it?

[Hape]TheonlyconfigurationI’vedonefrequentlywastheconfigurationofshortkeys.Theconfigurationseemsveryintui-tiveandveryhelpful.

[Michael] Since our development envi-ronment isdeployedona server, the in-stallation and initial configuration wasdone by our configuration manager. Ionly did some small adaptions concern-ingshortkeys,comments,codeassistantand stuff. Such configurations are donereally quickly and you can export youradaptionstoanotherMDTimage,whichisquiteuseful.IttookmeonlyafewdaystofeelcomfortableusingMDT.

[Błażej] You have been using MDT for around half a year. What would you say about it today, when you already have some perspective?

[Michael]MDTisapowerfultoolandIstilldiscoverinterestingandusefulfunc-tionalities.Thedebugmode for instanceisveryhelpful,becauseitallowstoexplic-itlyinspectproblemsandsystembehavioratruntime.Searchingtermsandmethodsor browsing source code is really intui-

tive.TosumitupMDTprovidesaquick,broad and also detailed view into yourcode.

[Błażej] You both have different areas of expertise. What sort of tasks is our tool most useful for?

[Hape]SinceIusuallydonotdevelopnewfeaturesfromscratch MDTismostusefulformewhenitcomestotasks like valida-tion of bugs. Especially the debugger isa powerful tool.MDTalso helpsme tokeepthecodeconsistentwhilerestructur-ingit,e.g.byrenamingclasses.

[Michael] Due to the aforementionedfeatures,IthinkthatMDTismostusefulwhenitcomestobugfixingandrefactor-ing…andsimplycoding,ofcourse.

[Błażej] You have also attended the train-ing that was arranged in Ubisense, Darm-stadt in summer last year. Please com-ment it in a few words.

[Hape]Thetrainingwasagoodstartingpoint to the general concepts of MDT,especially if you are not familiar withEclipse.

[Błażej] Would you recommend MDT to other Magik developers?

[Hape] Yes, I would definitely recom-mendMDTtootherMagikdevelopers.

[Michael] I can certainly recommend itaswell,becauseitisapowerfulandcon-venienttool!

Page 5: NEWS • TECHNOLOGY • TRICKS • INTERVIEW MDT Magazine · • MUnit 3 Support plug-in– a mecha-nism that allows for writing and run-ning tests for applications written in Magik

TRICKSwww.mdt.net

iSSUe 4 · Spring 2012 aSteC, poland 5

Magik Tricks

I have been working for ASTEC for around six years. Being involved in several different projects gave me an opportunity to broaden my knowledge and learn many new things. In my work very of-ten not only programming skills but also some “magic tricks” were needed in order to success-fully complete tasks I was given. Now, I would like to share with you a handful of such tricks that I have learned and gathered over the years. Some of them may seem pretty trivial but I hope they will be useful to you as they have been to me.

by Michał Bielewicz, Software Developer, ASTEC 1. How to draw a trail on the map using a given (pseudo) geometry?

Thistrickcanbeusedtoobservetheexactlocationofwantedgeometryonthemap.Hint:Donotforgettosettherightvaluefor!current_coordinate_system!dynamicvariableintheMagikconsole.

_local my_map << my_app.get_service_provider(:map_manager). current_map

_local pg << pseudo_point.new_at(coordinate.new(1, 1))

my_map.set_trail_from_geometry(pg)

2. How to fetch a record that is currently selected on the map?

Firstgetasetofcurrentlyselectedgeometriesonthemap:

1.Usingadatabus

current_map_selection << my_app.databus.request_data( :map_selection)[2]

2.Directlyfromthemap

_local my_map << my_app.get_service_provider(:map_manager). current_map

current_map_selection << my_map.current_selection

Secondwetakethefirstgeometryfromthesetandfetchtherecordthatitbe-longsto.

my_rec << current_map_selection.an_element().rwo

3. How to log in as a different user without the need of closing the ap-plication first?gis_program_manager.authorisation_view.login(“login”, “pass”)

5. How to force messages to reload?

Itisusefulwhenwechangemessagesinmanymodulesandwanttoseetheresultwithouttheneedtocompileeachmodule’smessagesseparately.

sw_module_manager.register_messages()

4. How to measure the length of the geometry on the map?

Thereturnedvalueisexpressedinunitsdefinedinapplication’scoordinatesys-temorindatabaseunitsif!current_coordinate_system!isnotset.

_local my_map << app.plugin(:maps).current_map

_local current_sel << my_map.current_selection.an_element().rwo

_local unit << !current_coordinate_system!.default(current_sel. source_view.world).unit_name

write(current_sel.route.line_length, %space, unit.write_string)

Example Console Output:105.3 m

Page 6: NEWS • TECHNOLOGY • TRICKS • INTERVIEW MDT Magazine · • MUnit 3 Support plug-in– a mecha-nism that allows for writing and run-ning tests for applications written in Magik

TRICKS

6 Mdt Magazine - Magazine for SMallworld™ Magik Software developerS

7. How to speed up the network analyzer?

Disable thedrawingofvisitedgeometries to speedup theanalyzing process.Where_self is a custom plugin thatmakes use ofnetwork_analysis_component hold in:network_analyserslot

11. How to remove a message that is already defined in the image?

This trick isextremelyusefulwhensubmittingchangesaspatches.

6. How to check which method displayed a pop-up?

Example:messagewindowpopsupintheapplication.Youwouldliketoknowwhatpartofcodeisresponsiblefordis-playingthismessageandwhatwastheexecutionflowthatledtothispop-up.

8. How to write out elements from any container with a given separator?

9. How to use the evaluate() method?

12. How to check RGB components for a specific color?

13. How to debug a method without having its source code?

10. How to use magik_text to define any procedure on-the-fly?

_self.network_analyser.engine.remove_dependent( _self.network_analyser, :link_encountered)

read_message_patch(:my_exemplar)

$

:my_useless_message :|REMOVE|

$

thread.named(:events).traceback()

_local numbers << {1,2,3}

write(write_string_with_separator(numbers, %-))

Console Output: 1-2-3

_local sum << “9+1”

sum.evaluate()

Console Output: 10

colour.called(:indigo)

Console Output:

colour(R=0.1175,G=0.000,B=0.3076)

It sometimes happens that we have no source code for amethodweareinterestedin.Sohowcanweaddanewfunc-tionalitytothismethodthatcouldbeusefulduringdebug-ging?I’velearnttherearetwoways:

1. Redefining the method:

Firstcreateacopyoftheoriginalmethod:

orig_meth << basic_window.method(:show_alert). value

Writeyourownbodyforthismethod

_method basic_window.show_alert(message, _optional yes_message, no_message, default, mode)

##Redefinedmethod

!traceback!(!terminal!)

_endmethod

$

Whenthedebuggingisfinishedrestoretheoriginalmethod

basic_window.method(:show_alert).value << orig_method

Theonlydisadvantageofthisapproachisthattheoriginalfunctionalitygetsomittedforthesakeofdebugging.

2. Defining a synonym for the method:

Clonetheoriginalmethodandsaveitunderadifferentname

basic_window.define_method_synonym( :|clone_show_alert()|, :|show_alert()|)

Writeyourownbodyandcalltheclonedmethod.

_method basic_window.show_alert(message, _optional yes_message, no_message, default, mode)

##Redefinedmethodwithpreserved ## original functionality

!traceback!(!terminal!)

_return self.clone_show_alert(message, yes_message, no_message, default, mode)

_endmethod

$

In result the functionality of basic_window.show_alert() method will stay the same and you will beable to modify its contents. In those two approaches !traceback!(!terminal!)hasbeenaddedinordertodisplaytheexecutionflowthathasledtothealertwindow.

_local mt << magik_text.new()

mt.add_last(“_proc (num)”)

mt.add_last(“_return num * num”)

mt.add_last(“_endproc”)

_local p2 << mt.evaluate()

write( p2(3) )

Console Output: 9

Page 7: NEWS • TECHNOLOGY • TRICKS • INTERVIEW MDT Magazine · • MUnit 3 Support plug-in– a mecha-nism that allows for writing and run-ning tests for applications written in Magik

Training Feedback

[ASTEC] Hello Jun. You work for GE Energy and I am sure you have attended a great deal of training sessions for vari-ous purposes. Do you consider this kind of teachings effective?

[Jun]Definitely.Whenablockoftimeisallocatedfortrainingonaspecificsubject,andwithanexperiencedandknowledge-abletrainer,itisveryeffective.Withsomepreparationbeforehandandsupportafterthetraining,thelearningcanbeveryef-ficientandproductive.

[ASTEC] You used MDT for some time before you attended the training. What was your attitude towards it?

[Jun]IstarteddoingMagikdevelopmentusingEmacstwoyearsagowhenIjoinedGE.IwasalreadyfamiliarwithEmacsatthetime.Emacshadbeenextensivelyex-tendedandenhancedforMagikdevelop-mentandwasthedefaulttooltouse.

When I started using Eclipse for Javadevelopment, I realized the benefit ofEclipse,andstartedtothinkthatIcouldalsobenefitfromusingMDTandhavingonetoolforbothJavaandMagikdevel-opment. I downloaded it and attemptedtoconfigureitforacoupleoftimes,butitwasnot very successful. I tried to getsomehelpbutatthatstage,Ididnotre-allyhavetherightconceptsinmind,suchassessionsandruntimes,toasktherightquestionsandgetusefulanswers.

[ASTEC] What was the most helpful part of it? Did you like the training?

[Jun]Yes.Ienjoyedthetraining.Themosthelpfulpartwaslearninghowtoconfig-uretheruntimesandsessions,gettingtounderstand the three different kinds ofsession and also how environment vari-ablesconfiguredatdifferentplacesworktogether.AfterthetrainingIwasabletouseMDTfordevelopmentwork.Ifound

Editing: Błażej Sytar, Sales & Support Leader

Publisher ASTEC Sp. z o.o. © 2012 ASTEC Sp. z o.o. All rights reserved.

MDT is a product of

Visit our website:www.mdt.net

ul. Piaskowa 14 PL 65-209 Zielona GóraPhone: +48 68 32 980 00 Fax: +48 68 32 980 [email protected] www.astec.net

Trademarks and registered trademarks. MDT Magik Development Tools is a registered trademark of ASTEC Sp. z o.o. Smallworld is a registered trademark of General Electric Company. Eclipse is a registered trademark of Eclipse Foundation, Inc. Other company or product names mentioned in this publication may be trademarks or registered trademarks of their respective companies.

www.mdt.net INTERVIEW

iSSUe 4 · Spring 2012 aSteC, poland 7

MDT Magazine

An interview with Dr. Jun Gang from GE Energy, Cambridge. She was one of the participants of a training session which was organized in UK in Summer of 2011. Now she agrees to answer a couple of questions and recall her impressions from the training.

If you wish to learn more about the training contents, availability or cost write to us at [email protected]. Allow yourself to be better, get your training from the experts!

theworkbook very useful with step-by-stepguidesandscreenshots.

[ASTEC] The trainer’s personality also plays an important role. How was the communication and atmosphere in the class?

[Jun]Thetrainerwasveryknowledgeableandattentive,andtheatmospherewasin-teractive.

[ASTEC] Do you consider the training a must-have to get started with MDT or rather a useful addition for organizing and extending your skill?

[Jun] I think attending the trainingwasamust-haveforme,asIwouldnothavebeen able to start developingMagik inMDTwithoutit.

[ASTEC] After this time that you have spent working with MDT do you see yourselves going back to Emacs?

[Jun] After my MDT training, I usedMDTformostofmyMagikdevelopmentwork.MDToffers(moreorless)thesamebenefit as the Eclipse workbench, suchas code assistants, perspectives for cod-ing and debugging, easy access to files,variousplugins,runningmultiplesessionsandsoon.The“GISCommandsManag-ing”perspectiveshowsallcommandhis-torygroupedforallsessionsused,whichisveryusefulindeed.Throughthe“Hier-archyView”Icanaccessthefilesdefiningexemplarsbyasimplemouseclick.Build-ingtheimageisalsostraightforwardwiththe“ExternalTools”menuoption.

I used to go back to Emacs to createpatchesandchangenotes.However,IwasrecentlymadeawareofthenewPatchingSystempluginwhichallowsmetodothisthroughMDT,sonowIrarelyhavearea-sontogobacktoEmacs.

Jun GanghasaPhDinPhysicalChemis-try. She spent thepast12yearswork-ingonsoftwarede-velopment and hasused various toolsand developmentenvironments, for

example, Delphi, JBuilder, Emacs,Eclipse. Jun started learning andworkingwithMagik two years agowhenshejoinedGESmallworld.

Page 8: NEWS • TECHNOLOGY • TRICKS • INTERVIEW MDT Magazine · • MUnit 3 Support plug-in– a mecha-nism that allows for writing and run-ning tests for applications written in Magik

powerful solutions through advanced technologies.

as a strong ge energy authorized Solutions provider we offer software development services for Smallworld™ users from utilities and telecommunication industry sectors.

www.astec.net