Introduction to Programming
eBook - ePub

Introduction to Programming

Learn to program in Java with data structures, algorithms, and logic

Nick Samoylov

Compartir libro
  1. 722 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Introduction to Programming

Learn to program in Java with data structures, algorithms, and logic

Nick Samoylov

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Get a solid understanding of Java fundamentals to master programming through a series of practical steps

Key Features

  • Enjoy your first step into the world of programming
  • Understand what a language is and use its features to build applications
  • Learn about a wide variety of programming applications

Book Description

Have you ever thought about making your computer do what you want it to do? Do you want to learn to program, but just don't know where to start? Instead of guiding you in the right direction, have other learning resources got you confused with over-explanations?

Don't worry. Look no further. Introduction to Programming is here to help.

Written by an industry expert who understands the challenges faced by those from a non-programming background, this book takes a gentle, hand-holding approach to introducing you to the world of programming. Beginning with an introduction to what programming is, you'll go on to learn about languages, their syntax, and development environments. With plenty of examples for you to code alongside reading, the book's practical approach will help you to grasp everything it has to offer. More importantly, you'll understand several aspects of application development. As a result, you'll have your very own application running by the end of the book. To help you comprehensively understand Java programming, there are exercises at the end of each chapter to keep things interesting and encourage you to add your own personal touch to the code and, ultimately, your application.

What you will learn

  • Understand what Java is
  • Install Java and learn how to run it
  • Write and execute a Java program
  • Write and execute the test for your program
  • Install components and confgure your development environment
  • Learn and use Java language fundamentals
  • Learn object-oriented design principles
  • Master the frequently used Java constructs

Who this book is for

Introduction to Programming is for anybody who wants to learn programming. All you'll need is a computer, internet connection, and a cup of coffee.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Introduction to Programming un PDF/ePUB en línea?
Sí, puedes acceder a Introduction to Programming de Nick Samoylov en formato PDF o ePUB, así como a otros libros populares de Ciencia de la computación y Programación en Java. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2018
ISBN
9781788834162

Interfaces, Classes, and Object Construction

This chapter explains to readers the most important aspects of Java programming: Application Programming Interfaces (APIs), object factories, method overriding, hiding, and overloading. An explanation of the design advantage of aggregation (versus inheritance) follows, starting the discussion around software system design. The chapter concludes with an overview of Java data structures.
In this chapter, we will cover the following topics:
  • What is an API?
  • Interface and object factory as APIs
  • Overriding, hiding, and overloading
  • The this and super keywords
  • Constructors and constructor overloading
  • Final variable, final method, and final class
  • Object association (aggregation)
  • Exercise – Restricting a class instantiation to a single shared instance

What is an API?

The term Application Programming Interface (API) is a specification of protocols, procedures, and services that can be used as building blocks by a programmer to implement a required functionality. An API may represent a web-based system, operating system, database system, computer hardware, or software library.
In addition to that, in everyday life, the term API is often applied to the system that implements the specification. For example, you might be familiar with Twitter APIs (https://developer.twitter.com/en/docs) or Amazon APIs (https://developer.amazon.com/services-and-apis), or you might have worked with devices (sensors) that are able to respond to a request by providing the data (measurement results). So, when programmers say we can use an Amazon API, they mean not only the description of the provided procedures, but the services themselves.
In Java, we have also a few variations of the term API usage that we would like to identify and describe in the following subsections.

Java APIs

Java APIs include two big groups of APIs and libraries that implement them:
  • Java core packages (http://www.oracle.com/technetwork/java/api-141528.html) that come with the Java installation and are included in the JDK
  • Other frameworks and libraries that can be downloaded separately, such as Apache Commons APIs (https://commons.apache.org), for example, or the three libraries we have already included as dependencies in the Maven pom.xml file of our demo project. The vast majority of them can be found in the Maven repository (https://mvnrepository.com), but a variety of new and experimental libraries and frameworks can be found eslewhere.

Command line APIs

A command line API describes the command format and its possible options that can be used to execute the application (tool). We have seen such examples when we talked about using the tools (applications) java and javac in Chapter 1, Java Virtual Machine (JVM) on Your Computer. We even built our own application in Chapter 4, Your First Java Project, defined its API, and described its command line API as accepting an integer as a parameter.

HTTP-based APIs

A web-based application often provides an HTTP-based API using a variety of protocols (https://en.wikipedia.org/wiki/List_of_web_service_protocols) that allow access to the application functionality via the internet. HTTP stands for Hypertext Transfer Protocol, which is an application protocol for distributed information systems that serves as the foundation of data communication for the World Wide Web (WWW).
The two most popular web service protocols are:
  • XML-based SOAP (Simple Object Access Protocol) protocol
  • JSON-based REST or RESTful (REpresentational State Transfer) style over HTTP protocol
Both describe how functionality (services) can be accessed and incorporated into the application. We do not describe web services in this book.

Software component API

A software component may be a library, an application subsystem, an application layer, or even a single class--something that can be used directly from Java code by invoking its methods. An API of a software component looks like an interface that describes method signatures which can be invoked on the objects of classes that implement the interface. If the component has public static methods (which do not require objects and can be invoked using classes only), these methods have to be included in the API description as well. But for a complete description of the component API, as we have mentioned already in Chapter 2, Java Language Basics, the information about how the objects of the component can be created should be part of the API description, too.
In this book, we are not going beyond application boundaries and will use the term API only in the sense of a software component API, as described previously. And, we will call the entities that implement an API (the services that the API describes) by their names: application subsystem, application l...

Índice