Introduction to Programming
eBook - ePub

Introduction to Programming

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

Nick Samoylov

Buch teilen
  1. 722 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Introduction to Programming

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

Nick Samoylov

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

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.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Introduction to Programming als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Introduction to Programming von Nick Samoylov im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Ciencia de la computación & Programación en Java. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

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

Inhaltsverzeichnis