Combining functional and object-oriented programming methodologies in a large commercial application
Functional programming concepts of referential transparency and lazy evaluation combine effectively with object oriented encapsulation. We present a design pattern for C++ classes that are logically immutable and fully determined by the parameters of their constructor. Hidden state is used internall...
Uložené v:
| Vydané v: | Proceedings - International Conference on Computer Languages s. 111 - 117 |
|---|---|
| Hlavní autori: | , , , |
| Médium: | Konferenčný príspevok.. Journal Article |
| Jazyk: | English |
| Vydavateľské údaje: |
IEEE
1998
|
| Predmet: | |
| ISBN: | 9780818684548, 0818684542 |
| ISSN: | 1074-8970 |
| On-line prístup: | Získať plný text |
| Tagy: |
Pridať tag
Žiadne tagy, Buďte prvý, kto otaguje tento záznam!
|
| Shrnutí: | Functional programming concepts of referential transparency and lazy evaluation combine effectively with object oriented encapsulation. We present a design pattern for C++ classes that are logically immutable and fully determined by the parameters of their constructor. Hidden state is used internally to cache the results of computation performed in the scope of accessors, giving them lazy semantics. Modifying replicators model change by constructing a new instance without changing the original. Previously computed results are lazily copied via a back reference if the parameters upon which the computation depends have not changed. Since these classes are logically immutable they can be freely shared by reference in complex networks, mitigating the amount of actual copying performed. These techniques realize several advantages-well known to the functional programming community-including suitability for modular reasoning and parallel evaluation. 'Undo' facilities and safe recovery from exceptions can be provided with little extra effort. Examples from a large multi platform biomedical imaging application illustrate the techniques. |
|---|---|
| Bibliografia: | SourceType-Scholarly Journals-2 ObjectType-Feature-2 ObjectType-Conference Paper-1 content type line 23 SourceType-Conference Papers & Proceedings-1 ObjectType-Article-3 |
| ISBN: | 9780818684548 0818684542 |
| ISSN: | 1074-8970 |
| DOI: | 10.1109/ICCL.1998.674162 |

