Abstract
Go is a contemporary language aiming to support OO programming where the core OO feature, inheritance, is intentionally excluded. Go uses the concepts of embedding and interface to provide its object model. To understand the design of Go and its consequences, we develop a simple Go-like model language, mini-Go, which abstracts Go’s interface-based OO features. The formal defined type system and semantics are given. In addition, we propose an even simpler language \(\mu \)Go where the feature of pointers is further removed. We demonstrate that \(\mu \)Go is as expressive in OO as the original language with pointers, which provides a uniform model for Go-like OO programming. We investigate the OO model of the Go-like languages using \(\mu \)Go in detail, point out that the absence of open recursion brings difficulties in OO design, and then propose a novel design pattern to mimic the open recursion feature to overcome the difficulties.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-oriented Software. Pearson Education, Upper Saddle River (1994)
Tempero, E., Boyland, J., Melton, H.: How do Java programs use inheritance? an empirical study of inheritance in Java software. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 667–691. Springer, Heidelberg (2008)
The Go Authors: The Go Programming Language Specification, 1.4.2 edn., November 2014
Pike, R.: Go at Google: Language design in the service of software engineering
The Go Authors: The Go Programming Language: FAQ, 1.4.2 edn., November 2014
Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)
Liu, H., Qiu, Z.: Go model and object oriented programming. Technical report, School of Mathematical Science, Peking University (2015)
Plotkin, G.D.: A structural approach to operational semantics. J. Log. Algebraic Program. 60–61, 17–139 (2004)
Schmager, F., Cameron, N., Noble, J.: GoHotDraw: evaluating the Go programming language with design patterns. In: Evaluation and Usability of Programming Languages and Tools, p. 10. ACM (2010)
Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst. 23(3), 396–450 (2001)
Bierman, G.M., Parkinson, M.J., Pitts, A.M.: MJ: an imperative core calculus for Java and Java with effects. Technical report 563, University of Cambridge Computer Laboratory, April 2003
Cook, W.R., Hill, W., Canning, P.S.: Inheritance is not subtyping. In: Proceedings of the 17th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1990, pp. 125–135. ACM, New York (1990)
Cook, W.R.: On understanding data abstraction, revisited. SIGPLAN Not. 44(10), 557–572 (2009)
Viljamaa, P.: Client-specified self. In: Pattern Languages Of Program Design, pp. 495–504. ACM Press/Addison-Wesley Publishing Co., New York (1995)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2015 Springer International Publishing Switzerland
About this paper
Cite this paper
Liu, H., Qiu, Z. (2015). Go Model and Object Oriented Programming. In: Pardo, A., Swierstra, S. (eds) Programming Languages. SBLP 2015. Lecture Notes in Computer Science(), vol 9325. Springer, Cham. https://doi.org/10.1007/978-3-319-24012-1_5
Download citation
DOI: https://doi.org/10.1007/978-3-319-24012-1_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-24011-4
Online ISBN: 978-3-319-24012-1
eBook Packages: Computer ScienceComputer Science (R0)