Accessors and Mutators to Access to a Private Field? U One of the Ways to Enforce Encapsulation Objects and References 20

Total Page:16

File Type:pdf, Size:1020Kb

Accessors and Mutators to Access to a Private Field? U One of the Ways to Enforce Encapsulation Objects and References 20 1 Programming II (CS300) Chapter 02: Using Objects MOUNA KACEM [email protected] Fall 2018 Using Objects 2 u Introduction to Object Oriented Programming Paradigm u Objects and References u Memory Management in Java u Keep in Mind Object-Oriented Programming Paradigm 3 u Object-oriented (OO) design goals: u Improvement over the procedural/structured programming paradigm u Robustness u Adaptability u Reusability u Emphasis on data rather than algorithms u Data and associated operations are unified u Grouping objects with common attributes, operations and semantics Object-Oriented Programming Paradigm 4 Procedural/Structured Programming Object-Oriented Programming Paradigm Paradigm u Programs are designed around the u Programs are designed around the data operations u Algorithmic problem decomposition u Data-centric problem decomposition Object-Oriented Programming Paradigm 5 u Object-Oriented Thinking u Everything in the world is an object u Any system consists of a set of interacting objects u Interactions among the objects inside and outside the system Flower Tree Student House Object-Oriented Programming Paradigm 6 u Object Oriented Design Principles Abstraction Encapsulation Modularity Object-Oriented Programming Paradigm 7 u Object u The main “actor” in Object-oriented programming paradigm u Instance of exactly one class u Represents the properties of a single instance of a class u Class u A class represents a Data type (prototype or model) u A class represents a description of the common properties of a set of objects u A class can be viewed as a “recipe” on how to make or generate objects u The class should be defined before creating any instance (object) of that class u Properties u Data attributes u Methods u Sequence of instructions that a class or an object follows to perform a task (functions/capabilities) Objects and References 8 u Object Concept u An object is an instance of a Class u An object is an encapsulation of Data u An object has u Identity (a unique reference) u State (also called fields or variables) u Each object has its own variables u Behaviors u All objects instances of the same class share the methods defined by the class Objects and References 9 u Class Concept u A class is used as a template or pattern to create new objects u A class defines u the variables that hold the object’s state u the methods that describe the object’s behaviors Objects and References 10 Object-Oriented Abstraction Programming Class Properties Data (State) Entity Methods Operations (Behaviors) Instantiate Instantiate Instantiate … Object Object1 n Object2 Objects and References 11 u Example: Class definition and object instantiation public class Student { private String name; // Student’s name. private double test1, test2, test3; // Grades on three tests. public double getAverage(){ // compute average test grade // code goes here (method implementation) } } // end of class Student Objects and References 12 u Object Instantiation (Example) Objects and References 13 u Object Instantiation (Example) Objects and References 14 u Object Instantiation (Example): References illustration 864 Instance1of Student std Instance1 1000 Instance2of Student of Student (@ 864) 1024 std = 864 std1 std1 = 1000 Instance2 3200 of Student 5436 std2 = 1000 (@ 1000) std2 5508 std3 = null X std3 Objects and References 15 u Object Instantiation (Example) Objects and References 16 u Object Instantiation (Example) Object no longer accessed Garbage ! Objects and References 17 u There are only eight primitive types in Java u byte, short, int, long, float, double, char, and boolean. u Any other type including String is a reference type u All variables of a reference type (non-primitive type) are objects and are accessed via a reference u In Java, fields of classes and objects that do not have an explicit initializer and elements of arrays are automatically initialized with the default value for their type u false for boolean, u 0 for all numerical types, u null for all reference types Objects and References 18 u Object Behaviors u Constructors u Constructors are invoked only when the object is created u Constructors initialize the state of an object upon creation u Accessor Methods u An accessor method is used to return the value of a private field u Accessor or getter: the method name begins with the prefix “get” Objects and References 19 u Object Behaviors u Accessor Methods u An accessor method is used to return the value of a private field u Accessor or getter: the method name begins with the prefix “get” u Mutator Methods u A mutator method is used to set a value of a private field u A mutator method does not have a return type u Mutator or setter: the method name begins with the prefix “set” u Why it is recommended to use Accessors and Mutators to access to a private field? u One of the ways to enforce encapsulation Objects and References 20 u Constructor (Example) public class Person { // Defined Constructor public Person(String firstName, String lastName, String address) { //Private fields this.firstName = firstName; private String firstName; this.lastName = lastName; private String lastName; this.address = address; private String address; } // Default Constructor } public Person(){ firstName = " "; // Declare two variables of type Person lastName = " "; Person person1, person2; //references to objects of type Person address = " "; } // Create two Person objects and store their references in person1 and person2 variables Person person1 = new Person(); Person person2 = new Person(“Mouna”, “KACEM”, “Madison”); Objects and References 21 u Accessors and Mutators Examples //Accessor for firstName //Mutator for firstname public String getFirstName(){ public void setFirstname(String firstname) { return firstName; this.firstname = firstname; } } //Accessor for lastName //Mutator for address public String getLastName(){ public void setAddress(String address){ return lastName; this.address = address; } } Objects and References 22 u Message Passing u An Object-Oriented application is a set of cooperating objects that communicate with each other u In Java, "message passing" is performed by invoking (calling) methods u A message is sent to an object using the “dot notation”: u objectReference.methodX(); u objectReference.fieldY; u When an object receives a message, it looks for the corresponding method (ie. with the same signature) in its class. Then, it invokes and executes that method. Using Objects 23 u Introduction to Object Oriented Programming Paradigm u Objects and References u Memory Management in Java u Keep in Mind Memory Management in Java 24 u What’s Memory Management? u Memory management is the process of managing the memory space (of the RAM) allocated to a program while it is running u A Java virtual machine (JVM) is an abstract computing machine that enables a computer to run a Java program (i.e. the JVM represents the Java application) u Managing the memory space used by a JVM includes u Allocating Java code, called methods and their local variables in the memory u Allocating new created objects u Removing unused objects Memory Management in Java 25 u Java Memory Model (1) Code u The Java memory model specifies how the Java Heap Virtual Machine (JVM) uses the computer memory (RAM) (memory Allocation) Static A computer allocates mainly two dynamic areas of Memory memory for a program: u Stack to store information about method calls Stack u When a piece of code calls a method, information (method call) about the call is placed on the stack. u When the method returns, that information is popped off the stack console.log() u Heap contains all objects created by the application main() JVM Memory Management in Java 26 Thread1 Stack Thread2 Stack Heap JVM u Java Memory Model (2) u Each thread running in the JVM has its own stack (Thread Stack) u All threads running in the JVM share the heap Memory Management in Java 27 u Java Memory Model (3) u A thread stack contains information about Thread1 Stack Thread2 Stack u The methods called by a thread to reach method_f() method_A() the current point of execution (call stack) Local variable1 Local variable1 Local variable2 u All local variables for each method being Local variable2 executed Local variable3 method_g() method_B() u Local variables related to one thread are not visible to the all other threads including Local variableX Local variableY u local variables of primitive data types (boolean, char, byte, short, int, long, float, double) Heap u If two threads are executing the exact same code (multi-thread applications), u Each thread will create its own local variables of JVM that code in its own thread stack Memory Management in Java 28 u Java Memory Model (2) u The heap contains all objects Thread1 Stack Thread2 Stack created in the Java application method_f() method_A() u Including the object version of Local variable1 Local variable1 primitives types (Boolean, Byte, Local variable2 Local variable2 Character, Double, Float, Integer, Local variable3 Long, Short, and Void) method_g() method_B() Local variableX Local variableY u Objects on the heap are visible Heap Object1 Object4 to all threads Object3 Object2 Object5 JVM Memory Management in Java 29 u Garbage Collection u Java Garbage Collector is responsible for freeing objects when they are no longer accessed u Reclaims heap space u No manual garbage collection in Java u Fully automatic process which runs periodically and performs the real destruction of the objects Keep in Mind 30 u A reference is a variable that stores the memory address where an object is temporarily stored in the stack or the special reference null. u An object can be referenced by multiple references u “==“ operator is used to compare two references u It returns true if the two references refer to the same object u “=“ operator makes a reference variable refer to another object u “.” operator allows the selection of object’s method or access to its fields Keep in Mind 31 u Reference types u For reference types and arrays, “=“ is a reference assignment rather than an object copy.
Recommended publications
  • Sound Invariant Checking Using Type Modifiers and Object Capabilities
    Sound Invariant Checking Using Type Modifiers and Object Capabilities. Isaac Oscar Gariano Victoria University of Wellington [email protected] Marco Servetto Victoria University of Wellington [email protected] Alex Potanin Victoria University of Wellington [email protected] Abstract In this paper we use pre existing language support for type modifiers and object capabilities to enable a system for sound runtime verification of invariants. Our system guarantees that class invariants hold for all objects involved in execution. Invariants are specified simply as methods whose execution is statically guaranteed to be deterministic and not access any externally mutable state. We automatically call such invariant methods only when objects are created or the state they refer to may have been mutated. Our design restricts the range of expressible invariants but improves upon the usability and performance of our system compared to prior work. In addition, we soundly support mutation, dynamic dispatch, exceptions, and non determinism, while requiring only a modest amount of annotation. We present a case study showing that our system requires a lower annotation burden compared to Spec#, and performs orders of magnitude less runtime invariant checks compared to the widely used ‘visible state semantics’ protocols of D, Eiffel. We also formalise our approach and prove that such pre existing type modifier and object capability support is sufficient to ensure its soundness. 2012 ACM Subject Classification Theory of computation → Invariants, Theory of computation → Program verification, Software and its engineering → Object oriented languages Keywords and phrases type modifiers, object capabilities, runtime verification, class invariants Digital Object Identifier 10.4230/LIPIcs.CVIT.2016.23 1 Introduction Object oriented programming languages provide great flexibility through subtyping and arXiv:1902.10231v1 [cs.PL] 26 Feb 2019 dynamic dispatch: they allow code to be adapted and specialised to behave differently in different contexts.
    [Show full text]
  • Method Proxy-Based AOP in Scala
    Vol. 0, No. 0, Z Method Proxy-Based AOP in Scala Daniel Spiewak and Tian Zhao University of Wisconsin – Milwaukee, fdspiewak,[email protected] This paper describes a fully-functional Aspect-Oriented Programming framework in Scala – a statically typed programming language with object-oriented and func- tional features. This framework is implemented as internal domain-specific lan- guages with syntax that is both intuitive and expressive. The implementation also enforces some static type safety in aspect definitions. 1 INTRODUCTION Aspect-Oriented Programming (AOP) implementations such as AspectJ provide language extensions of pointcuts and advices to insert code of crosscutting concerns into the base program through bytecode transformation. In this paper, we describe a framework to implement an AOP extension to the Scala language [13] using higher-order functions as AOP proxies 1. This framework allows programmers to specify pointcuts and aspects using a Domain Specific Language (DSL) [5] embedded within Scala. Our technique uses Scala’s higher-order functions to intercept method calls with minimal syntactic overhead imposed on the base program. This framework allows developers to define pointcuts by specifying class types and method signatures. The framework also allows access to context variables, while aspects can insert advice code before or after the advised body. The rest of the paper is organized as follows: In Section2, we present the main idea using an example. Section3 explains the syntax of pointcuts and advices. Section4 ex- plains the implementation details. We discuss the benefits and tradeoffs of our framework in Section5. and related works are in Section6. 2 EXAMPLE AOP enables developers to write code that is modularized to a point beyond the capabil- ities of vanilla object-oriented design.
    [Show full text]
  • AP Computer Science Basic OOP — Implementing Classes
    AP Computer Science Basic OOP — Implementing Classes ORIENTATION Object-oriented programming (OOP) refers to the organization of data into classes, categories that represent a given type of “object.” An object can be a model of a real-life thing like a car, a six-sided die, or a person, or it can be a representation of something more abstract like a point in space, a menu item, or a digital clipboard. An object that belongs to a given class is called an instance of that class, and any instance of a class keeps track of its state using instance variables, or attributes. The object is created when its constructor is called, and can be interacted with by calling its methods, which may access data (accessor methods, or “getters”) or alter the object’s data (mutator methods, or “setters”). There are two important theoretical concepts in OOP: abstraction and encapsulation. Objects and the classes they belong to act as abstractions of the things they represent: a Java class called Person isn’t actually a person, of course, but a simplified representation of a person in terms of a limited number of qualities (name and age, perhaps). Other details such as hair color, nationality, and gender identity aren’t included in our abstraction of a person. Encapsulation refers to the way that a class and its methods hide away the details of a process. Someone using a QuadraticFormula class can call the hasSolutions() method to find out whether their equation has solutions without knowing what a discriminant is. The programmer and the class she has written have hidden that information away in a metaphorical “black box.” Basic OOP consists primarily of implementing classes: writing the JavaDocs, class header, constructors, attributes, and methods for an object as specified.
    [Show full text]
  • Learn Objective–C on The
    CYAN YELLOW SPOT MATTE MAGENTA BLACK PANTONE 123 C BOOKS FOR PROFESSIONALS BY PROFESSIONALS® Companion eBook Available Learn Objective-CLearn • Learn the native programming language for Mac OS X, Everything You Need to Know as well as the iPhone! to Become an Objective-C Guru • Get up and running quickly with Objective-C. We don’t waste time teaching you basic programming; instead, we focus on what makes Objective-C di!erent and cool. • Learn about sophisticated programming concepts, including object-oriented programming, the Open-Closed Principle, refactoring, key-value coding, and predicates. n this book, you’ll !nd a full exploration of the Objective-C programming Ilanguage, the primary language for creating Mac OS X and iPhone applica- tions. There are goodies here for everyone, whether you’re just starting out as a Mac developer or a grizzled programmer coming from another language. You’ll discover all of the object-oriented purity and Smalltalk heritage coolness of Objective-C—such as instantiation, protocols for multiple inheritance, dynamic typing, and message forwarding. Along the way, you’ll meet Xcode, the Mac development environment, and you’ll learn about Apple’s Cocoa toolkit. on the Nearly everyone wants to be able to develop for Mac OS X or the iPhone these days, and it’s no wonder. The Mac is a fun and powerful platform, and Objective-C is a wonderful language for writing code. You can have a great time programming the Mac in Objective-C. We do, and want you to join us! Mark Dalrymple is a longtime Mac and Unix programmer who has Mac code running all over the world.
    [Show full text]
  • An Empirical Study on Encapsulation and Refactoring in the Object-Oriented Paradigm
    Declaration of Authorship I certify that the work presented here is, to the best of my knowledge and belief, original and the result of my own investigations, except as acknowledged, and has not been submitted, either in part or whole, for a degree at this or any other University. Rajaa Najjar Date: 10 September 2008 An Empirical Study on Encapsulation and Refactoring in the Object-Oriented Paradigm by Rajaa Najjar A Thesis Submitted in Fulfilment of the Requirements for the Degree of Doctor of Philosophy in the University of London September, 2008 School of Computer Science and Information Systems Birkbeck, University of London 1 Abstract Encapsulation lies at the heart of the Object-Oriented (OO) paradigm by regulating access to classes through the private, protected and public declaration mechanisms. Refactoring is a relatively new software engineering technique that is used to improve the internal structure of software, without necessarily affecting its external behaviour, and embraces the OO paradigm, including encapsulation. In this Thesis, we empirically study encapsulation trends in five C++ and five Java systems from a refactoring perspective. These systems emanate from a variety of application domains and are used as a testbed for our investigations. Two types of refactoring related to encapsulation are investigated. The ‘Encapsulate Field’ refactoring which changes a declaration of an attribute from public to private, thus guarding the field from being accessed directly from outside, and the ‘Replace Multiple Constructors with Creation Methods’ refactoring; the latter is employed to remove code ‘bloat’ around constructors, improve encapsulation of constructors and improve class comprehension through the conversion of constructors to normal methods.
    [Show full text]
  • Computer Science Course Reporting Guidance
    Computer Science Course Reporting Guidance The Connecticut State Department of Education is committed to a policy of equal opportunity/affirmative action for all qualified persons. The Connecticut State Department of Education does not discriminate in any employment practice, education program, or educational activity on the basis of race, color, religious creed, sex, age, national origin, ancestry, marital status, sexual orientation, gender identity or expression, disability (including, but not limited to, intellectual disability, past or present history of mental disorder, physical disability or learning disability), genetic information, or any other basis prohibited by Connecticut state and/or federal nondiscrimination laws. The Connecticut State Department of Education does not unlawfully discriminate in employment and licensing against qualified persons with a prior criminal conviction. Inquiries regarding the Connecticut State Department of Education’s nondiscrimination policies should be directed to: Levy Gillespie, Equal Employment Opportunity Director/Americans with Disabilities Act Coordinator, Connecticut State Department of Education, 450 Columbus Blvd, Suite 607, Hartford, CT 06103, 860-807-2071, [email protected] Contents Overview 3 Background 3 Teacher Authorization 4 Graduation Requirements 4 Group 1 Computer Science 4 Definition 4 Courses 4 Programming 4 Databases 8 Networking 9 Cybersecurity 11 Computer Applications 12 Business 13 Other 13 Group 2 Computer Science 13 Definition 13 Courses 14 Networking 14 General Computer Literacy 14 Computer Applications 15 Business 16 Engineering 16 Other 18 References 21 Contributors 22 Acknowledgments 22 Computer Science Course Reporting Guidance Page 2 of 22 Overview Computer science (CS) is defined as the study of computers and algorithmic processes, including their principles, their hardware and software designs, their applications, and their impact on society [1].
    [Show full text]
  • Declaring a Class Array Variable
    Declaring A Class Array Variable PatrikWakefield outjut often invitingly. electrolyses Isogonic tightly Bobby when sometimes hallucinogenic mechanizes Sheridan his bandyingsbleed soundlessly paramountly and unpenned and vacillates so interpretatively! her vigils. Salopian You may need to classes have been created with the abstract base class array class variable for initializing default TLDR C array refers to a collection of variables that quiet the venture type. Java classes in java fill in an argument of variables, etc use better feel free. Each indexed member of a function definitions allow a function parameters in front during program to access them sporadically or may simply an embedded application. Want a fix out problem yourself? The variable can write hello world series for class array variable name for just a single row, it returns a dynamically allocated object of items are place to iterate through it? Does not worth continuing, you sure you are initialized an array items into one array is preserved from variables. To gamble an affect it is gauge to identify its characteristics also. Python Class Attributes Examples of Variables Toptal. The initialization of a structure or class variable using the initializing sequence is. Creating an exciting time that you for traversing arrays of a class array variable as the size array can be used to the type is my int. We declare multidimensional array? Tutor now leads to class array variable will contain exactly that would not. In fact, nor can narrate a reference to source array. To pass the array without a method the method declaration should thinking like this.
    [Show full text]
  • Pdf Merger Demo
    A-PDF MERGER DEMO Philadelphia University Faculty of Information Technology Lecturer: Dr. Nadia Y. Yousif Software Engineering Department Coordinator: Dr. Nadia Y. Yousif Examination Paper Internal Examiner: Dr. Murad Maouch ………………………………………………………………………………………………………… Object-Oriented Paradigms (721112) - Section: 3 First Exam Date: November 28, 2006 First Semester - 2006/2007 Time: 50 Minutes ………………………………………………………………………………………………………… Information for Candidates 1. This examination paper contains 3 questions totalling 15 marks 2. The marks for parts of questions are shown in square brackets: e.g. [2 marks]. Advice to Candidates 1. You should attempt ALL questions. You should write your answers clearly. ………………………………………………………………………………………………………… I. Basic Notions Objectives: The aim of the question in this part is to evaluate your required minimal knowledge and understanding skills in the fundamentals of object oriented programming. Question 1 (5 marks) This question contains 5 multiple choice questions with each question worth 1 mark. You should write the letter A, B, C, or D in your answer sheet to indicate your correct answer. 1) One of the following is NOT TRUE about Object-Oriented Paradigms (OOPs): A) OOP is a set of techniques and processes focusing on how to analyse and model a real world problem and to design a solution. B) The intended benefits of OOP are to solve the “software” crisis, break complexity into small manageable chunks, and make software maintenance easier. C) OOP allows reuse of components – plug and play D) OOP solves the entire problem in one program. 2) Which point is FALSE from the following? A) A class is an object B) A class is a template or prototype that defines the composition and the behavior of all objects of certain kinds.
    [Show full text]
  • Open Abrown Thesis May2012.Pdf
    The Pennsylvania State University The Graduate School Department of Computer Science and Engineering AN ENGINEERING APPROACH TO PERL AND RUBY OBJECT ORIENTED PROGRAMMING LANGUAGES A Thesis in Computer Science and Engineering by Angeline Brown © 2012 Angeline Brown Submitted in Partial Fulfillment of the Requirements for the Degree of Master of Science May 2012 ii The thesis of Angeline Brown was reviewed and approved* by the following: Mahmut Kandemir Professor of Computer Science and Engineering Thesis Advisor Yuan Xie Associate Professor of Computer Science and Engineering Raj Acharya Professor of Computer Science and Engineering Head of the Department of Computer Science and Engineering *Signatures are on file in the Graduate School iii ABSTRACT This study compares two object oriented programming languages, Perl and Ruby. Perl and Ruby are both extensively used scripting languages that are applied in a wide scope of modern software applications. Applications that use Perl are Amazon.com, TicketMaster.com, and Priceline.com. Applications that use Ruby are Twitter.com, YellowPages.com, and LivingSocial.com. The purpose of discussing these languages is two-fold. First, the available quantitative comparison of these languages is limited. This paper provides essential quantitative as well as qualitative analysis that can be used as a tool for future references. Secondly, this work was performed as a trade study for the implementation of a real world database application known as PennData SpecEd Application. PennData SpecEd is used to collect records of special education students from the Commonwealth of Pennsylvania student census. This comparative study focuses first on the performance and ease of programming software components using object oriented features of both Perl and Ruby.
    [Show full text]
  • Linkedlists.Mkr Page 838 Thursday, October 14, 1999 10:19 PM
    LinkedLists.mkr Page 838 Thursday, October 14, 1999 10:19 PM ¡ £ ¤ ¥ ¦ § ¨ © § ¢ list This section implements the STL list class discussed in Section 7.6. We will see lots of code, but most of the techniques were seen earlier in this chapter. // Incomplete class declarations for // the const_iterator, iterator, and list, // because all these classes refer to each other. template <class Object> class ConstListItr; template <class Object> class ListItr; template <class Object> class list; // The basic doubly-linked list node. // Everything is private, and is accessible // only by the iterators and list classes. template <class Object> class ListNode { Object data; ListNode *prev; ListNode *next; ListNode( const Object & d = Object( ), ListNode * p = NULL, ListNode * n = NULL ) : data( d ), prev( p ), next( n ) { } friend class ConstListItr<Object>; friend class ListItr<Object>; friend class list<Object>; }; ! " # $ % & ' ) * + + * , - - . ( ) * / * 0 1 2 , + 3 2 / 2 0 4 . / ( ) * + + . + ListNode ( LinkedLists.mkr Page 839 Thursday, October 14, 1999 10:19 PM ¡ < 5 6 7 6 . , 0 1 , 8 0 4 . 9 : ; ) list template <class Object> class list { public: typedef ListItr<Object> iterator; typedef ConstListItr<Object> const_iterator; list( ); ~list( ); list( const list & rhs ); const list & operator= ( const list & rhs ); iterator begin( ); const_iterator begin( ) const; iterator end( ); const_iterator end( ) const; int size( ) const; bool empty( ) const; Object
    [Show full text]
  • Arquitecturas De Microservicios Para Aplicaciones Desplegadas En Contenedores
    UNIVERSIDAD POLITÉCNICA DE MADRID Escuela Técnica Superior Ingeniería de Sistemas Informáticos TRABAJO FIN DE GRADO EN INGENIERÍA DEL SOFTWARE Arquitecturas de microservicios para aplicaciones desplegadas en contenedores Autor: Carlos Jiménez Aliaga Tutora: Ana Isabel Lías Quintero Diciembre 2018 A mis padres, por haberme guiado a lo largo de los años. A mi hermana, por estar siempre ahí y ayudarme a dar lo mejor de mí. Y a mi abuela, donde quiera que esté, que siempre estuvo orgullosa de que su nieto estudiara álgebra. i | RESUMEN El estado actual de las redes de comunicaciones y la evolución de los dispositivos electrónicos, cada vez más potentes, ligeros y portátiles, ha cambiado la forma en la se consumen los servicios en línea. Los dispositivos están siempre conectados y los clientes necesitan acceder a los datos desde cualquier lugar y de forma instantánea. Esta necesidad implica una rápida adaptación de los servicios así como replicar los datos geográficamente para que puedan estar accesibles globalmente con una latencia mínima. La cuestión es, ¿cómo se consigue desarrollar servicios que cumplan las necesidades actuales de una forma eficiente a la vez que sean capaces de adaptarse rápidamente a nuevos cambios? El propósito de este proyecto de fin de grado es presentar cómo definir arquitecturas basadas en microservicios, haciendo uso de buenas prácticas, para aplicaciones desplegadas en contenedores. Para ello se hace uso de tecnologías de código abierto y multiplataforma, en concreto .NET Core para el desarrollo y Docker como motor de los contenedores. Elegir dónde y cómo desplegar las aplicaciones es un factor determinante. Se presenta el uso los orquestadores para la gestión de los contenedores (Kubernetes específicamente, que es también de código abierto) y de las plataformas Cloud donde el orquestador, las aplicaciones y servicios adicionales (como las bases de datos) son desplegados y accesibles a nivel global.
    [Show full text]
  • Java Classes
    Java classes Savitch, ch 5 Outline n Objects, classes, and object-oriented programming q relationship between classes and objects q abstraction n Anatomy of a class q instance variables q instance methods q constructors 2 Objects and classes n object: An entity that combines state and behavior. q object-oriented programming (OOP): Writing programs that perform most of their behavior as interactions between objects. n class: 1. A program. or, 2. A blueprint of an object. q classes you may have used so far: String, Scanner, File n We will write classes to define new types of objects. 3 Abstraction n abstraction: A distancing between ideas and details. q Objects in Java provide abstraction: We can use them without knowing how they work. n You use abstraction every day. Example: Your portable music player. q You understand its external behavior (buttons, screen, etc.) q You don't understand its inner details (and you don't need to). 4 Class = blueprint, Object = instance Music player blueprint state: current song volume battery life behavior: power on/off change station/song change volume choose random song Music player #1 Music player #2 Music player #3 state: state: state: song = "Thriller" song = ”Feels like rain" song = "Code Monkey" volume = 17 volume = 9 volume = 24 battery life = 2.5 hrs battery life = 3.41 hrs battery life = 1.8 hrs behavior: behavior: behavior: power on/off power on/off power on/off change station/song change station/song change station/song change volume change volume change volume choose random song choose random
    [Show full text]