1 / 81

Software development : Objectives

Introduction The problem Error recovery techniques . A complement for the Hardware. Satisfy the ever growing requirements of the customers. SOFTWARE QUALITY . Software development : Objectives. Evlolution of the goals. Introduction The problem Error recovery techniques .

lewis
Télécharger la présentation

Software development : Objectives

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction Theproblem Error recoverytechniques... • A complementforthe Hardware • Satisfytheevergrowingrequirements of thecustomers • SOFTWARE QUALITY Software development: Objectives Evlolution of thegoals

  2. Introduction Theproblem Error recoverytechniques... Software Quality Goal:toobtainhighquality software ¿Software Quality? Factors: • Usability • Reliability • Correction • Robustness • Speed • Satisfaction of requirements • Others

  3. Introduction Theproblem Error recoverytechniques... Software Robustness “Software robustness can be defined as the degree to which a system or component can function correctly in the presence of invalid inputs or stressful environmental conditions” • Depends of: • Technologicalresources • Programmer’sskills. • Technologicalresources in OOP? Exceptionhandlingmechanisms.

  4. Introduction Theproblem Error recoverytechniques... ExceptionHandlingmechanism • Error recoverygoal: Maintaintheconsistency of thesystem • Itcoverspart of thetasksthatmustbehandled.... ... butdelegatesotherstodevelopers (disallowing). • some of these tasks can be implemented automatically by means of the information contained in the model, savingworktodevelopers. • Makingeasierreadibility and themaintenance of thecodeavoidingtheimplementation of proceessesnotstraigthmodel-related. ExceptionHandling

  5. Introduction Theproblem Error recoverytechniques... Thesis Weconsider: The modern object-oriented languages can be extended with a new semantic layer that complements current exception-handling mechanisms, simplifying the implementation of these processes purely oriented to consistency maintenance in the presence of exceptional scenarios.

  6. Introduction Theproblem Error recoverytechniques... Goals Tocomplement OO paradignwithmechanismstomakemaintenance of consistencyeasier in thosescenarioswherethat can be done automatically. Considerations: • Wewanttodeveloper a practicalsolutionfor usual problems. • Realisticdevelopmentscompliant. • Legacycode compatible • Languagespecificationsmustberespected. • Maintenable • Withrealistic and feasible performance rates.

  7. Contents Introduction Theproblem Error recoverytechniques Error recoverysolutions Ourproposal Design Ariadna Evaluation of theresults Conclusions

  8. Introduction Theproblem Error recoverytechniques... Robustness. Goal: robust software. Ideally...: Avoidtheocurrence of an error in thesystem • Strict Software Correctiontechniques • Strict control of the software developmentprocess. • Others. Drawbacks: • Human factor • Notevery error comes from a problem of thesystem. … Experienceevidencesthatcompletley error-free software cannotbedeveloperd … (Bertrand Meyer) Robustnesswarranty: In case an error happens, itmustnotsuppouse a fail in thesystem.

  9. Introduction Theproblem Error recoverytechniques... Robustness Whatmustbecoveredbyguarantee? • No information of theuser can belost. A textproccessor, beforeexitingabnormally, savesthedocument. • Theconsistency of thesystemmustbemaintained in presence of errors. Ifan error occurswhileweempty a waterreservoir (thelockgateis open), Shouldthelockgateremain open? • E Ifnone of themcouldbeachieved, a programmedexitof thesystemmustbe done. Whenthe error cannotbedesallowed, theend of theprocesssmustbefaced as organized as possible.

  10. Introduction Theproblem Error recoverytechniques... Currentscenary: Error recovery

  11. detection • localization • disallowing • detection • localization • ¿disallowing? Introduction Theproblem Error recoverytechniques... What do languagescover? Languagewithoutexceptions Languagewithexceptions C,Basic,LISP,ensamblador,etc. Error eventrutine Example in C: Ternaryrelationship #include <signal.h> voidterminationhandler (intsignum) { structtempfile p; for (p = temp file list; p; p = p−>next) unlink (p−>name);} intmain (void) { ... if (signal (SIGINT, terminationhandler) == SIG IGN) signal (SIGINT, SIG IGN); if (signal (SIGHUP, terminationhandler) == SIG IGN) signal (SIGHUP, SIG IGN); … }

  12. Introduction Theproblem Error recoverytechniques... DisallowingwithExceptionHandlingmechanism Options Ignore Determinados tipos de error sujetos a condiciones transitorias. try { while ( <n−times condition> ) { try { doAnything(); <delay n seconds> break; } catch ( MyExpectedException e){ //Nothingto do ... } } } try { … doAnything(); … } catch ( AnyException) { ¿…? } Es posible ignorar los errores en métodos y subsistemas no ligados al objetivo principal del sistema. try { //The method whose errors are not important ... doAnything() } catch {AnyException e} { //Nothingto do... <log message ...> } Ignore it Retry undo Retry Recoverability of the State/consistency Undo New consistentstate New consistentstate

  13. Introduction Theproblem Error recoverytechniques... Recoverability?

  14. Introduction Theproblem Error recoverytechniques... Limitationsof theExceptionHandlingmechanism classCounter { privateintcount; public void inc(){count++;} public void reset(){count=0;} } try { … counter.inc(); anotherObject.methodThatFails(); //salta una excepción… … } catch ( AnyException) { How can decrease the counter? } Vector rotated = new Vector(); try { … //Se añade la figura rotada al vector paint.rotate(rotated); … … } catch ( AnyException) { Which was each figure original position? } Itguaranteesthatthecode in the catch block willbeexecuted: • Doesnotguaranteetherestoration of theconsistency • Don’tknowwhatshouldberestored. • Sometimesweknow, butitcannotbe done • Sometimesit can be done, butwe do notknowhow try { … doAnything(); doAnotherThing(); … doTheLastThing(); } catch ( AnyException) { ¿…? } • try • { • … • … • paint.rotate(); • … • … • } • catch ( AnyException) • { • ¿Which figures haverotated? • }

  15. Introduction Theproblem Error recoverytechniques... Limitationsof theExceptionHandlingmechanism Problem: ExceptionHandlingmechanisms do notcovertheneedings of thedevelopertoreachmodel’srecoverabilitywhenan error occurrs. (error recovery) It forces the developers to implemen customized solutions fot these scenarios. All of them can be solved by means of design patterns But It forces to apply them for each scenary without reusing it.

  16. Contents Introduction Theproblem Error recoverytechniques Error recoverysolutions Ourproposal Design Ariadna Evaluation of theresults Conclusions

  17. Theproblem Error recoverytechniques... Error recoverysolutions Error recoverytechniques Clasification:

  18. Theproblem Error recoverytechniques... Error recoverysolutions Backward Error Recovery Theyassumethatthelaststate of thesystembeforethecurrentoperationwasconsistent. So, they try toreturntothisstate. Generally, they are basedontheregister of thechangesoccurred in thesystem. Applicability: • Faulttolerance • Mobile agents. • Extension of ExceptionHandlingmechanism Threestrategiesplus adaptations: • Checkpointing • Audit Trial • Recovery Cache

  19. Theproblem Error recoverytechniques... Error recoverysolutions Backward Error Recovery • Checkpointing • RecoveryPoints • Generation • Random • Synchronize • Hybridsolutions • Highmemoryusage. • Audit Trial • Onlythechanges are stored. • Less heavy but more complicatedimplementation • Recovery Caché • Hybridsolution.

  20. Theproblem Error recoverytechniques... Error recoverysolutions Forward Error Recovery Thecurrentstateismodifiedtoreach a new consistentstate. Most popular: • Exceptionhandlingtechniques • Compensationstrategies • Theconsistency of thesystemdoesnotdependonlyfromtheinternalmodelstate.

  21. Theproblem Error recoverytechniques... Error recoverysolutions Reversion N.V. Tikhomirovafor OO. “Restoringonlythechangesoccurred in themodelisnotenoughtoundothechanges in the global system” Someactions can haveeffectsout of thescope of theobjectmodel.

  22. Theproblem Error recoverytechniques... Error recoverysolutions Loggingtechniques BER & FER related Mostsolutions are closeto:

  23. Presentation Introduction Theproblem Error recoverytechniques Error recoverysolutions Ourproposal Design Ariadna Evaluation of theresults Conclusions

  24. Error recoverytechniques... Error recoverysolutions Ourproposal Error recoverysolutions Differentapproaches • Integrated in theprogramminglanguages. • Basedontheextension of the virtual machine • Basedondesignpatterns. • Basedon meta-programming • Basedonframeworks • Basedonexternallibrariesortransactionalproducts. • Hybrids.

  25. Contents Introduction Theproblem Error recoverytechniques Error recoverysolutions Ourproposal Design Ariadna Evaluation of theresults Conclusions

  26. Error recoverysolutions Ourproposal Design Ourproposal Wepretend: • Toextend OO languageswith a recoverabilitymechanismsthatcomplementsExceptionHandlingmechanism, covering: • Makeeasiertomaintaintheconsistency of thesystem, notonly in theinternalobjectmodel. • Respectinglanguages’ specifications (No more new languages, please!) • Avoidthemisuse of theelementsof thelanguage. • Avoidthedetermination of thedesignas possible. • Complexityfromthepoint of thedevelopermustbedecreased.

  27. Error recoverysolutions Ourproposal Design Concept of Reconstructor A reconstructor is an element specialized in restoring the consistency of a specific part of the model. It can do it restoring the previous state or compensating some actions whose effects fall out beyond the scope of the model. Whenan error occurs, thereconstructormustdisallowtheeffect of theactionsexecutedfromthebeginning of theinterruptedoperation. • Restoringthepreviuosstate • Compensatinganyexecuted compensable action

  28. Error recoverysolutions Ourproposal Design Reconstructors’ workingway • each reconstructor can disallow one specific change that has happened during an operation execution, so a reconstructor will be created each time a reconstructable action is executed. • As they are created, the reconstructors are stacked in the reconstruction path • Reconstruction paths are organized in reconstructioncontexts. • Theoperation can: • Finishsuccessfully, so thereconstructioncontext can bediscarded • Be interruptedbyanexception, so theconsistencyisrestoredexecutingallthereconstructors in thecontextin the reverse order from that in which they were created

  29. Error recoverysolutions Ourproposal Design Implicitreconstructors • Implicit reconstructors apply an audit trial strategy (39) to store any change produced in a reconstructable attribute (that is, any attribute whose state affects the consistency of the system). • Any time that one of these attributes is modified, an implicit reconstructor specialized in the task of restoring the attribute to its previous value is generated and added to the current context’s reconstruction path ReconstructionPath … object.setA(5); object.setA(6); throwException … Set A=5 Set A=0

  30. Error recoverysolutions Ourproposal Design Explicitreconstructors • Specialized in the execution of compensation methods • Explicit reconstructors are expected to restore not the state but the consistency of the system, disallowing the actions whose effects fall beyond the object model compromising global consistency (compensable actions). • An explicit reconstructor is divided into two parts: • The compensation method, which must be implemented by the developer. • A specialized object whose task consists in the invocation of the compensation method, managing the parameters it needs to do its work.

  31. Error recoverysolutions Ourproposal Design Explicitreconstructors compensatePrepareDeliverycompensatesprepareDelivery, but… Whoinvokesthismethod? Compensationmethod: Handmadecustomizedbythedeveloper Invocationlogic: Automaticallymanaged..

  32. Error recoverysolutions Ourproposal Design Sendingparameterstoreconstructors Compensationbasedsolutionfor prepare delivery can beimproved. Ifwewanttorestorthe film toits original place... Whichwas? Theinformationthatthecompensationmethdosneedstoundotheactionmadebythe compensable methodsisat leastthesamethatthelatterreceived [Cri79] So, theexplicitreconstructorneedstoreceive at leastthesameparametersthatthecompelsablemethodreceived.

  33. Error recoverysolutions Ourproposal Design Determinedreconstructions Reconstructionpolicy can depend of manyfactorsbeyondthe original parameters set, likethe time. Example: Reconstruction process where switching off a biological samples fridge is disallowed Exception • Reconstruction • Iflessthan 30 minutes • Startagain • Else, • Discardsamples • Notify

  34. Error recoverysolutions Ourproposal Design Determinedreconstructions • We refer to those parameters that the compensation method needs beyond the ones received by its compensable method as additional parameters.

  35. Error recoverysolutions Ourproposal Design ReconstructionContexts … Op1; Op2; <createcontext> … … … If ( everything ok?) <discardcontext> else <reconstructcontext> … Noteveryoperationmustbereconstructable. Tiillnow, OneonlyReconstructionPath Complete reconstructions Weneedtodelimitthescope of thereconstruction -> Contexts A Context per reconstructionpath. Everyreconstructorwillberelatedto a context Reconstructableoperations

  36. Error recoverysolutions Ourproposal Design ReconstructionContexts–Simple Contexts Explicitopening and closing Closingthecontext: • Reconstruction • Wefirereconsructors in the reverse ordertheywerecreated. • Wedestroythem once executed • Discardingthecontext • Operationfinishedsuccessfully. • Fullyintegratedwiththe try/catch/finally block.

  37. int XXX = 8; <new Context> … object.setXXX(7) … <new Context> … object.setXXX(5); … object.setXXX(3); … <context closing> … object.m(); … Object.setXXX(2); … Context n Context N R Context N Set XXX=8 Context N+1 InvokecompensateM SetXXX=8 Set XXX=3 Set XXX=7 Context N Set XXX=5 InvokecompensateM D Set XXX=3 Set XXX=8 FromContext N+1 Set XXX=7 Set XXX=5 InvokecompensateM Set XXX=3 Error recoverysolutions Ourproposal Design Nestedcontexts Whathappensifwecreate a contextinsideanopenedone? Thesecondisnestedtothefirst. • Ifthesubcontextisreconstructed→ Itsreconstructors are fired • Ifitisdiscarded→ Itsreconstructors are inserted in itsparent’sreconstructionpath Context n+1

  38. int XXX = 8; <new Context> … object.setXXX(7) … <new Context> … object.setXXX(5); … object.setXXX(3); … <context closing> … object.m(); … Object.setXXX(2); … Context n Context N R Context N Set XXX=8 Context N+1 InvokecompensateM SetXXX=8 Set XXX=3 Set XXX=7 Context N Set XXX=5 InvokecompensateM Set XXX=3 Error recoverysolutions Ourproposal Design Independentcontexts Sometimes, somecontexts are notinterestingforthe global reconstructionformanyreasons: They are out of date (Ej, disallowingthelastprintled line in a printermakessenceonlyinmediatelyafterprintingit), unimportant, others. . Context n+1 D Set XXX=8 InvokecompensateM Set XXX=3

  39. private int a = 5; public void execute(…) { … object.setA(6); … <context halting> … object.setA(9); … <context resume> … object.setA(8); … <exception raising> } 1 2 3 4 1 2 3 4 Set A = 9 ignored reconstructor Ignored reconstructor Set A = 5 Set A = 5 Set A = 5 Error recoverysolutions Ourproposal Design Suspendingcontexts Independentcontextsallowtocreateparenthesis in theReconstructionPath, buttheycreate and discardreconstructors. A suspended contextdoesnotallow new reconstructorsuntilitisresumed. ReconstructorA=6 isnotadded

  40. Contents Introduction Theproblem Error recoverytechniques Error recoverysolutions Ourproposal Design Ariadna Evaluation of theresults Conclusions

  41. Ourproposal Design Ariadna Target platforms OO Industrynowadays Lowlevel Widestscope General purpose Agile development, scripting, quickprototyping

  42. Ourproposal Design Ariadna Architecture of thesolution • None of theknownalternativessatisfiesalltherequirements. • Combination of: • Framework • Reflectivity • @OP, integratedthroughannotations.

  43. Ourproposal Design Ariadna Implicitreconstructors Relatedtoanattribute Everytimeanattributeismodifiedusingsetter A new reconstructoriscreated. Theattributeisreconstructable

  44. Ourproposal Design Ariadna Explicitreconstructors Basedon • Thedefinition of a compensationmethod • Nameconvention Thename of thecompensationmethodmustbe preceded by __ • Activation of thereconstructorusingtheannotationreconstructor

  45. Ourproposal Design Ariadna Explicitreconstructors: Sendingadditionalinfo Twotasks:

  46. Ourproposal Design Ariadna Design Implicitreconstructors • Memento + Command • In thereconstructableobject, methodreconstruct(equiv.execute) Explicitreconstructors • Command. publicvoidreconstruct(ImplicitReconstructor reconstructor) throwsAnyException { <Sets the value received into the reconstructor> } publicreconstructableMethod(param1,param2, ... ,paramN) { <new ExplicitReconstructor( this, ”reconstructableMethod”, param1, ... , paramN )> ... }

  47. Ourproposal Design Ariadna Management Creation of reconstructios Factorypattern • Automaticinitialization of theinstances • Itmanagestheinsertion in theReconstructionPath. Contextmanagement Done bythemanagementclasses of theframework Contexthierarchy

  48. Contents Introduction Theproblem Error recoverytechniques Error recoverysolutions Ourproposal Design Ariadna Evaluation of theresults Conclusions

  49. Design Ariadna Evaluation of theresults Ariadna PreprocessingtoolovertheframeworkRecoderforstaticmetaprogramming in Java: • Analysesthecode and return a kind of AST • Allowthemodification of the AST • Creates new version of codefromthemodified AST Ariadna = codeenricher + framework.

More Related