Information Hiding

Total Page:16

File Type:pdf, Size:1020Kb

Information Hiding Information Hiding Daniel M. Berry 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 1 Information Hiding -1 The concept of information hiding (IH) comes from the seminal paper, ªOn the criteria to be used in decomposing systems into modulesº, CACM, Dec., 1972 by David L. Parnas. The purpose of information hiding is to obtain a modularization of the code of a system that isolates changes into single modules. 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 2 Information Hiding -2 Information hiding is a way to use abstract data types and abstract objects, such as provided by g Ada packages g Simula classes g C++ classes I assume that you know at least one of these! If you don't, then go learn! 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 3 ADT&O -1 It is necessary to teach exploitation of abstract data types and objects (ADT&O). I have found many people writing FORTRAN code in Ada syntax or C code in C++ syntax. On the other hand, it is possible to exploit ADT&O even in assembly language and FORTRAN! 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 4 ADT&O -2 What's a nice programming topic like you doing in a real rough requirements engineering course like this? g ADT&O is a good way to organize a domain model g ADT&O is a good way to organize a software design 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 5 ADT&O -3 Remember that you may have to do some design to discover all requirements. With ADT&O, the domain model and design can be built without exposing implementation details! 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 6 ADT&O -4 In my experience, if I program with ADT&O using information hiding, my modules end up being the types and objects of the domain model. So even if I am thinking implementation, I end up with a domain model! 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 7 ADT&O and IH -1 For those of you who are implementation- bound in your thinking, ADT&O with information hiding frees you from thinking implementation. ADT&O with IH gives you a way of thinking at an abstract level without having to worry about whether you can implement, because you can! 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 8 ADT&O and IH -2 You will see an entirely different way of thinking about problems, in which you work with problem-level concepts rather than more traditional data- or control-¯ow concepts. If you're already thinking this way, bravo! If not, then learn! 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 9 Parnas's Sample Problem Requirements: The KWIC index system accepts an ordered set [sic] of lines, each line is an ordered set [sic] of words, and each word is an ordered set [sic] of characters. Any line may be ªcircularly shiftedº by repeatedly removing the ®rst word and appending it at the end of the line. The KWIC index system outputs a listing of all the circular shifts of all lines in alphabetical order. 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 10 List of Six Lines Make - A Program for Maintaining Computer Programs Reference Manual for the Ada Programming Language The NYU Ada/Ed System, An Overview Program Design Language Software Development Processor User Reference Manual The Ina Jo Reference Manual The next slide shows the KWIC (KeyWord In Context) index of the above lines. 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 11 Make - A Program for Maintaining Computer Programs [Fel78] Make - A Program for Maintaining Computer Programs [Fel78] Reference Manual for the Ada Programming Language [ADA81] The NYU Ada/Ed System, An Overview [NYU81] The NYU Ada/Ed System, An Overview [NYU81] Make - A Program for Maintaining Computer Programs [Fel78] Program Design Language [CFG75] Software Development Processor User Reference Manual [Yav80] Make - A Program for Maintaining Computer Programs [Fel78] Reference Manual for the Ada Programming Language [ADA81] The Ina Jo Reference Manual [LSSE80] The Ina Jo Reference Manual [LSSE80] Program Design Language [CFG75] Reference Manual for the Ada Programming Language [ADA81] Make - A Program for Maintaining Computer Programs [Fel78] Make - A Program for Maintaining Computer Programs [Fel78] Reference Manual for the Ada Programming Language [ADA81] Software Development Processor User Reference Manual [Yav80] The Ina Jo Reference Manual [LSSE80] The NYU Ada/Ed System, An Overview [NYU81] The NYU Ada/Ed System, An Overview [NYU81] Software Development Processor User Reference Manual [Yav80] Program Design Language [CFG75] Make - A Program for Maintaining Computer Programs [Fel78] Reference Manual for the Ada Programming Language [ADA81] Make - A Program for Maintaining Computer Programs [Fel78] Reference Manual for the Ada Programming Language [ADA81] Software Development Processor User Reference Manual [Yav80] The Ina Jo Reference Manual [LSSE80] Software Development Processor User Reference Manual [Yav80] The NYU Ada/Ed System, An Overview [NYU81] Reference Manual for the Ada Programming Language [ADA81] The Ina Jo Reference Manual [LSSE80] The NYU Ada/Ed System, An Overview [NYU81] Software Development Processor User Reference Manual [Yav80] 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 12 KWIC Index of Above Lines First 5 lines of Index: c Make c - A Program for Maintaining Computer Programs [Fel78] Make - c A Program for Maintaining Computer Programs [Fel78] Reference Manual for the c Ada Programming language [Ada81] c The NYU c Ada/ed System, An Overview [NYU81] The NYU Ada/ed System, c An Overview [NYU81] 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 13 Two Modularizations Parnas shows ®rst a conventional modularization and then one that does a better job of being modi®able. Modularization 1: Brand X Modularization 2: Brand DLP Guess which one is supposed to be better! The textual module descriptions are from Parnas himself. 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 14 Modularization 1 -1 BRAND X: Modularization 1 KWIC circular_ input alphabetizer output shifter 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 15 Modularization 1 -2 DATA STRUCTURE DIAGRAM words 1 11 2 1 51 3 1 2 4 1 103 5 2 97 6 2 18 7 2 54 line_index cs_line_index alphed_cs_line_index 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 16 Modularization 1 -3 Module 1: Input. This module reads the data lines from the input medium and stores them in core for processing by the remaining modules. The characters are packed four to a word, and an otherwise unused character is used to indicate the end of a word. An index is kept to show the start of each line. 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 17 Modularization 1 -4 Module 2: Circular Shift. This module is called after the input module has completed its work. It prepares an index which gives the address of the ®rst character of each circular shift, and the original index of the line in the array made up by module 1. It leaves its output in core with words in pairs (original line number, starting address). 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 18 Modularization 1 -5 Module 3: Alphabetizing. This module takes as input the arrays produced by modules 1 and 2. It produces an array in the same format as that produced by module 2. In this case, however, the circular shifts are listed in another order (alphabetically). 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 19 Modularization 1 -6 Module 4: Output. Using the arrays produced by module 3 and module 1, this module produces a nicely formatted output listing of all of the circular shifts. In a sophisticated system the actual start of each line will be marked, pointers to further information may be inserted, and the start of the circular shift may actually not be the ®rst word in the line, etc. 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 20 Modularization 1 -7 Module 5: Master Control. This module does little more than control the sequencing among the other four modules. It may also handle error messages, space allocation, etc. 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 21 Modularization 1 -8 Parnas says: It should be clear that the above does not constitute a de®nitive document. Much more information would have to be supplied before work could start. The de®ning documents would include a number of pictures [as above] showing core formats, pointer conventions, calling conventions, etc. All of the interfaces between the four modules must be speci®ed before work could begin. 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 22 Modularization 1 -9 I add the additional de®ning documents using Ada notation: procedure KWIC is type PAIR is record line_no:INTEGER; character_no:INTEGER; end record; type INDEX_TABLE is array (INTEGER range <>) of PAIR; large_no: constant INTEGER:=MAX_INT; 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 23 Modularization 1 -10 words:STRING(1..large_no); line_index:INDEX_TABLE(1..large_no); cs_line_index:INDEX_TABLE(1..large_no); alphed_cs_line_index:INDEX_TABLE(1..large_no); procedure input is separate; procedure make_circular_shifts is separate; procedure alphabetize is separate; procedure output is separate; 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 24 Modularization 1 -11 begin input; make_circular_shifts; alphabetize; output; end KWIC; 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 25 Modularization 1 -12 separate(KWIC) procedure input is begin null; end; separate(KWIC) procedure make_circular_shifts is begin null; end; 1996 Daniel M. Berry Software Enginering Information Hiding Pg. 26 Modularization 1 -13 separate(KWIC) procedure alphabetize is begin null; end; separate(KWIC) procedure output is begin null; end; 1996 Daniel M.
Recommended publications
  • Javascript and OOP Once Upon a Time
    11/14/18 JavaScript and OOP Once upon a time . Jerry Cain CS 106AJ November 12, 2018 slides courtesy of Eric Roberts Object-Oriented Programming The most prestigious prize in computer science, the ACM Turing Award, was given in 2002 to two Norwegian computing pioneers, who jointly developed SIMULA in 1967, which was the first language to use the object-oriented paradigm. JavaScript and OOP In addition to his work in computer Kristen Nygaard science, Kristen Nygaard also took Ole Johan Dahl an active role in making sure that computers served the interests of workers, not just their employers. In 1990, Nygaard’s social activism was recognized in the form of the Norbert Wiener Award for Social and Professional Responsibility. Review: Clients and Interfaces David Parnas on Modular Development • Libraries—along with programming abstractions at many • David Parnas is Professor of Computer other levels—can be viewed from two perspectives. Code Science at Limerick University in Ireland, that uses a library is called a client. The code for the library where he directs the Software Quality itself is called the implementation. Research LaBoratory, and has also taught at universities in Germany, Canada, and the • The point at which the client and the implementation meet is United States. called the interface, which serves as both a barrier and a communication channel: • Parnas's most influential contriBution to software engineering is his groundBreaking 1972 paper "On the criteria to be used in decomposing systems into modules," which client implementation laid the foundation for modern structured programming. This paper appears in many anthologies and is available on the web at interface http://portal.acm.org/citation.cfm?id=361623 1 11/14/18 Information Hiding Thinking About Objects Our module structure is based on the decomposition criteria known as information hiding.
    [Show full text]
  • Chapter 4: PHP Fundamentals Objectives: After Reading This Chapter You Should Be Entertained and Learned: 1
    Chapter 4: PHP Fundamentals Objectives: After reading this chapter you should be entertained and learned: 1. What is PHP? 2. The Life-cycle of the PHP. 3. Why PHP? 4. Getting Started with PHP. 5. A Bit About Variables. 6. HTML Forms. 7. Building A Simple Application. 8. Programming Languages Statements Classification. 9. Program Development Life-Cycle. 10. Structured Programming. 11. Object Oriented Programming Language. 4.1 What is PHP? PHP is what is known as a Server-Side Scripting Language - which means that it is interpreted on the web server before the webpage is sent to a web browser to be displayed. This can be seen in the expanded PHP recursive acronym PHP-Hypertext Pre-processor (Created by Rasmus Lerdorf in 1995). This diagram outlines the process of how PHP interacts with a MySQL database. Originally, it is a set of Perl scripts known as the “Personal Home Page” tools. PHP 4.0 is released in June 1998 with some OO capability. The core was rewritten in 1998 for improved performance of complex applications. The core is rewritten in 1998 by Zeev and Andi and dubbed the “Zend Engine”. The engine is introduced in mid 1999 and is released with version 4.0 in May of 2000. Version 5.0 will include version 2.0 of the Zend Engine (New object model is more powerful and intuitive, Objects will no longer be passed by value; they now will be passed by reference, and Increases performance and makes OOP more attractive). Figure 4.1 The Relationship between the PHP, the Web Browser, and the MySQL DBMS 4.2 The Life-cycle of the PHP: A person using their web browser asks for a dynamic PHP webpage, the webserver has been configured to recognise the .php extension and passes the file to the PHP interpreter which in turn passes an SQL query to the MySQL server returning results for PHP to display.
    [Show full text]
  • Data Abstraction and Encapsulation ADT Example
    Data Abstraction and Encapsulation Definition: Data Encapsulation or Information Hiding is the concealing of the implementation details of a data object Data Abstraction from the outside world. Definition: Data Abstraction is the separation between and the specification of a data object and its implementation. Definition: A data type is a collection of objects and a set Encapsulation of operations that act on those objects. Definition: An abstract data type (ADT) is a data type that is organized in such a way that the specification of the objects and the specification of the operations on the objects is separated from the representation of the objects and the implementation of the operations. 1 2 Advantages of Data Abstraction and Data Encapsulation ADT Example ADT NaturalNumber is Simplification of software development objects: An ordered sub-range of the integers starting at zero and ending at the maximum integer (MAXINT) on the computer. Testing and Debugging functions: for all x, y belong to NaturalNumber; TRUE, FALSE belong to Boolean and where +, -, <, ==, and = are the usual integer operations Reusability Zero(): NaturalNumber ::= 0 Modifications to the representation of a data IsZero(x): Boolean ::= if (x == 0) IsZero = TRUE else IsZero = FALSE type Add(x, y): NaturalNumber ::= if (x+y <= MAXINT) Add = x + y else Add = MAXINT Equal(x, y): Boolean ::= if (x == y) Equal = TRUE else Equal = FALSE Successor(x): NaturalNumber ::= if (x == MAXINT) Successor = x else Successor = x +1 Substract(x, y): NaturalNumber ::= if (x <
    [Show full text]
  • C++: Data Abstraction & Classes
    Comp151 C++: Data Abstraction & Classes A Brief History of C++ • Bjarne Stroustrup of AT&T Bell Labs extended C with Simula-like classes in the early 1980s; the new language was called “C with Classes”. • C++, the successor of “C with Classes”, was designed by Stroustrup in 1986; version 2.0 was introduced in 1989. • The design of C++ was guided by three key principles: 1. The use of classes should not result in programs executing any more slowly than programs not using classes. 2. C programs should run as a subset of C++ programs. 3. No run-time inefficiency should be added to the language. Topics in Today's Lecture • Data Abstraction • Classes: Name Equivalence vs. Structural Equivalence • Classes: Restrictions on Data Members • Classes: Location of Function declarations/definitions • Classes: Member Access Control • Implementation of Class Objects Data Abstraction • Questions: – What is a ‘‘car''? – What is a ‘‘stack''? •A data abstraction is a simplified view of an object that includes only features one is interested in while hiding away the unnecessary details. • In programming languages, a data abstraction becomes an abstract data type (ADT) or a user-defined type. • In OOP, an ADT is implemented as a class. Example: Implement a Stack with an Array 1 data 2 3 size top . Example: Implement a Stack with a Linked List top -999 top (latest item) -999 1 2 Information Hiding •An abstract specification tells us the behavior of an object independent of its implementation. i.e. It tells us what an object does independent of how it works. • Information hiding is also known as data encapsulation, or representation independence.
    [Show full text]
  • Data Abstraction and Object-Oriented Languages; Ada Case Study
    CS323 Lecture: Data Abstraction and Object-Oriented Languages; Ada Case Study 2/4/09 Materials: Handout of Ada Demonstration Programs + Executable form (first_example, ascii_codes, rationals, stack, exception_demo, oo_demo) I. Introduction - ------------ A. As we have discussed previously, the earliest programming language paradigm (to which many languages belong) is the imperative or procedural paradigm. However, within this paradigm there have been some important developments which have led to modern languages being significantly better than older members of the same family, as well as to the development of the object-oriented paradigm. 1. One such development is "structured programming" which focussed on the control flow of programs. A major outcome of this work has been the presence, in most modern languages regardless of paradign, of certain well-defined control structures (conditional; definite and indefinite iteration). 2. A second major development has been the evolution of the idea of DATA ABSTRACTION. a. In the early days of computer science, most attention was given to algorithms and to language features to support them - e.g. procedural abstraction and control structures. b. In the late 1960's, Donald Knuth published a three volume work called "The Art of Computer Programming" which focussed attention on the fact that data structures are an equally important part of software design. i. His book is really responsible for the birth of the idea that a "Data Structures" course should be part of the CS curriculum. ii. Historically, coverage of data structures migrated from being an upper-level course in the CS major (300 level) to being a core part of the introductory sequence.
    [Show full text]
  • Designing Information Hiding Modularity for Model Transformation Languages
    Designing Information Hiding Modularity for Model Transformation Languages Andreas Rentschler Dominik Werle Qais Noorshams Lucia Happe Ralf Reussner Karlsruhe Institute of Technology (KIT) 76131 Karlsruhe, Germany {rentschler, noorshams, happe, reussner}@kit.edu [email protected] Abstract designed to transform models into other models and finally into code artifacts. These so-called transformation languages aim to ease Development and maintenance of model transformations make up a development efforts by offering a succinct syntax to query from and substantial share of the lifecycle costs of software products that rely map model elements between different modeling domains. on model-driven techniques. In particular large and heterogeneous However, development and maintenance of model transforma- models lead to poorly understandable transformation code due to tions themselves are expected to make up a substantial share of missing language concepts to master complexity. At the present time, the lifecycle costs of software products that rely on model-driven there exists no module concept for model transformation languages techniques [20]. Much of the effort in understanding model trans- that allows programmers to control information hiding and strictly formations arises from complexity induced by a high degree of declare model and code dependencies at module interfaces. Yet only data and control dependencies. Complexity is connected to size, then can we break down transformation logic into smaller parts, so structural complexity and heterogeneity of models involved in a that each part owns a clear interface for separating concerns. In this transformation. Visualization techniques can help to master this paper, we propose a module concept suitable for model transforma- complexity [17, 20].
    [Show full text]
  • Application of Steganography for Anonymity Through the Internet Jacques Bahi, Jean-François Couchot, Nicolas Friot, Christophe Guyeux
    Application of Steganography for Anonymity through the Internet Jacques Bahi, Jean-François Couchot, Nicolas Friot, Christophe Guyeux To cite this version: Jacques Bahi, Jean-François Couchot, Nicolas Friot, Christophe Guyeux. Application of Steganog- raphy for Anonymity through the Internet. IHTIAP’2012, 1-st Workshop on Information Hiding Techniques for Internet Anonymity and Privacy, Jan 2012, Italy. pp.96 - 101. hal-00940094 HAL Id: hal-00940094 https://hal.archives-ouvertes.fr/hal-00940094 Submitted on 31 Jan 2014 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Application of Steganography for Anonymity through the Internet Jacques M. Bahi, Jean-François Couchot, Nicolas Friot, and Christophe Guyeux* FEMTO-ST Institute, UMR 6174 CNRS Computer Science Laboratory DISC University of Franche-Comté Besançon, France {jacques.bahi, jean-francois.couchot, nicolas.friot, christophe.guyeux}@femto-st.fr * Authors in alphabetic order Abstract—In this paper, a novel steganographic scheme Considering that the freedom of expression is a fundamen- based on chaotic iterations is proposed. This research work tal right that must be protected, that journalists must be able takes place into the information hiding security framework. to inform the community without risking their own lives, The applications for anonymity and privacy through the Internet are regarded too.
    [Show full text]
  • Information Hiding Interfaces for Aspect-Oriented Design∗
    Information Hiding Interfaces for Aspect-Oriented Design∗ Kevin Sullivanφ William G. Griswoldλ Yuanyuan Songφ Yuanfang Caiφ Macneil Shonleλ Nishit Tewariφ Hridesh Rajanφ φComputer Science λComputer Science & Engineering University of Virginia UC San Diego Charlottesville, VA 22903 La Jolla, CA 92093-0114 fsullivan,ys8a,yc7a,nt6x,[email protected] fwgg,[email protected] ABSTRACT aspects. JPs are points in a concrete program execution, such as The growing popularity of aspect-oriented languages, such as As- method calls and executions, that, by the definition of the join pectJ, and of corresponding design approaches, makes it important point model of the AO language, are subject to advising. Advis- to learn how best to modularize programs in which aspect-oriented ing extends or overrides the action at a join point with a CLOS- composition mechanisms are used. We contribute an approach to like [22, Ch. 28] before, after, or around anonymous method called information hiding modularity in programs that use quantified ad- an advice. A PCD is a declarative expression that matches a set of vising as a module composition mechanism. Our approach rests on JPs. An advice extends or overrides the action at each join point a new kind of interface: one that abstracts a crosscutting behavior, matched by a given PCD. Because a PCD can select JPs that span decouples the design of code that advises such a behavior from the unrelated classes, an advice can have effects that cut across a class hierarchy. Advice, pointcuts and ordinary data members and meth- design of the code to be advised, and that can stipulate behavioral 1 contracts.
    [Show full text]
  • Information Hiding Techniques: a Tutorial Review
    Information Hiding Techniques: A Tutorial Review Sabu M Thampi Assistant Professor Department of Computer Science & Engineering LBS College of Engineering, Kasaragod Kerala- 671542, S.India [email protected] chemically affected sympathetic inks were developed. Abstract The purpose of this tutorial is to present an Invisible inks were used as recently as World War II. overview of various information hiding techniques. Modern invisible inks fluoresce under ultraviolet light A brief history of steganography is provided along and are used as anti-counterfeit devices. For example, with techniques that were used to hide information. "VOID" is printed on checks and other official Text, image and audio based information hiding documents in an ink that appears under the strong techniques are discussed. This paper also provides ultraviolet light used for photocopies. a basic introduction to digital watermarking. The monk Johannes Trithemius, considered one of the founders of modern cryptography, had ingenuity in 1. History of Information Hiding spades. His three volume work Steganographia, The idea of communicating secretly is as old as written around 1500, describes an extensive system for communication itself. In this section, we briefly concealing secret messages within innocuous texts. On discuss the historical development of information its surface, the book seems to be a magical text, and hiding techniques such as steganography/ the initial reaction in the 16th century was so strong watermarking. that Steganographia was only circulated privately until publication in 1606. But less than five years ago, Jim Early steganography was messy. Before phones, Reeds of AT&T Labs deciphered mysterious codes in before mail, before horses, messages were sent on the third volume, showing that Trithemius' work is foot.
    [Show full text]
  • Constructors and Setters (Even Though Examples in Book Don't Always Do This ...) 9 Coding Advice – Getters and Setters
    Five-Minute Review 1. What is a method? A static method? 2. What is the motivation for having methods? 3. What role do methods serve in expressions? 4. What are the mechanics of method calling? 5. What are local variables? 1 Programming – Lecture 6 Objects and Classes (Chapter 6) • Local/instance/class variables, constants • Using existing classes: RandomGenerator • The implementor’s perspective • Javadoc: The client’s perspective • Defining your own classes 2 The Art and Science of Java An Introduction to Computer Science C H A P T E R 6 ERIC S. ROBERTS Objects and Classes To beautify life is to give it an object. —José Martí, On Oscar Wilde, 1888 6.1 Using the RandomGenerator class 6.2 The javadoc documentation system 6.3 Defining your own classes 6.4 Representing student information 6.5 Rational numbers 6.6 Extending existing classes Chapter 6—Objects and Classes Local/Instance/Class Variables (See also Lec. 03) public class Example { int someInstanceVariable; static int someClassVariable; static final double PI = 3.14; public void run() { int someLocalVariable; ... } } 4 Local Variables • Declared within method • One storage location ("box") per method invocation • Stored on stack public void run() { int someLocalVariable; ... } 5 Instance Variables • Declared outside method • One storage location per object • A.k.a. ivars, member variables, or fields • Stored on heap int someInstanceVariable; 6 Class Variables • Declared outside method, with static modifier • Only one storage location, for all objects • Stored in static data segment static int someClassVariable; static final double PI = 3.14; 7 Constants • Are typically stored in class variables • final indicates that these are not modified static final double PI = 3.14; 8 this • this refers to current object • May use this to override shadowing of ivars by local vars of same name public class Point { public int x = 0, y = 0; public Point(int x, int y) { this.x = x; this.y = y; } } • Coding Advice: re-use var.
    [Show full text]
  • Information Hiding and Visibility in Interface Specifications Gary T
    Computer Science Technical Reports Computer Science 9-2006 Information Hiding and Visibility in Interface Specifications Gary T. Leavens Iowa State University Peter Müller ETH Follow this and additional works at: http://lib.dr.iastate.edu/cs_techreports Part of the Software Engineering Commons, and the Theory and Algorithms Commons Recommended Citation Leavens, Gary T. and Müller, Peter, "Information Hiding and Visibility in Interface Specifications" (2006). Computer Science Technical Reports. 339. http://lib.dr.iastate.edu/cs_techreports/339 This Article is brought to you for free and open access by the Computer Science at Iowa State University Digital Repository. It has been accepted for inclusion in Computer Science Technical Reports by an authorized administrator of Iowa State University Digital Repository. For more information, please contact [email protected]. Information Hiding and Visibility in Interface Specifications Abstract Information hiding controls which parts of a class are visible to non-privileged and privileged clients (e.g., subclasses). This affects detailed design specifications in two ways. First, specifications should not expose hidden class members. As noted in previous work, this is important because such hidden members are not meaningful to all clients. But it also allows changes to hidden implementation details without invalidating correctness proofs for client code, which is important for maintaining verified programs. Second, to enable sound modular reasoning, certain specifications must be visible to clients. We present rules for information hiding in specifications for Java-like languages, and demonstrate their application to the specification language JML. These rules restrict proof obligations to only mention visible class members, but retain soundness. This allows maintenance of implementations and their specifications without affecting client reasoning.
    [Show full text]
  • Revisiting Information Hiding: Reflections on Classical and Nonclassical Modularity
    Revisiting Information Hiding: Reflections on Classical and Nonclassical Modularity Klaus Ostermann, Paolo G. Giarrusso, Christian K¨astner,Tillmann Rendel University of Marburg, Germany Abstract. What is modularity? Which kind of modularity should devel- opers strive for? Despite decades of research on modularity, these basic questions have no definite answer. We submit that the common under- standing of modularity, and in particular its notion of information hiding, is deeply rooted in classical logic. We analyze how classical modularity, based on classical logic, fails to address the needs of developers of large software systems, and encourage researchers to explore alternative vi- sions of modularity, based on nonclassical logics, and henceforth called nonclassical modularity. 1 Introduction Modularity has been an important goal for software engineers and program- ming language designers, and over the last decades much research has provided modularity mechanisms for different kinds of software artifacts. But despite sig- nificant advances in the theory and practice of modularity, the actual goal of modularity is not clear, and in fact different communities have quite different visions in this regard. On the one hand, there is a classical notion of modularity grounded in information hiding, which manifests itself in modularization mech- anisms such as procedural/functional abstraction and abstract data types. On the other hand, there are novel (and not so novel) notions of modularity that emphasize extensibility and separation of concerns at the expense of information hiding, such as program decompositions using inheritance, reflection, exception handling, aspect-oriented programming, or mutable state and aliasing, all of which may lead to dependencies between modules that are not visible in their interfaces.
    [Show full text]