Introduction to Programming
eBook - ePub

Introduction to Programming

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

Nick Samoylov

Condividi libro
  1. 722 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Introduction to Programming

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

Nick Samoylov

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul 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.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Introduction to Programming è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Introduction to Programming di Nick Samoylov in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Ciencia de la computación e Programación en Java. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
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...

Indice dei contenuti