ABSTRACT
We propose standard object out, an object-oriented analog to the output part of the Unix standard input output library.
Polymorphic Write Streams (PWS) act as architectural adapters between the object-oriented architectural style and the pipes and filters architectural style in the same way that stdio acts as an architectural adapter between the call/return architectural style and the pipes and filters architectural style.
Current object-oriented interfaces to the Unix I/O system mimic their procedural counterparts so closely that they manage to be neither polymorphic nor streaming, at least not for objects. Specifically the object is first converted to a fixed byte-representation by sending it a specific message and the result is then output on the underlying byte stream.
With this approach, these APIs do not allow for streaming behaviour: the entire result has to be constructed in-memory before it can be output. In addition, output of nested structures can require large multiples of time and space compared to the final output size, and fails completely if there are cycles in the object graph. It also does not allow for polymorphic behaviour.
To solve these problems, we propose Polymorphic Write-Streams (PWS). PWSs represent a hierarchy of classes that decouple encoding from specific streaming destinations. Using triple dispatch they provide streaming behaviour and allow each stream to react specifically to each kind of object and vice versa: sharing of common functionality is enabled by chaining messages along the streams’ inheritance chain.
References
- 1994. fwrite(3) BSD Library Functions Manual.Google Scholar
- 2001. PDF Reference: Adobe Portable Document Format Version 1.4 with Cdrom (3rd ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA. Google Scholar
Digital Library
- 2009. printf(3) BSD Library Functions Manual.Google Scholar
- 2012. NeXT Property Lists. https://en.wikipedia.org/wiki/Property_list.Google Scholar
- 2013. Standard for Information Technology--Portable Operating System Interface (POSIX(R)) Base Specifications, Issue 7. IEEE Std 1003.1, 2013 Edition (incorporates IEEE Std 1003.1-2008, and IEEE Std 1003.1- 2008/Cor 1-2013) (April 2013), 1-3906.Google Scholar
- Apple Inc. 2009. Cocoa Reference. http://developer.apple.com/docs/Cocoa/.Google Scholar
- Hans-J. Boehm, Russ Atkinson, and Michael Plass. 1995. Ropes: An Alternative to Strings. Softw. Pract. Exper. 25, 12 (Dec. 1995), 1315-1330. Google Scholar
Digital Library
- S. R. Bourne. 1978. UNIX Time-Sharing System: The UNIX Shell. Bell System Technical Journal 57, 6 (1978), 1971- 1990. arXiv:https://onlinelibrary.wiley.com/doi/pdf/10.1002/j.1538-7305.1978.tb02139.x.Google Scholar
Cross Ref
- Hristo Deshev. 2008. Pro Windows PowerShell (Pro). APress. Google Scholar
Digital Library
- Richard P. Gabriel, Jon L. White, and Daniel G. Bobrow. 1991. CLOS: Integrating Object-oriented and Functional Programming. Commun. ACM 34, 9 (Sept. 1991), 29-38. Google Scholar
Digital Library
- James Gosling, Bill Joy, and Guy L. Steele. 1996. The Java Language Specification (1st ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA. Google Scholar
Digital Library
- Dan Ingalls, Ted Kaehler, John Maloney, Scott Wallace, and Alan Kay. 1997. Back to the Future: The Story of Squeak, a Practical Smalltalk Written in Itself. SIGPLAN Not. 32, 10 (Oct. 1997), 318-326. Google Scholar
Digital Library
- Daniel H. H. Ingalls. 1986. A Simple Technique for Handling Multiple Polymorphism. SIGPLAN Not. 21, 11 (June 1986), 347-349. Google Scholar
Digital Library
- David Korn and Kiem phong Vo. 1991. SFIO: Safe/Fast String/File IO. In In Proc. of the Summer '91 Usenix Conference. 235-256.Google Scholar
- Angelika Langer and Klaus Kreft. 2008. Standard C++ IOStreams and Locales: Advanced Programmer's Guide and Reference (1st ed.). Addison-Wesley Professional. Google Scholar
Digital Library
- Doug McIlroy. 1964. Pipes Proposal. http://doc.cat-v.org/unix/pipes/.Google Scholar
- Scott McKay. 1991. CLIM: The Common Lisp Interface Manager. Commun. ACM 34, 9 (Sept. 1991), 58-59. Google Scholar
Digital Library
- Adobe Press. 1985. PostScript Language Reference Manual (1st ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA. Google Scholar
Digital Library
- Mary Shaw and David Garlan. 1996. Software Architecture: Perspectives on an Emerging Discipline. Prentice-Hall, Inc., Upper Saddle River, NJ, USA. Google Scholar
Digital Library
- Bjarne Stroustrup. 2000. The C++ Programming Language (3rd ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA. Google Scholar
Digital Library
- R. N. Taylor, N. Medvidovic, and E. M. Dashofy. 2009. Software Architecture: Foundations, Theory, and Practice. Wiley Publishing. Google Scholar
Digital Library
- Guido van Rossum and Fred L. Drake. 2011. The Python Language Reference Manual. Network Theory Ltd. Google Scholar
Digital Library
- Marcel Weiher. 1998. MPWFoundation Framework. https://github.com/mpw/MPWFoundation.Google Scholar
- Marcel Weiher. 2003. Objective-Smalltalk. http://objective.st.Google Scholar
- Marcel Weiher. 2003. stsh. http://objective.st/Scripting.Google Scholar
- Marcel Weiher. 2017. iOS and macOS Performance Tuning: Cocoa, Cocoa Touch, Objective-C, and Swift. Addison-Wesley Professional. Google Scholar
Digital Library
- Nobuyoshi Nakada et al. Yukihiro Matsumoto, Koichi Sasada. [n. d.]. MRI - Matz's Ruby Interpreter - The Ruby Programming Language. https://www.ruby-lang.org/en/.Google Scholar
Index Terms
Standard object out: streaming objects with polymorphic write streams

Marcel Weiher


Comments