Abstract
Behavioral Programming (BP) is a modelling and programming technique proposed for specifying and for implementing complex reactive systems. While effective, we report on a weakness that stems from the verbosity and from the complexity of the programming constructs in BP. Our analysis, described in this paper, shows that developers who work with BP use specific patterns that allow them to control the complexity of their specification. Thus, the main contribution of this paper is a set of specification constructs that represent those patterns. We report on the design of the new idioms, termed structured constructs for behavioral programming and on an empirical evaluation in a controlled experiment that proved their effectiveness. In particular, the experiment examined the comprehensibility differences between behavioral specifications with non-structured BP programming idioms and with the structured ones. The results indicate that the new structures improve the comprehension of the behavioral specification.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
The experiment design and execution was also approved by an ethical committee.
- 2.
https://bp-new-blockly-exp-2.appspot.com/static/apps/mazeBP/index.html?version=1(version=2). Designed to work with the Firefox web browser.
- 3.
The questionnaires can be found in https://tinyurl.com/h3bzphs, https://tinyurl.com/zah4ap3.
References
Hendrix, T.D., Cross II, J.H., Maghsoodloo, S., McKinney, M.L.: Do visualizations improve program comprehensibility? experiments with control structure diagrams for Java. ACM SIGCSE Bull. 32(1), 382–386 (2000)
Briand, L.C., Bunse, C., Daly, J.W., Differding, C.: An experimental comparison of the maintainability of object-oriented and structured design documents. Empirical Softw. Eng. 2(3), 291–312 (1997)
Feo, J.T.: A Comparative Study of Parallel Programming Languages: The Salishan Problems. Elsevier, North Holland (2014)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns. Addison-Wesley, Boston (1995)
Beck, K., Crocker, R., Meszaros, G., Vlissides, J., Coplien, J.O., Dominick, L., Paulisch, F.: Industrial experience with design patterns. In: Proceedings of the 18th International Conference on Software Engineering (1996)
Budinsky, F.J., Finnie, M.A., Vlissides, J.M., Yu, P.S.: Automatic code generation from design patterns. IBM Syst. J. 35(2), 151–171 (1996)
Buschmann, F., Meunier, R., Rohnert, H., Sommerlad, P., Stal, M.: Pattern-Oriented Software Architecture: A System of Patterns. Wiley, New York (1996)
Florijn, G., Meijers, M., Winsen, P.: Tool support for object-oriented patterns. In: Akşit, M., Matsuoka, S. (eds.) ECOOP 1997. LNCS, vol. 1241, pp. 472–495. Springer, Heidelberg (1997). doi:10.1007/BFb0053391
Prechelt, L., Unger, B., Philippsen, M., Tichy, W.: Two controlled experiments assessing the usefulness of design pattern information during program maintenance. IEEE Trans. Software Eng. 28(6), 595–606 (2002)
Prechelt, L., Unger, B., Tichy, W.F., Brossler, P., Votta, L.G.: A controlled experiment in maintenance: comparing design patterns to simpler solutions. IEEE Trans. Softw. Eng. 27(12), 1134–1144 (2001)
Harel, D., Marron, A., Weiss, G.: Behavioral programming. Commun. ACM 55(7), 90–100 (2012)
Damm, W., Harel, D.: LSCs: breathing life into message sequence charts. J. Formal Methods Syst. Des. 19(1), 45–80 (2001)
Harel, D., Marelly, R.: Come, Let’s Play: Scenario-Based Programming Using LSCs and the Play-Engine. Springer, Heidelberg (2003)
Harel, D., Marron, A., Weiss, G.: Programming coordinated behavior in Java. In: D’Hondt, T. (ed.) ECOOP 2010. LNCS, vol. 6183, pp. 250–274. Springer, Heidelberg (2010). doi:10.1007/978-3-642-14107-2_12
Ashrov, A., Marron, A., Weiss, G., Wiener, G.: A use-case for behavioral programming: an architecture in JavaScript and Blockly for interactive applications with cross-cutting scenarios. Sci. Comput. Program. 98(Part 2), 268–292 (2015)
Resnick, M., Maloney, J., Monroy-Hernández, A., Rusk, N., Eastmond, E., Brennan, K., Millner, A., Rosenbaum, E., Silver, J., Silverman, B., et al.: Scratch: Programming for all. Comm. ACM 52(11), 60–67 (2009)
Maoz, S., Harel, D., Kleinbort, A.: A compiler for multi-modal scenarios: transforming LSCs into AspectJ. ACM Trans. Softw. Eng. Methodol. (TOSEM) 20(4) (2011). Article 18
Wand, Y., Weber, R.: On the ontological expressiveness of information systems analysis and design grammars. Inform. Syst. J. 3, 217–237 (1993)
Bajaj, A., Rockwell, S.: COGEVAL: applying cognitive theories to evaluate conceptual models. In: Advanced Topics in Database Research, pp. 255–282 (2005)
Acknowledgement
This research was partially supported by the Israel Science Foundation, the Philip M. Klutznick Research Fund, and the Dora Joachimowicz research grant.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendix
Appendix
While the focus of this work is on empirical evaluation of the idioms, in terms of their usability to programmers, we hereby provide a proof for the expressiveness equivalence of the two sets of idioms.
Claim 1:
Every b-thread developed with the structured idioms can be translated to a semantically equivalent b-thread that applies only the bSync idiom using If last_event==x {} and break .
Proof:
By structural induction.
Induction base: if there is no Break-upon or Blocking structures in the program, replace each request(x) and each wait-for(y) with, respectively, a bSync(x,none,none) and a bSync(none,y,none) .
Induction step: Assume, by induction, that the claim is true for programs with at most \( n \) levels of nesting of the Break-upon or Blocking structures. Given a program with \( n + 1 \) levels of nesting we can replace each block of maximal nesting level as follows. If the nesting level of the block is less than \( n + 1 \), it can be replaced by a code that uses only bSync by the induction assumption. For a block of the form blocking(x){ P } , where \( P \) is some code with \( n \) levels of nesting, let \( P^{\prime} \) be a code, given by the induction assumption, that is semantically equivalent to \( P \) and uses only the bSync idiom. Let \( P^{\prime\prime} \) be the code obtained by adding \( x \) to the list of blocked events in every bSync in \( P^{\prime}. \) We can now replace the code Blocking ( x ) { P } with \( P^{\prime\prime} \). Similarly, for a block of the form { P } break-upon( x ) , where \( P \) is some code with \( n \) levels of nesting, let \( P^{\prime} \) be a code, given by the induction assumption, that is semantically equivalent to \( P \). Let \( P^{\prime\prime} \) be the code obtained by adding \( x \) to the list of waited-for events in each bSync in \( P^{\prime}. \) Let \( \varvec{label} \) be a name that does not appear as a label in \( P^{\prime\prime} \) and let \( P^{\prime\prime\prime} \) be the code obtained by adding the commands If last_event== x {break \( \varvec{label} \) } after each bSync in \( P^{{\prime \prime }} . \) We can now replace the code { P } break-upon( x ) with \( \varvec{label} \): {\( P^{\prime\prime} \)}. Clearly, the code obtained after all the above replacements contains only bSync , with no application of the structured idioms, and is semantically equivalent to the original code. This proves our claim. ∎
In fact, the above proof follows the way we have implemented the structured idioms.
Another issue that should be clarified in the above proof is the semantics of waiting-for or requesting an event while, at the same time, blocking it. This can be done with bSync , when some event is specified both in the waited-for or in the requested lists and in the blocked list. It can also be done with the structured idioms, when an event is requested or waited-for in the scope where it is specified as blocked or a break upon event. In this case, one must decide which specification takes priority – whether to ignore the blocking or to ignore the request or wait-for. It easy to verify that the above proof is correct as long as we use the same priority order in both the bSync and in the structured idioms.
Claim 2
Every b-thread developed with bSync idiom can be translated to a semantically equivalent b-thread that uses only the structured idioms.
Proof
Replace each bSync( x , y , z ) with blocking( x ){break-upon( y ) {request( x )}} . ∎
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this paper
Cite this paper
Ashrov, A., Gordon, M., Marron, A., Sturm, A., Weiss, G. (2017). Structured Behavioral Programming Idioms. In: Reinhartz-Berger, I., Gulden, J., Nurcan, S., Guédria, W., Bera, P. (eds) Enterprise, Business-Process and Information Systems Modeling. BPMDS EMMSAD 2017 2017. Lecture Notes in Business Information Processing, vol 287. Springer, Cham. https://doi.org/10.1007/978-3-319-59466-8_20
Download citation
DOI: https://doi.org/10.1007/978-3-319-59466-8_20
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-59465-1
Online ISBN: 978-3-319-59466-8
eBook Packages: Business and ManagementBusiness and Management (R0)