Immediate download (Ebook) Polymorphism in Java: Methods and polymorphic algorithms applied to computer games by Privitera, Carlos Alberto ISBN 9781725953420, 1725953420 ebooks 2024
Immediate download (Ebook) Polymorphism in Java: Methods and polymorphic algorithms applied to computer games by Privitera, Carlos Alberto ISBN 9781725953420, 1725953420 ebooks 2024
com
DOWLOAD EBOOK
ebooknice.com
https://ebooknice.com/product/sat-ii-success-
math-1c-and-2c-2002-peterson-s-sat-ii-success-1722018
ebooknice.com
ebooknice.com
https://ebooknice.com/product/como-criar-programas-usando-
java-44194894
ebooknice.com
(Ebook) Applied Evolutionary Algorithms in Java by Ghanea-
Hercock, Robert ISBN 9781468495263, 1468495267
https://ebooknice.com/product/applied-evolutionary-algorithms-in-
java-55586028
ebooknice.com
ebooknice.com
ebooknice.com
https://ebooknice.com/product/algorithms-and-networking-for-computer-
games-5891156
ebooknice.com
ebooknice.com
POLYMORPHISM IN
JAVA
POLYMORPHISM IN
JAVA
Methods and polymorphic algorithms
applied to computer games
Advanced level
Book information:
Title: Polymorphism in Java
Edition: 1st edition 2018
Author: Carlos Alberto Privitera
ISBN-13: 978-1725953420
ISBN-10: 1725953420
Date of the first edition: spring 2018
To my children
Foreword
This book stands out for teaching programming based on polymorphism. Abundant examples in
Java code and illustrative graphics of the main ideas related to the topic: Polymorphism in Java.
The book "Polymorphism in Java" aims to give a modern and updated vision when learning Java
and in the particular subject of polymorphic algorithms. Students, teachers and developers will be
able to find a sequence of design patterns that create and use polymorphic algorithms, these
design patterns can be applied to solving problems of computer systems and everyday life.
A professional in the Java language can benefit from the book "Polymorphism in Java" by finding
an innovative way to solve problems with polymorphic algorithms. The design patterns, analyzed
in this work, are based on the inheritance between classes. Currently the difficulties of the Java
language have been overcome to a large extent and it is easy to understand and apply.
The book aims to teach fundamental concepts of object-oriented programming with Java SE, in a
clear and practical way, significantly reducing the learning curve. In the process you will learn to
program computers and use the Java SE language.
Goals:
The present work aims that readers get strong knowledge in computer programming with the
Java SE language.
Get the reader to acquire practical skills by using advanced Java SE concepts.
Have the reader write computer programs based on object-oriented programming with the
Java SE language.
Level of the book: it is of advanced level. It requires knowledge of the basic details of the Java SE
language.
Content
Chapter I .......................................................................................................................................................... 13
Introduction ................................................................................................................................................. 13
Proposal for a basic architecture .............................................................................................................. 13
Design pattern based on inheritance ............................................................................................................ 14
Layered architecture to use a design pattern ............................................................................................... 15
Description of the design pattern based on the inheritance ......................................................................... 16
Types of relations between classes........................................................................................................... 16
Java has a keyword to declare each relationship ...................................................................................... 16
Criteria for building groups of configurations of patterns of architectures by layers ..................................... 16
What are abstract methods? .................................................................................................................... 16
What are abstract classes? ....................................................................................................................... 16
What is an interface? ............................................................................................................................... 16
There are two ways to declare abstract methods: .................................................................................... 17
How to overwrite methods that are abstract? .......................................................................................... 17
Criteria for assembling the different configurations of a design pattern ................................................... 17
What is a reference in Java? ..................................................................................................................... 17
What is an object in Java? ........................................................................................................................ 17
Structure of the book ................................................................................................................................... 18
Graphical representation of the groups of configurations of a design pattern .......................................... 18
Group number one of configurations ........................................................................................................... 19
Structure of the design pattern ................................................................................................................ 19
Configuration 1.1 - Create the object reference using the super class and the creation of the objects using
the subclasses. .................................................................................................................................... 20
Java UML diagram for 1.1 configuration – Variant 1: A reference, an object in memory ........................... 24
Source code for 1.1 Configuration – Variant 1....................................................................................... 25
Explanation of the most relevant lines of code in the 1.1 Configuration – Variant 1 .............................. 27
Java UML diagram for configuration 1.1 - variant 2: Many references, an object in memory by reference 34
Source code for configuration 1.1 - variant 2 ........................................................................................ 35
Explanation of the most relevant lines of code in configuration 1.1 - variant 2 ...................................... 36
Configuration 1.2 - References of objects and objects are created using the subclasses ........................... 38
Utility of configuration 1.2 .................................................................................................................... 39
Java UML diagram for configuration 1.2 ................................................................................................... 41
Código fuente para la configuración 1.2 ............................................................................................... 42
Explanation of the most relevant lines of code in configuration 1.2 ...................................................... 45
Group number two of configurations ........................................................................................................... 55
What happens if subclasses are declared with the abstract class modifier? .............................................. 55
Diagram of Java classes in UML - Configuration 2, possibility 1 (Inherit a pattern) .................................... 58
Source code of configuration 2, possibility 1 (Inherit a pattern) ............................................................ 59
End of chapter I - "How to use abstract classes in class inheritance" ................................................................ 62
Chapter II ......................................................................................................................................................... 65
How to use the classes that are of type Interface in the inheritance relation between classes? .................... 65
Group number three of configurations......................................................................................................... 65
What is an interface? ............................................................................................................................... 65
Example of an interface declaration: ........................................................................................................ 66
Configuration 3.1 - Creating the references of objects using the superclass and the creation of the objects
using the subclasses. ........................................................................................................................... 67
Characteristics of the configuration 3.1 - variant 1: a reference and many objects ................................ 67
Java class diagram in UML for configuration 3.1 - variant 1: a reference and many objects ....................... 68
Source code for configuration 3.1 - variant 1 ........................................................................................ 69
Explanation of the most relevant lines of code, pertaining to configuration 3.1 - variant 1 ................... 72
UML diagram in Java for configuration 3.1 - variant 2: many references and one object by reference ...... 79
Characteristics of the configuration 3.1 - variant 2: many references and one object by reference ....... 80
Source code for configuration 3.1 - variant 2 ........................................................................................ 80
Configuration 3.2 - Create references to objects and objects using subclasses.......................................... 82
Configuration utility 3.2 ........................................................................................................................... 82
How to implement the algorithms that are static? ................................................................................... 82
How to implement algorithms that are dynamic? ..................................................................................... 82
What is the static assignment of the reference? ....................................................................................... 82
What is the dynamic assignment of the reference? .................................................................................. 83
Class diagram in Java for configuration 3.2 - variant 1 .............................................................................. 84
Class diagram in Java for configuration 3.2 - variant 2 .............................................................................. 89
Source code for configuration 3.2 - variant 2 ........................................................................................ 90
Chapter III ........................................................................................................................................................ 93
Polymorphic algorithms that are mutable .................................................................................................... 93
Visit https://ebooknice.com to
discover a wide range of
eBooks across various genres.
Enjoy exclusive deals and
discounts to enhance your
reading experience. Start your
digital reading journey today!
What are mutable polymorphic algorithms? ................................................................................................ 93
What are mutable methods? ....................................................................................................................... 93
Class diagram for polymorphic algorithms that are mutable. Combination 1 - variant 1............................ 95
Source code that implements mutable polymorphic algorithms. Combination 1 - variant 1 ...................... 96
Class diagram in UML for mutable polymorphic algorithms. Combination 2 - variant 1 ........................... 100
Source code that implements mutable polymorphic algorithms. Combination 2, variant 1 ..................... 101
Chapter IV ..................................................................................................................................................... 105
Programming a computer game ................................................................................................................. 105
Polymorphic code of the game ............................................................................................................... 105
View of the computer game: Fly to the end................................................................................................ 106
Class diagram in Java for the Game: Fly to the end ..................................................................................... 107
Structure of folders and packages for the source code in Java .................................................................... 110
Source code in Java for the game view module .......................................................................................... 111
Source code for the classes that implement the client module ................................................................... 114
Source code for classes that implement the specialized behavior provider................................................. 118
Farewell words .............................................................................................................................................. 130
POLYMORPHISM IN JAVA
Chapter I
Introduction
In the construction of a software product, different structures are defined that determine the
architecture of the software that will be built. The basic structures in Java are the classes and the
relationships between the classes. Many times, a structure forms a recurring pattern in the
construction of a software product. A programmer attentive to identifying structures and patterns
can define an appropriate architecture to solve problems or build software. A proper architecture
is as important as the development process in software engineering.
A layer structure can determine an appropriate architecture to define specific functions that are
placed as strata; each layer can be replaced by a new layer without affecting the others. A precise
and unique communications interface must be defined between the layers.
Layer 3 - Polymorphism
Layer 3 is the layer where polymorphic methods and polymorphic algorithms are written. Layer 4
separates the implementation of the polymorphic algorithms from the implementation of the
solution of the problem; the polymorphic algorithms express different ways of using a solution of
a problem.
Página 13 de 130
POLYMORPHISM IN JAVA
Design pattern based on inheritance
Link
Superclass
Subclasses
Abstract methods
Interface
The image shows a generic representation of a design pattern based on the inheritance between
classes. Certain restrictions will configure different design patterns more suitable to be
implemented in Java.
Página 14 de 130
POLYMORPHISM IN JAVA
Layered architecture to use a design pattern
The following image shows an architecture made by layers. Each layer has a certain function to
implement, use and show the solution of a problem.
Link
Static Dynamic
polymorphic polymorphic
methods methods Superclass
Static Dynamic
polymorphic polymorphic Subclasses
algorithms algorithms
• Abstract methods
• Interface
Página 15 de 130
POLYMORPHISM IN JAVA
Description of the design pattern based on the inheritance
The configurations can be divided into three groups, the criteria used to assemble the different
groups of configurations is the declaration of abstract methods and the implementation of abstract
methods by superclasses or subclasses.
What is an interface?
The interface is a totally abstract class; it does not have Java code in its body. The interface declares
prototypes of abstract methods that will be inherited by other classes. Classes that inherit an
interface should overwrite the abstract methods and implement the missing code.
Página 16 de 130
POLYMORPHISM IN JAVA
Programmers usually link the declaration of the reference and the creation of the object in a line of
code. The following line of code is a declaration of a reference to an object and the creation of an
object instance: Rectangulo rectangulo = new Rectangulo(3, 4);
Página 17 de 130
POLYMORPHISM IN JAVA
Structure of the book
Design pattern
Mutable
Polymorphism Polymorphism
polymorphism
Group properties
Create references Create objects
Superclass
Subclass
Interface
Página 18 de 130
POLYMORPHISM IN JAVA
Group number one of configurations
In group number one, there are configurations where the superclass is declared abstract, within this
group there are two configurations. Configuration number one declares the object reference using
the name of the superclass and the creation of the objects using the constructors of the subclasses.
The second configuration creates the reference of objects and objects using the subclasses.
This group has the fundamental characteristic that it prevents to create an object using the
constructor of the superclass. When declaring the superclass as abstract, it is not possible in Java
to create an object of an abstract class. In this group all the objects that can be created must be
created using the constructors of the subclasses.
Group properties
Create references Create objects
Superclass (abstract) Yes Not allowed
Subclass Yes Yes
In group one there are two very interesting configurations that form an adequate architecture to use
the inheritance pattern between classes.
Each configuration of the group includes an additional restriction that forces to make a correct use of
the design pattern.
The design pattern must declare an interface of public methods that can be invoked by the classes
that want to access the pattern. The design pattern is a provider of behaviors.
The design pattern has to be encapsulated in a package and allow or restrict one of the following
four functions, depending on the problem you wish to solve.
In this book we will make a detailed study of the first two functions: 1) declare references of the
subclasses or the superclass, 2) declare objects of the subclasses or the superclass.
The possibilities of extension and changes in the design pattern will be left out of the study, in this
book. A detailed study will be made on the use of the design pattern by other classes. The classes
that will use the design pattern are called "clients."
Classes that are clients of the design pattern may implement polymorphic methods and algorithms.
Página 19 de 130
POLYMORPHISM IN JAVA
Configuration 1.1 - Create the object reference using the super class and the creation of the
objects using the subclasses.
In the configuration 1.1 a new restriction is added, in the new restriction it is not advisable to create
references of the subclasses. In this configuration there are two restrictions: it is not feasible to
create objects of the superclass and it is not recommended to create references of the subclasses.
If there is a reference there may be a specialized object in memory. The only reference works like a
pointer that goes through the objects one by one. To access a new object you have to destroy the
current object and build a new object.
Página 20 de 130
Visit https://ebooknice.com to
discover a wide range of
eBooks across various genres.
Enjoy exclusive deals and
discounts to enhance your
reading experience. Start your
digital reading journey today!
POLYMORPHISM IN JAVA
If you have an object reference that points dynamically to different objects, it can happen that the
use of memory is reduced but the work of the garbage collector Java is very arduous; On the
other hand, when many references to objects are created, the use of memory is more likely to
increase and the work of the garbage collector decreases.
Dynamic assignment of new objects to a single reference causes objects not referenced in memory
to be cleaned by the Java garbage collector.
If the problem to be solved needs to create references to the subclasses, it would be appropriate to
use the 1.2 configuration or another configuration of another group.
The dynamic assignment of the reference to a new object allows the application of the dynamic
polymorphism mechanism, using the unique reference, unique messages can be sent to different
specialized objects.
To apply or use the mechanism of the dynamic polymorphism, it is necessary to send messages to
the objects through the methods interface. Each object must implement the same methods
interface.
The messages are sent to the methods implemented in the objects, if all the objects implement the
same methods interface then it is feasible to send the same message to each object. Each object
will implement a different algorithm and behave differently even if the message sent is the same.
The programmers, are very creative, write algorithms based on objects that send messages.
Algorithms based on sending messages are called polymorphic algorithms. Do not confuse
message-based polymorphic algorithms with specialized algorithms that are implemented in the
objects that receive the messages. Polymorphic algorithms are programmed in clients that use the
class inheritance pattern; the specialized algorithms are programmed in the subclasses or
superclasses of the pattern.
Objects that receive messages from another object implement behavioral algorithms and algorithms
that send messages to another object are called polymorphic algorithms.
From the point of view of the classes we can say that there are classes, clients, that send messages
and classes, servants or suppliers, that respond to messages. The client classes implement
polymorphic algorithms and the supplying classes implement behavioral or specialized
algorithms.
Java classes have three mechanisms to implement interfaces of data access methods or algorithms
that they implement.
1. Inherit an interface: the Java keyword "implements" is used.
2. Declare abstract methods: the Java keyword "abstract" is used.
3. Declare public methods of access to private or encapsulated data.
Página 21 de 130
POLYMORPHISM IN JAVA
Layered Application Organization
Scheme that shows the relationship between: the algorithms that are polymorphic and the algorithms
that have a specialized behavior.
Supplier pattern
Implements behavioral
Client
algorithms
Implements
polymorphic Superclass
algorithms
Interface of abstract
methods
It is advisable to organize the system into at least two layers, one layer for classes that are clients
and another layer for classes that are suppliers.
The same reasoning can be used if the application was designed with three or more layers. The
packets may contain other packets so one layer may contain other layers or sublayers. In Java, a
package is a folder created by the Operating System.
Página 22 de 130
POLYMORPHISM IN JAVA
IDEs, (Integrated Development Environments), are tools that help create applications that will
contain Java code projects. The projects will contain packages and the packages will contain files
with source code written in the Java language.
Página 23 de 130
POLYMORPHISM IN JAVA
Java UML diagram for 1.1 configuration – Variant 1: A reference, an object in memory
Página 24 de 130
POLYMORPHISM IN JAVA
Source code for 1.1 Configuration – Variant 1
package app;
import patron.Figura;
import patron.Rectangulo;
import patron.TrianguloRectangulo;
System.out.println(figura.getClass().getName());
System.out.println(" Altura = " + figura.getAltura());
System.out.println(" Base = " + figura.getBase());
System.out.println(" Área " + figura.area());
System.out.println(" Color " + figura.obtenerColor());
Página 25 de 130
POLYMORPHISM IN JAVA
package patron;
import java.awt.Color;
//Niveles de control de acceso public para clases, una clase pública puede ser
accedida por cualquier clase de cualquier paquete
//Una clase sin modificador puede ser accedida por una clase de su mismo paquete
package patron;
import java.awt.Color;
@Override
public Integer area() {
return this.getAltura() * this.getBase();
}
Página 26 de 130
POLYMORPHISM IN JAVA
@Override
public Color obtenerColor() {
// TODO Implement this method
return color;
}
}
package patron;
import java.awt.Color;
@Override
public Integer area() {
return (this.getAltura() * this.getBase()) / 2;
}
@Override
public Color obtenerColor() {
// TODO Implement this method
return color;
}
Explanation of the most relevant lines of code in the 1.1 Configuration – Variant 1
This line of code indicates that the class Main{} belongs to the package called app, the package
called app will contain the classes of the layer named client.
package app;
Importing the classes from the package called patron. The package named patron will contain
the classes of the layer named proveedor. Unfortunately, the 1.1 configuration must have
access to all classes in the proveedor layer.
import patron.Figura;
import patron.Rectangulo;
import patron.TrianguloRectangulo;
Declaration of the Main{} class, the class named Main{} must be public. The JVM must find the
Main{} class to create a memory instance.
Página 27 de 130
POLYMORPHISM IN JAVA
Declaration of the constructor method called Main(), the Main() method must be public and
homonymous to the Main{} class. The JVM will search and execute the Main() method at the
time of creating an instance of the Main{} class.
Declaration of the constructor method, with the name of Main(). The Main() method must be
public and homonym to the Main{} class. The JVM will search and execute the Main() method
at the time of creating an instance of the Main{} class.
public Main() {
super(); //invoca el constructor de la superclase Object
}
Declaration of the reference to objects with the name of: unaFigura. The unaFigura reference is
of type Figure{}. The unaFigura reference is not pointing to an object instance.
Statement of the main() method, the main() method will be searched and executed by the JVM at
the time of instantiating the Main{} class.
Main main = new Main(); //el objeto main tiene información relevante a
la clase Main{}
This statement will point to the reference named unaFigura to the new object created by the
constructor named Rectangulo().
The following line of code will execute the Polymorphic method called polimorfismo() with the
parameter of type Figura{} and the argument of the type Rectangulo{}.
A method is polymorphic when the JVM must decide which method to execute depending on the
type of parameter and the argument type. The JDK cannot predict at design time which method to
run because it does not know the argument type of the parameter.
polimorfismo(unaFigura);
The reference, called unaFigura, is pointed to a new object created by the constructor named
TrianguloRectangulo(). The rectangle object does not have a valid reference and must be
cleaned by the garbage collector. A reference is polymorphic if it is feasible to change the
referenced object type.
Página 28 de 130
POLYMORPHISM IN JAVA
unaFigura = new TrianguloRectangulo(6, 8);
The following line of code executes the polymorphic method called polimorfismo(), the method
has the parameter of type Figura{} and the argument of the parameter of type
TrianguloRectángulo{}.
polimorfismo(unaFigura);
The following code declares the dynamic polymorphic method called polimorfismo(), the
dynamic polymorphic methods are characterized by having the parameters of a type and the
arguments can be of another type. The parameter is of type Figure{} and the arguments can be
of the type Rectangulo{} and TrianguloRectangulo{}. The dynamic polymorphic
methods have polymorphic algorithms; the polymorphic algorithms are characterized by having
different behaviors depending on the argument assigned to the parameter. Dynamic polymorphic
methods send messages and are received by the classes that are providers of the different
behaviors. The classes that are clients implement polymorphic algorithms and the classes that are
providers implement specialized behavior algorithms. The main feature of dynamic polymorphic
algorithms is that they change their behavior depending on the argument assigned to the
parameter.
Summary of Concepts:
• A method is polymorphic if it is overloaded in its parameters or arguments or both.
• An algorithm is polymorphic if it always sends the same message to classes that are
providers of behaviors. The class, client, Main{} sends messages getAltura(),
getBase(), area() y getColor() to classes that are providers of such behaviors.
• Classes that are customers implement polymorphic methods and algorithms, polymorphic
methods, and polymorphic algorithms send messages to classes that are providers of
specialized behaviors.
Página 29 de 130
Random documents with unrelated
content Scribd suggests to you:
not only began, but ceased not, even as the friend whom he had
found, to combat with the spiritual armor, and if possible, to
overcome, in an evangelical manner, the Pope and the Roman
Church, in various points, touching mostly her ceremonies.
Thereupon he was also accused, and put to death in such a manner
as in the proper place, we presently hope to show.
The accusations brought against him were of the same nature as
those preferred against Albert, his companion; which was not at all
strange, since he had placed himself under Albert, not only as a
friend and companion, but also as a disciple. For this reason, the
Pope, through the accusation of Boniface, the papal Legate,
pronounced the same excommunication against him.
But when he presented himself for the purpose of vindicating his
conduct in a full synod, Boniface prevented him from taking this
course, making the people believe that it were not lawful to admit a
heretic who had been excommunicated or excluded from the church,
to divine worship, or to a synodal assembly; yea, that such an one
should not be permitted to have the benefit (in whatever this might
consist) of the laws or ordinances of the church.
Seeing that by this pretense his lips were sealed, making it
impossible for him to properly defend himself, he had recourse to his
pen and wrote a book concerning this matter, against Boniface.
Finally, it is stated and maintained that this steadfast witness of
Jesus Christ, was burned as a heretic by the Romanists, even against
the will of Pope Zacharias, about A. D. 750, or a little after.
Compare this entire account of Clement with Willibaldi, Naucleri,
Aventini. Balae. Alij ubi supra. Also, Annal. Boj. Bernhard. Lutz, in
Catal. Hæres., Tom. 2, Concil. Also, A. M., 2d book, H. M., 1619, fol.
328, 329. Hist. Mart. I. S., 1645, fol. 30.
FURTHER OBSERVATIONS TOUCHING THE CASE OF ALBERT AND CLEMENT,
ACCORDING TO THE ACCOUNT OF SEBASTIAN FRANCK.
“In the year” etc., “these two men drew to them much people in
France, pretending to be followers of the apostles, and speaking
great things of the mysteries of God, and the life and conduct of
man. Boniface, Archbishop of France, wrote the whole matter to the
Pope, who, in a council of the bishops, laid it before them. They
rejected the opinion of the (supposed) heretic from the church.”
Finally he says: “They were unanimously deposed and
anathematized.” Chron. Rom. Kett., fol. 64.
[This account begins with a sad lamentation, that nearly all the
learned and celebrated men were corrupted through the Roman
superstitions.
Immediately, however, a consolation follows, namely, that in this
corrupt age there were still people who did not adhere to the Roman
superstitions.
Then it is shown from Haimo, that teaching must precede baptism;
that the candidate must first be instructed; that he must first be
enlightened, etc. Thereupon, in the margin, A. D. 821, it is noticed
that Christus Taurinensus wrote against the invocation of images, of
the cross, of relics, of the saints, and against the power of the Pope,
pilgrimages, etc. In the margin, for the year 825, a certain council of
Paris is adduced, against image worship. In the same place, Gratian
says that Christians must not oppose weapon with weapon, but flee
before persecution.
Rabanus Maurus appears, A. D. 830, and teaches how in his time
the catechumens were prepared for baptism. Of those who asked for
baptism, and made haste for it. His exposition of Cant. 3:6: “Who is
this that cometh up white as snow?” Again, that the candidate must
previously be instructed in the faith of the incarnation of Jesus
Christ; also, that in the sacrament of the Supper, the language is
figurative.
Angelomus follows Rabanus, teaching that the sins which have been
committed through the senses, are washed away (that is, forgiven)
in or through baptism; which is more fully explained.
Thereupon, A. D. 840, Bertram, Heymon, and Walafrid appear, who
declare themselves against the Roman church, in various points, as
in the matter of baptism, transubstantiation, justification, good
works as practiced by the papists.
The council of the Christians at Paris, in the time of Louis and
Lothaire, is introduced; lamentation on account of the encroachment
of infant baptism, and the neglect of the instruction once connected
with baptism.
The conversion of the Slaves (of Slavonia) is stated; also, that they
were baptized, though not according to the Roman custom, nor in
the Roman language. Marginal notice, for A. D. 843, that Christus
Lupim at Ferrara refuted the new Roman doctrines, as purgatory.
A few good things respecting the baptism of adults are adduced, for
the year 848, and explained in a simple manner. In the margin, for
A. D. 858, it is stated of Gunther, Bishop of Cologne, that he calls the
Pope a tyrant, yea, a wolf.
Idiota declares that in baptism we accept Christ as our bridegroom.
In the margin, mention is made of Ulric, Bishop of Augsburg, that he
accused the Pope of error.
Hincmar, Bishop of Landun, opposes the baptism of infants, and
prohibits their being baptized; on account of which he is severely
accused.
Paschasius advances three things which are incompatible with infant
baptism.
Remigius teaches against the Pope; likewise, Tergand, Bishop of
Triers, who calls him antichrist, and Rome Babylon. Conclusion from
P. J. Twisck and John Patrick.]
Jesus Christ our Savior, speaking of the grievous times which should
come after his departure, says, (Matt. 24:12): “And because iniquity
shall abound, the love of many shall wax cold.” This was experienced
at this time; for with the growth and increase, through very many
ungodly and unrighteous superstitions, of the iniquities of the Pope
of Rome and the whole Roman church, the true love for God’s
commandments decreased, so that but few were found, who, as
bright lights, penetrated the smoke that came up from the Roman
pit; yea, nearly all men of learning and celebrity were corrupt. O sad
and lamentable matter! 136
Nevertheless, as Noah and his family served God in the first world;
Lot, in Sodom; Daniel and the three youths, Shadrach, Meshach, and
Abed-nego, in Babylon; Elijah and the seven thousand who were
hidden and had not bowed their knees to Baal, in the land of Israel,
where the prophets of the Lord were slain, and his altars thrown
down; even so there remained some, though but few, at this time,
who, living in the midst of popery, did not adhere to the Roman
superstitions, but abhorred them.
However, in order to avoid prolixity, we shall confine ourselves,
omitting, as has been our custom, other points to the article of
baptism, except where it may be found necessary to add something
else; and shall show when and by whom this article, with the
rejection of infant baptism, was maintained salutarily and in the fear
of God, according to his words. Hence we will begin thus.
A. D. 814.—In the days of Louis the Pious, the first of this name,
who began to reign with the year 814, there lived and wrote the
celebrated Haimo, of whom various praiseworthy things concerning
baptism upon faith are still extant.
Haimo, on Matt. 28:19, (Bapt. Hist. page 561,) writes: “In this place
the order how to baptize aright is pointed out to us; in which it is
ordained, that teaching must precede baptism, for he says: ‘Teach all
nations;’ and then adds: ‘baptizing them.’ He, then, that is to be
baptized, must previously be instructed, that he may first learn faith,
which he shall afterwards receive in baptism.
How could any one give clearer testimony concerning the true
baptism of Jesus Christ? how, also, could anybody more plainly
reject infant baptism, than by such a declaration? every word
emphatically says it.
He begins with Matt. 28:19, where the Lord says: “Go ye therefore,
and teach,” or, in other words make disciples of; which he explains
thus: “that teaching must precede baptism;” for the Lord first says:
teach, and then, baptize, and that therefore he that is to be
baptized, must first be instructed, and learn the faith. Certainly,
these are things which pertain only to the adult and intelligent;
hence it would be sinning against the truth to apply them to
unintelligent infants.
Haimo (Serm. Domin. 12, Trinit., page 564) says: “Since those who
are baptized, must first be enlightened with the grace of the Holy
Spirit, then instructed by the teachers, and finally called to confess
the faith, hence arises the custom that,” etc.
This accords fully with the preceding; for he declares the same still
more plainly, since here not only instructing is joined to baptizing,
but the illumination of the Holy Spirit, the instruction of the teachers,
and the confession of the faith are connected with, yea, required
before baptism; which is so clear, according to the purport of the
first declaration, that it is unnecessary to add another word; the
impartial may judge. As to what he further says in the same place,
concerning the touching of the tongue, the saying of the word
Hephphatha, etc., we leave as it is, neither praising nor censuring it,
since it is of little consequence, if the truth and the signification of
the matter is rightly preserved.
Haimo, on Rom. 1 (page 542), writes: “At the time of baptism we
confess that we believe on God the Father, and on the Lord Jesus
Christ, and on the Holy Ghost; likewise, that we renounce the devil
and all his pomp and works. If we observe this thus, we belong to
God in faith; but if we do not, we are convinced of unbelief. 137
A little before, in his exposition of Rom. 6 (page 540), he makes
mention of four different baptisms: 1. In the water only, as was
John’s baptism. 2. In fire and the Spirit, with which the apostles
were baptized on the day of Pentecost. 3. In water and the Spirit,
which baptism then obtained in the church. 4. In the shedding of the
blood with which the Lord himself and all the holy martyrs were
baptized.
These four different baptisms can pertain to none but the intelligent
and believing; for, as regards the first, namely, John’s baptism, it is
expressly stated that those to whom it was administered, confessed
their sins and repented. Matth. 3:6,8,11. As to the second, namely,
the baptism of fire and the Holy Ghost, which was administered to
the apostles by God himself from heaven, this did not at all relate to
infants, seeing that all who were thus baptized, spake with tongues
and magnified God. Acts 2:3,4. Concerning the third, namely, the
baptism in water and the Spirit, which then obtained in the church,
this likewise could not be peculiar to infants, since the fruits of the
Holy Ghost, without which the Holy Ghost cannot be, do in no wise
appear in them. See Gal. 5:22. Respecting the fourth, namely, the
baptism by the shedding of blood, this, according to his statement,
is peculiar only to Christ and the martyrs; consequently it cannot be
regarded as applying to infants, for these do not even know of
confessing Christ, much less of suffering one’s blood to be shed for
his name’s sake, and of dying in constancy.
Continuing, he shows in the same place (Rom. 6) that in him that is
to be baptized, there must be three invisible things: 1. Faith. 2. The
soul, which is washed from sin. 3. The Holy Ghost, by whose
cooperation the forgiveness of sins is imparted. We would explain
these things more fully; but since this is a passage expressed in
almost the very words which Albinus, in the preceding century, for
the year 792, wrote (on John 15), of which we gave an explanation,
we will, to avoid repetition, take leave therefrom, referring the
reader to said explanation.
Haimo teaches, on Canticles 4 (page 544), that all who desire to
become brethren must be baptized, saying: “Without the washing of
baptism, no one can be a true believer.”
What else is this than what the holy Scripture teaches, namely, that
in baptism we put on Christ? and that by faith (which is professed in
baptism) we become the children of God? Paul says: “Ye are all the
children of God by faith in Christ Jesus. For as many of you as have
been baptized have put on Christ.” Gal. 3:26,27.
But some one may think: Haimo speaks of becoming brethren by
baptism; whereas Paul speaks of becoming children of God, of
putting on Christ, etc. True, beloved reader; but who, with only a
little experience in the holy Scriptures, knows not that to be a child
of God, or to be a brother of the church of Christ, is one and the
same thing? Certainly, it is the same; for the same Spirit that makes
us children of God, also makes us brethren of Christ, yea, joint heirs
with him. Rom. 8:15–17. For this reason, Christ calls them both his
brethren and his children, saying: “I will declare thy name unto my
brethren, in the midst of the church will I sing praise unto thee.” And
again: “Behold, here am I and the children which God hath given
me.” Hebr. 2:12,13. Who now shall say that Haimo, who calls the
baptized, brethren, and Paul, who terms them children of God,
contradict each other? Their accordance is sufficiently proven, and at
this we will let it rest.
Of the dignity of baptism, Haimo, on Hos. 2 (page 547), says:
“Baptism is sanctified by faith in the sufferings of our Lord.”
“What doth hinder me to be baptized?” said the Ethiopian to Philip.
Philip replied: “If thou believest with all thine heart, thou mayest,”
Acts 8:36,37; indicating that, in order to receive baptism worthily,
sincere faith is required, by which baptism is sanctified, which is just
what Haimo has expressed in the above words; and thus his words
agree with those of the holy Scripture which we have quoted. 138
The righteous, Haimo says, on Ps. 38 (page 548): “Live in baptism,
in which they die unto sin and the world.”
Again, on Ps. 136, he says: “By the Red Sea we understand holy
baptism, which (so to speak) is red, being sanctified through the
blood of Christ,” and a little further on: “By the impartation of the
same, the believers begin (to proceed) in the way by which they
come to God.”
On Zech. 13 he says: “When we receive the faith, we are
regenerated in Christ, and in baptism we are washed from all our
sins; and they that through faith are regenerated in baptism, are
made children of God.[typo?: ” missing]
Again, on Cant. 1, he speaks thus: “As Israel was preserved in the
Red Sea, but Pharaoh drowned, even so the church of the Gentiles,
by baptism, is delivered from the bondage of the devil, and led into
the true land of promise, to the liberty of the Gospel; thus she who
was formerly an handmaid of iniquity, is become a friend 139
[beloved] of Christ, cleansed and washed, by baptism, from the filth
of sin.”
These passages are like the jets of a fountain, which, though they
shoot forth in different places, proceed from one source. In the first
passage, it is said of the righteous, that they “live in baptism, yea,
die unto sin and the world.” The life spoken of here signifies a
spiritual life, and is contrasted with death, which comes by sin; the
dying unto sin and the world, signifies a forsaking and renouncing of
the same, which can be done only by those who previously adhered
to, and loved, sin and the world.
In the second passage, baptism is compared to the Red Sea, and it
is said that “by the impartation of the same, the believers proceed.”
But is not this the very thing which Paul spoke of the figurative
baptism of the believing patriarchs, saying: “Brethren, I would not
that ye should be ignorant, how that all our fathers were under the
cloud, and all passed through the (Red) sea; and were all baptized
unto Moses in the cloud and in the sea” (1 Cor. 10:1,2); which is not
to be understood of infants that were wont to be carried, but of
adult persons, who were able to proceed and walk.
In the third passage, faith, regeneration, baptism, and being made
children of God, are joined together. “They that through faith are
regenerated in baptism, are made children of God,” he writes. But
how can this be interpreted otherwise, than with reference to
intelligent persons, who, having attained to faith, by the hearing of
the word of God, are regenerated, and, in token thereof, baptized,
and adopted as children of God into his church? Faith certainly
comes by hearing, and hearing by the word of God. Rom. 10:17.
Regeneration takes place after the death of the first birth, or after
the mortifying of the old man. John 3:4,5; Rom. 6:4. Baptism is
administered to the believing and regenerated, as a sign of faith and
regeneration. Acts 8:37; Tit. 3:5. Those are made children of God,
who, through faith, have put on Christ, and, in proof of this, have
been baptized. John 1:12, compared with Gal. 3:26,27. Judge now,
whether these are things that can be done by new-born infants. I
am fully confident that you will say: No. Yet, these things are
connected with baptism, not only by Haimo, but principally by God,
in the holy Scriptures; yea, without them, baptism is of no value.
Hence we say: “What God has joined together, let not man put
asunder.” Matth. 19:6.
In the fourth passage it is said, that “The church of the Gentiles, by
baptism, is delivered from the bondage of the devil,” and that “she
who was a handmaid of iniquity, is (thus) become a friend [beloved]
of Christ.” This certainly savors not at all of infant baptism, for it
cannot be said of infants, that they are the church of the Gentiles,
under the bondage of the devil, a handmaid of iniquity, nor that
they, by baptism, are delivered from the service of the devil, and
become a friend of Christ. Certainly, no one can be delivered from
the service of the devil, but he who has served the devil; no other
can be liberated from the servitude of iniquity except she who
previously committed iniquity; she who previously blasphemed; no
other can be adopted as a friend of Christ, than she who formerly,
by wicked works, was at enmity with Christ; consequently it is
indisputable, that this cannot be understood of infants, seeing these
things can have no place with them; this even those who maintain
infant baptism, must admit, and hence we dismiss the subject.
“The adult (candidates) also made confession of their sins, and a
penance was imposed on them, for forty, twenty or seven days.”
Haimo, on Heb. 6, (p. 552).
Here adult and not infant candidates are spoken of, yea, such, upon
whom, when they had made confession of sins, a penance (or
amendment of life) was imposed; which are things pertaining to
adults, and not to little children; this is too plain to be refuted.
Said baptism was so firmly maintained and thus valued by Haimo,
that he held that it should never be repeated, if it had been
administered according to the rule of the holy Scriptures; for,
treating of the 6th chapter of Romans, he says, by way of
exposition: “If we have once died unto sin in baptism, we may not
be baptized again.” Bapt. Hist., p. 543. This well accords with the
custom of the Anabaptists of the present day; for, though they
rebaptize such as have been baptized in their infancy, when they
attain to the faith; regarding the baptism which is received in infancy
as no baptism at all, because it is not according to holy Scripture;
yet no one is rebaptized by them, who has been baptized aright,
that is, upon faith.
NOTE.—A. D. 825.—The council held at Paris, A. D. 825, decreed
against image worship. Sam. Veltius, Geslacht-register, page 127.
Gratian said to his cotemporaries: “The Lord, in saying to his
disciples: ‘When they persecute you in this city, flee ye into another,’
teaches that Christians when persecuted, should not repel weapon
with weapon, but flee therefrom”. See Grondelijke Verklaringe
Danielis ende Johannis, printed at Harlem, in the year 1635, p. 56.
A. D. 830. 140—It is stated that A. D. 830, in the sixteenth year of the
reign of Emperor Louis I., surnamed the Pious, there shone forth as
a bright light, and wrote, one Rabanus Maurus, residing at Fulda,
who, among various things written by him against the Roman
church, also speaks of baptism, in the discussion of which he
throughout employs such language as pertains only to believers, and
in no wise to infants; notwithstanding he at one time, it appears,
had been a maintainer of infant baptism, and many other
superstitions of popery, so much so that he had been an abbot. But
passing this by, we shall show what he wrote of baptism, and how
closely it agrees with the teaching of the holy Scriptures.
In Jacob Mehrning’s history of baptism, various passages from
Rabanus Maurus are adduced, some of which, it is suspected, have
been attributed to him unjustly, or, at least, that, if he has written
them, he wrote them before he was enlightened or converted; as,
among others, in lib. 2, de Proprit. Serm., cap. 200; again, lib. 4,
cap. 10; of which we let the intelligent judge.
Nevertheless various things are found, which, we doubt not, are
justly ascribed to him, as, for instance: Of the instruction of the
catechumens before baptism, and how the novices ought to learn
the faith before they are baptized. In Decretis de Consecrat. dist. 4,
cap. Ante Bapt., ex Rabano, Bapt. Hist., page 560. Likewise, the
quotation made by Vicecomes (lib. 2, cap. 40) from Rabanus (in lib.
de instruct. Cleric.), which reads as follows: “The order according to
which the catechumens are prepared for baptism, is this: First they
are interrogated whether they renounce the devil,” etc. Bapt. Hist.,
page 562. The rest we omit.
By this he indicates, that in his time, in the church of which he was a
member, the custom of preparing the novices for baptism was still
observed, inasmuch as first, the instruction of the faith, called the
catechism, was presented and taught them; also, that they had to
renounce Satan, &c.; which was observed not only at this time, but
in nearly all the preceding times, as appears from this passage:
“They are wont to renounce the devil with his works and pomp.”
Syn. Turon. Bapt. Hist., page 516, num. 7.
That in the time of Rabanus the instruction of novices extended not
only to those of heathen descent, but also to such as were born of
Christian parents, is declared by Jacob Mehrning, Bapt. Hist., page
560, contra Rulichium.
D. Vicecomes (lib. 3, cap. 9), quotes from Rabanus Maurus (page
562): “The fellow petitioners for baptism are those who, through the
doctrine of the faith, and by refraining from disorderly conduct,
make haste to receive the grace of Christ in baptism.”
This confirms our former assertion, namely, that before baptism a
preparation had to be made, in order that it (baptism) might be
received worthily; which preparation is here called “the doctrine of
the faith and refraining from disorderly conduct.” In it are comprised
both parts of the doctrine which John presented to those who came
to his baptism, saying: “Repent ye, and believe,” etc. Matt. 3:2,
compared with Mark 1:15, and Acts 19:4.
Moreover, they are called fellow petitioners, and it is said that “They
make haste to receive the grace of Christ in baptism,” which are
things that cannot be done by infants.
Hence he writes, on Cant. 3:6, (page 540): “Who is this that cometh
up white as snow?” applying the same to the candidates, who,
cleansed from their former sins, come up from baptism, and increase
in virtue. “This mystery,” he says, “is not otherwise than under the
invocation of the Holy Trinity, that is, in the name of the Father, of
the Son, and of the Holy Ghost; thus the Lord says to the apostles,
Matt. 28:19: ‘Go and teach,’ ” etc.
Hence, when he speaks of coming up from the water, and of the
invocation of the Holy Trinity, as well as of the passage, Matt. 28:19,
he sufficiently shows that he does not speak of the baptism of
infants, since they cannot come up from baptism, nor invoke the
Holy Trinity, nor fulfill the passage, Matt. 28; which is too clear to be
refuted. We will therefore briefly conclude this account of Rabanus
with that which P. J. Twisck records concerning him.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com