In chemistry, affinity chemistry was subject of study, dominant between 1718 and into the 1830s, that sought to explain chemical reaction via various theories of chemical attraction or “affinity”, such as chemical affinity or elective affinity, preexisting, in various levels, between all chemical species or elements. 
The initiator of affinity chemistry, in its primordial form, was Greek philosopher Empedocles (495-435 BC), the first human chemist, famous for his noted chemistry aphorisms of how people mix or sort:
“People who love each other mix like water and wine; people who hate each other segregate like water and oil.”
This logic later came to be codified into about ten laws of affinity, as extolled upon in the works of Plato and others.
The name affinitas was first used in the sense of chemical relation by Albertus magnus in circa 1250.
In 1675, French chemist Nicolas Lemery, in his Course of Chemistry, supposedly, used “elective affinities” as terminology that describes the replacement of one metal by others in the chemistry of salts. 
The modern theory of affinity chemistry, the transition from alchemy to chemistry, arose in the works and theories of English physicist Isaac Newton. His 1678/79 letter to Robert Boyle was preoccupied with the phenomenon of elective affinity among chemicals. In his letter to Boyle, he states, for example: 
“There is a certain secret principle in nature by which liquors are sociable to some things and unsociable to others. Thus water will not mix with oil but readily with spirit of wine or with salts.”
American science historian William Newman, in his summarized rewrite of Newton's letter, elaborates on this further: 
“Just as water ‘elects’ to mix with ethyl alcohol or with salts, so it ‘chooses’ not to mix with oil, Similarly, water will sink into wood while quicksilver will not, but quicksilver will penetrate and amalgamate with metals, which water will not. Likewise aqua fortis (nitric acid) will dissolve silver and not gold, while aqua regis (mixed nitric and hydrochloric acid) will dissolve gold and not silver. Nonetheless these rules are not written in stone: ‘but a liquor which is of itself unsociable to a body may by a mixture of a convenient mediator be made sociable. So molten lead which alone will not mix with copper or with Regulus of Mars, by the addition of tin is made to mix with either.”
Newton goes on, in his writing of this period, to speak about how “particles of spirits floating in the water, will strike on metal, and will by their sociableness enter into its pores, and gather around the outside of its particles.” The finalized version of Netwon's search, research, and experiments for this "secret principle" was presented some three decades later, following his successes in gravitational theory, in his famous Query 31 of the 1718 edition of his Opticks. That very same year (1718), French chemist Étienne Geoffroy, while doing a translation into French of Newton's Opticks, famously took the "verbal descriptions" of affinity reaction preferences and powers of combination and decombination, as found in Query 31, and made the world's first "affinity table" (see: Geoffroy's affinity table), the first of many to follow over the next century. The biggest was Swedish chemist Torbern Bergman 1775 which took up a large eight-page fold out map-like sheet showing the results of some 160 different reactions.
What is called the "old theory" of elective affinity, to note, according to some, is said to refer to the works of English chemist John Mayow (1674), French chemist Étienne Geoffroy (1718), and Swedish chemist Torbern Bergman (1775). 
It was Geoffroy, however, who made the first affinity table ; thus establishing affinity chemistry as a branch of science and invariably giving seed and momentum to the chemical revolution. 
Incorporation into modern theory
In 1852, though the “theory of chemical valencies” of English chemist Edward Frankland, the degree of affinity attachment of each species was beginning to be incorporated into the soon-to-be science of quantum chemistry (1910s), solidifying eventually with American chemical engineer Linus Pauling’s 1928 article “On the Nature of the Chemical Bond”; and in the 1870s, the measure of affinity was determined to be that of free energy, thus incorporating this aspect of affinity chemistry into the new science of chemical thermodynamics, and beginning 
Affinity chemistry is still to be found in modern science, albeit it is buried deep inside of connective theories of logic, such as affinity chromatography.  Likewise, in the modern drug-receptor thermodynamic theory of “drug-receptor affinity”, affinity is defined as the “tendency of a drug molecule to bind to a receptor”, a movement process quantified by intricate Gibbs free energy models. 
German polymath Johann Goethe based his 1809 romance novella Elective Affinities on the work of Bergmann, arguing a theory that human relationships, specifically in reference to the passions of love, are determined by elective affinity preferences.  This publication thus founded the science of human chemistry; albeit the modern version uses the logic of chemical thermodynamics and quantum chemistry to argue the same view. 
1. (a) Comstock, John Lee. (1825). A Grammar of Chemistry (section 49: Affinity, pgs. 41-55). S.G. Goodrich.
(b) Turner, Edward and Bache, Franklin. (1830). Elements of Chemistry (Section I: Affinity, pgs. 102-114). John Grigg (publisher).
2. (a) Partington, J.R. (1937). A Short History of Chemistry (pgs. 137, 322). Dover.
(b) Geoffroy, Étienne F. (1718). Tableau des différentes Rapports Observées entre Différentes Substances (Table of the Different Relations Observed between Different Substances). France.
(c) Bergman, Torbern. (1775). A Dissertation on Elective Attractions. London: Frank Cass & Co.
3. Kim, Mi Gyung. (2003). Affinity, That Elusive Dream – A Genealogy of the Chemical Revolution. Cambridge, Mass: The MIT Press.
4. Levere, T. (1993). Affinity and Matter – Elements of Chemical Philosophy [1800-1865]. New York: Taylor & Francis.
5. Mohr, Peter and Pommerening. (1985). Affinity Chromatography (section: History of Affinity Chromatography, pgs. 7-18). CRC Press.
6. Raffa, Robert B. (2001). Drug-Receptor Thermodynamics - Introduction and Applications (Section: Drug-Receptor Affinity, pg. 4). New York: John Wiley & Sons.
7. Goethe, Johann. (1809). Elective Affinities. New York: Penguin Classics.
8. Thims, Libb. (2007). Human Chemistry (Volume Two), (preview), (ch. 10: "Goethe's Affinities", pgs. 371-422). Morrisville, NC: LuLu.
9. Newman, William R. (2003). Gehennical Fire: the Lives of George Starkey, and American Alchemist in the Scientific Revolution (Elective affinity, pgs. 231-34). University of Chicago Press.
10. (a) Shaik, Sason. (2007). “The Lewis Legacy: the Chemical Bond—a Territory and Heartland of Chemistry”, Journal of Computational Chemistry, 28(1): 51-61.
(b) Nicolas Lemery – Wikipedia.