Introduction to Programming
eBook - ePub

Introduction to Programming

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

Nick Samoylov

Partager le livre
  1. 722 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Introduction to Programming

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

Nick Samoylov

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

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.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Introduction to Programming est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Introduction to Programming par Nick Samoylov en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Ciencia de la computaciĂłn et ProgramaciĂłn en Java. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
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...

Table des matiĂšres