[Progress Communities] [Progress OpenEdge ABL] Forum Post: RE: Functional programming in ABL

Status
Not open for further replies.
A

agent_008_nl

Guest
I have some experience with functional programming in javascript and elixir (a language implemented on top of erlang). About two years ago I have been refactoring a large OO ABL codebase, during a whole year, where maintainance was a problem thanks a lot of problems, among which the over-enthousiast implementation of OO patterns and inheritance. I have learned to appreciate "referential transparancy", see f.e. gist.github.com/.../1786462 and github.com/.../ch03.md . You can send functions around contained in objects in ABL. I have made extensive use of parameter objects that look like the following one: /*------------------------------------------------------------------------ File : SomeParameter Purpose : Syntax : Description : Author(s) : Stefan Created : Notes : ----------------------------------------------------------------------*/ using Common.Server.CommonRequest from propath. using Common.Server.SomeHelper from propath. using Basics.Server.DataAccess.daWhatever from propath. block-level on error undo, throw. class Somewhere.Common.SomeParameter: define public property CurrentRequest as CommonRequest no-undo get. private set. define public property DaX as daWhatever no-undo get. private set. define public property Helper as SomeHelper no-undo get. private set. constructor public SomeParameter(curRequest as CommonRequest): assign Helper = new SomeHelper() CurrentRequest = curRequest DaX = new daWhatever() . end constructor. destructor public DebetCreditParameter(): delete object DaX no-error. delete object Helper no-error. error-status:error = false. end destructor. end class. Using this I have eliminated almost all inheritance and the use of OO patterns relying on it. The team was happy with the changes. See the recommendation I got on linkedin by the product owner: "[..] This has greatly improved the stability and maintainability of our product. The customer now experiences our product as very stable." (www.linkedin.com/in/stefanhoutzager). -- Kind regards, Stefan Houtzager Houtzager ICT consultancy & development

Continue reading...
 
Status
Not open for further replies.
Top