Refactoring in Java: Improving code design and maintainability for Java developers 1st Edition Anonymous instant download
Refactoring in Java: Improving code design and maintainability for Java developers 1st Edition Anonymous instant download
https://ebookmeta.com/product/refactoring-in-java-improving-code-
design-and-maintainability-for-java-developers-1st-edition-
anonymous/
https://ebookmeta.com/product/refactoring-improving-the-design-
of-existing-code-2nd-edition-martin-fowler/
https://ebookmeta.com/product/java-to-kotlin-a-refactoring-
guidebook-1st-edition-duncan-mcgregor/
https://ebookmeta.com/product/devops-tools-for-java-developers-
best-practices-from-source-code-to-production-containers-4th-
edition-stephen-chin-2/
https://ebookmeta.com/product/survivors-2-a-lost-world-harem-1st-
edition-jack-porter/
https://ebookmeta.com/product/fight-to-win-inside-poor-people-s-
organizing-1st-edition-a-j-withers/
https://ebookmeta.com/product/routine-outcome-monitoring-in-
couple-and-family-therapy-the-empirically-informed-therapist-
tilden-terje/
https://ebookmeta.com/product/python-for-scientists-3rd-edition-
john-m-stewart/
https://ebookmeta.com/product/combat-core-1st-edition-jim-smith/
Principles of Pathophysiology 2nd Edition Shane Bullock
https://ebookmeta.com/product/principles-of-pathophysiology-2nd-
edition-shane-bullock/
Refactoring in Java
Copyright © 2023 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the publisher,
except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express
or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable
for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing
cannot guarantee the accuracy of this information.
Production reference:1081223
Grosvenor House
11 St Paul’s Square
Birmingham
B3 1RB, UK.
ISBN 978-1-80512-663-8
www.packtpub.com
I dedicate this book to Cristina, the love of my life, and my children, Alessandro and Andrea.
I believe, in life, the most important thing is to keep learning and getting better.
Thanks for showing me something new every day.
– Stefano
Contributors
Siddhesh Nikude is a software craftsperson who believes in improving the world’s software
development by writing better software and teaching others how to do it. He carries over 10+ years
of experience and prefers calling himself a generalist.
Siddhesh started his career as a smart card developer, where he was introduced to Clean Code and
XP. It was then he started working in an iterative and incremental approach to notice effective
results. Not only does it improve the design and safety of the software, but it also improves the lives
of the people working on it. He has worked in a variety of roles from developer to transformation
coach on a variety of projects. He has mentored teams in B/TDD, mutation and micro testing, CI/CD
pipelines, XP/Lean practices, Clean Code and SOLID principles, DORA metrics, Monte-Carlo
simulation, Scrum, Delivery Automation, Test Pyramid, User Stories/Slicing, and Chartering. As a
developer, he has worked with Java, Kotlin, Go, TypeScript, React-Native, and so on.
Table of Contents
Preface
What is Refactoring?
What do we mean by refactoring?
Refactoring and clean code
Misconceptions about refactoring
Why you should consider refactoring
Improving the design of your software
Maintainability and scalability
Understanding, avoiding, and fixing bugs
Faster development
When you should refactor
The “Rule of Three”
Preparatory refactoring for smooth feature implementation
Refactoring for bug fixing
Comprehension refactoring
The “Boy Scout Rule”
Planned refactoring
Long-term refactoring and “Branch by Abstraction”
Refactoring in a code review
What you should refactor
Impact analysis
Risk assessment
Value estimation
Prioritization matrix
Further considerations
Refactor or rewrite?
Summary
Further reading
Code Smells
Duplicated code
Long methods
Replace temporary variables with query methods
Parameter object
Replace a function or method with a command
Decompose conditionals
Split loops
Large classes
Switches
Primitive Obsession
Middle man
Message chains
Feature envy methods
Divergent change
Shotgun Surgery
God object
Summary
Further reading
Testing
Why you should test (often)
Identifying and fixing defects
Ensuring quality and reliability
Customer satisfaction
Compliance and standards
Security
Integration and compatibility
Confidence and peace of mind
Unit testing
JUnit framework
Integration testing
Mockito
Contract testing
Be safe – checking and improving your test coverage
What is test coverage?
A Java code coverage tool – JaCoCo
Test-driven development
Advantages of TDD
Summary
Further reading
Refactoring Techniques
Writing better methods
Extract Method
Inline Method
Extract and inline variables
Combining a function into a class
Moving features between objects
Moving a method or field
Moving statements into/from methods
Hiding delegates
Removing dead code
Organizing data
Field encapsulation
Replacing primitives with objects
Replacing type code with subclasses
Simplifying conditional logic
Returning a special case instead of null
Using polymorphism instead of conditions
Removing duplicated conditions
Guard clauses
Simplifying method calls
Avoiding side effects
Removing setter methods
Using generalization
Pull up field
Push down field
Pull up method
Push down method
Template method
Using enums instead of constants
Summary
Further reading
Metaprogramming
What is metaprogramming?
Exploring compile-time metaprogramming tools
Lombok
MapStruct
Exploring runtime metaprogramming tools
Reflection
Weighing the pros and cons of metaprogramming
Summary
Further reading
Index
Language: English
NOTES ON
Diseases of Swine, Sheep,
Poultry and the Dog
Cause, Symptoms and
Treatments
BY
CHARLES J. KORINEK, V.S.
Graduate of the Ontario Veterinary College, in affiliation with the University
of Toronto, Canada. Hon. Member of the Ontario Veterinary Medical
Society. Ex. State Veterinarian for Oregon. Ex. President of the Oregon
State Veterinary Medical Board of Examiners. Author of “The Veterinarian”.
Principal of the Veterinary Science Association of America. Sixteen years of
Practical Experience as a Veterinary Surgeon.
PUBLISHED BY THE
VETERINARY SCIENCE ASSOCIATION
OF AMERICA
COPYRIGHT 1917
by the
VETERINARY SCIENCE ASSOCIATION
OF AMERICA
TABLE OF CONTENTS.
Chapter I. Diseases of Swine, Cause, Symptoms and Treatment 6
Chapter II. Diseases of Sheep and Goats, Cause, Symptoms and
Treatment 37
Chapter III. Diseases of Poultry, Cause, Symptoms and Treatment 60
Chapter IV. Diseases of the Dog, Cause, Symptoms and Treatment 85
TABLE OF ILLUSTRATIONS.
Points of Swine 3
Points of Sheep 35
Points of Poultry 58
Points of the Dog 83
DISEASES OF
SWINE
1. Mouth.
2. Nostrils.
3. Face.
4. Eyes.
5. Ears.
6. Jaws.
7. Jowl.
8. Neck.
9. Shoulder.
10. Fore flanks.
11. Chest floor.
12. Pasterns.
13. Dew claws.
14. Sheath.
15. Belly.
16. Side or ribs.
17. Heart girth.
18. Back.
19. Loin.
20. Rump.
21. Coupling.
22. Rear flanks.
23. Tail.
24. Thigh.
25. Hocks.
PREFACE
This chapter on diseases of swine has been written with the purpose of
placing in the hands of Students and the Veterinary Profession, a book of
practical worth; hence, all unnecessary technical language or terms have been
eliminated and only such language used as all may read and understand.
The treatment recommended in each disease is one I have used and found
efficient in my many years of practice as a Veterinary Surgeon.
If my readers will study the following chapter carefully, they will save much
unnecessary loss to the swine industry and be of great value to the
community in which they reside.
Charles J. Korinek, V. S.
CHAPTER I.
HOG REGULATOR AND TONIC.
Nux Vomica, one pound; Hardwood Charcoal, two pounds; Sulphur, two
pounds; Common Salt, three pounds; Sulphide of Antimony, one and one-half
pounds; Glauber Salts, two pounds; Bicarbonate of Soda, four pounds;
Hyposulphite of Soda, four pounds; Nitrate of Potash, one pound; Quassia,
one-half pound; Gentian Root, one pound; Iron Sulphate, one pound;
pulverize and mix well.
To every one hundred pounds of hog weight, give one tablespoonful in feed
or swill once or twice daily. For hogs weighing two hundred pounds, the dose
would be two tablespoonfuls; for a hog weighing fifty pounds, one-half
tablespoonful.
Hogs, like other animals, require tonics, bowel regulators and worm
expellers. For these purposes, I have prescribed under a number of the
diseases of hogs, which I cover in this chapter, the above general tonic and
regulator which I have used in my personal practice with marked success,
especially serving the purpose of aiding hogs in the convalescence from
debilitating diseases and in their recovery from a general run-down condition.
Aside from its general tonic and regulative effect, this prescription contains
nerve tonics, intestinal antiseptics, laxatives, worm expellers, and aids
digestion, etc.
If regularly given to hogs, and sanitary conditions are maintained, this tonic
and regulator will largely fortify them against contagious diseases.
ABORTION.
Cause.—Sows may abort at any state of pregnancy by slipping, falling,
receiving kicks, or by being caught while crawling through or under fences.
Sows may also abort when allowed to crawl into quarters where there are
other hogs. Contagious diseases, such as Cholera and Pleuropneumonia also
produce abortion. There is also a contagious form of abortion in sows, but this
is very uncommon, as the disease spreads very slowly.
Symptoms.—There is no warning given, as a rule; the sows expel their pigs
before any signs of abortion are noticed.
In other cases the sows refuse to eat, become uneasy, shivering and
trembling of the muscles, and straining or labor pains are noticed. As a rule,
when a sow aborts, she will not prepare a bed, as she would normally.
Treatment.—Preventive is the only safe and sure treatment, although when
the first signs of abortion appear, and there are no signs of the membranes
coming away, remove the sow to quiet, warm, clean quarters by herself, and
if straining, give one dram of Chloral-Hydrate in her drinking water every two
or three hours.
When a sow aborts, burn the pigs and afterbirth, and disinfect the pens
with a Coal Tar disinfectant. Keep this up for several days, and do not breed
until all discharges from the vagina have ceased flowing.
BAG INFLAMMATION.
Cause.—Injuries, obstructed teats, accumulation of milk in the sow’s bag
after the loss of part or all of her litter. Difficult birth, slight wounds in the bag
permit invasion of germs, which is frequently the common cause of bag
inflammation.
Symptoms.—Heat, pain and swelling in one or more teats. The general body
temperature is elevated one or two degrees above normal. The sow perhaps
refuses her feed, although she will drink water in large quantities.
Treatment.—Feed soft, sloppy food and vegetables. Give Epsom Salts, two to
four ounces, in milk or feed. It is also well to milk the sow by hand, relieving
her of the milk three or four times a day. This is very necessary. Camphorated
Oil is very soothing, and I would recommend its use freely over affected teats.
BLACK TOOTH.
Cause.—Black Tooth, so called in swine, is principally due to injuries to the
teeth received by chewing hard matter, such as bone, etc., which causes them
to decay.
Symptoms.—Toothache. Toothache in swine is similar to that exhibited by
man, in showing loss of appetite, salivation, or slobbering, hanging the head
mostly to the side which is affected, loss of fear of man, and offensive breath.
If the hogs are fed on strongly acid food for any length of time, their teeth
may become dark colored. As the teeth are not materially injured, so long as
decayed tooth substance cannot be noticed, and while the appetite and
chewing facilities of the hog do not appear to be diminished, no interference
will be necessary.
It is customary with some people to examine the teeth of hogs, and if one
tooth is found darker colored than the others, it is supposed to be the cause
of the hog not doing well, if he is in poor condition, and the tooth is
hammered off flush with the jaw, leaving the broken roots, lacerated gums
and nerves to increase the hog’s suffering. If the hog recovers, it is often
concluded that this was a case of Black Tooth.
My advice is, if you are determined to have the tooth out, extract it
properly. Do not break it off. When your hogs are not thriving, give them the
regulator and tonic prescribed on the first page of this chapter.
BLOOD POISONING.
(Pyemia Septicemia)
BRONCHITIS.
Cause.—Lung worms, poorly ventilated sleeping quarters, sleeping in straw
stacks, in manure heaps, over-heated, filthy pens, where the animals inhale
irritating gases given off the bodies of other hogs, and from filth. Smoke and
dust are very common producers of bronchitis.
Symptoms.—Breathing fast, appetite poor, slight rise in temperature and
coughing. The hog is dull and stupid, refuses food, but drinks water
frequently.
Treatment.—Preventive; avoid the above named causes, but when hogs
become affected, move them to clean, well ventilated quarters, avoiding dust
and gases, disinfect bedding and floors with some good disinfectant, as Crude
Carbolic Acid, sprayed. Also give large doses of the hog regulator and tonic as
prescribed on the first page of this chapter. Feed vegetables, or any easily
digested food, and hot wheat bran mashes.
In case the disease is due to lung worms, confine the animals in a closed
shed and permit them to inhale the steam from Turpentine and water for a
few minutes, by placing water and Turpentine in a tin receptacle holding
about two gallons, and inserting heated bricks or stones into the solution.
CASTRATION.
This is generally understood by every stockraiser, yet there are some points
many do not know. For instance, you should use in this operation an
antiseptic solution, as Carbolic Acid or Bichloride of Mercury. Wash thoroughly
with antiseptic your hands and knife, also the seat of operation and make
your incision as low as possible to permit the pus to drain out nicely. If this is
not practiced, the pus will become absorbed into the blood, producing blood
poison, which may produce death, or at the best will cause the hog to
become stunted, whereas, if the operation is performed properly, the hog will
thrive, regardless of the shock from the operation. I may add that it is much
better to castrate pigs or hogs when their stomachs or intestines are empty,
and it is always good practice to feed laxative and easily digested foods
sparingly after this operation.
CHOKING.
Cause.—Vegetables such as potatoes, etc., roots, as carrots, turnips and
sometimes pieces of bone or glass, lodge in the gullet. Paralysis of the
muscular fibres of the gullet is a very common cause of choking in swine.
Symptoms.—The hog is unable to swallow, producing a frothing at the mouth
and, if the obstruction cannot be dislodged, death occurs in a very short time.
Sometimes the obstruction in the gullet may be felt from the outside with the
hand.
Treatment.—The administration of small doses of Raw Linseed or Olive Oil, or
Lard, will assist in dislodging the obstruction. Also careful manipulation of the
gullet from the outside with the hand assists in either forcing it into the
stomach or bringing it out through hog’s mouth. If vomiting can be produced,
it will dislodge the obstruction. If immediate results are not obtained from the
above treatments, I would recommend butchering the hog for meat
immediately.
HOG CHOLERA.
(Swine Fever)
Cause.—By the Bacillus Sius; contaminated food, stagnant water, filth, etc.,
all have a tendency to aid its progress. I have seen farms, although located in
sections where Cholera was prevalent, not in the least troubled with the
malady, perhaps due to careful feeding of clean foods, care in watering,
cleanliness about the pens and sheds and disinfecting occasionally, but no
doubt a better explanation is that those hogs received tonics, containing
worm expellers, at least four times a year. Many a case of supposed Hog
Cholera is due to worms irritating and producing inflammation of the
intestines, followed by diarrhoea. A person not familiar with the disease calls
this “hog cholera.” In other cases, hogs which are fed swills from restaurants,
hotels, etc., containing soap, washing powders, small particles of glass, etc.,
will die with symptoms leading a person to think they had Hog Cholera, but if
a thorough investigation is made the true cause of death can easily be
discovered.
Symptoms.—In true Hog Cholera, the temperature will be elevated two to
four degrees above normal. There will be a loss of appetite, vomiting,
diarrhoea, although there may be constipation when the hog is first affected.
The hog wanders off by itself to some cool, quiet place and lies down. When
it walks it will stagger and show great stiffness in its hind parts, due to
soreness of the intestines. The hair will have a roughened appearance, the
back arched, the eyes inflamed and discharging pus, red blotches will show
themselves back of the ears, inside the legs and on the abdomen. At this
stage the diarrhoea is watery, dark and tinged with blood, and very offensive
in odor, breathing is very fast and labored. The hog grows very weak and
dies.
Treatment.—Prevention must always be borne in mind. Do not feed filthy
food. Always feed good, wholesome food, and give clean water to drink.
Watch the condition of hog’s bowels and regulate them by feeding. Burn
manure and bedding and disinfect carefully. Do not permit your hogs to drink
out of running streams of water, especially if Hog Cholera is in your
neighborhood. When buying hogs, it is well to keep them off by themselves
for two or three weeks, as they may be diseased. Do not permit neighbors,
their stock or dogs on premises when Hog Cholera is raging, as the infection
of Hog Cholera can be spread very rapidly by matter from the affected hogs
adhering to the shoes of man, to the feet of stock and hogs, etc.
I am positive that if this method were properly practiced by all hog raisers
and feeders, Hog Cholera would be a very rare disease.
Serum Treatment.—This is successful in some cases, and in others
unsuccessful. The latter perhaps is due to poor serums, or the disease being
so far advanced in its progress that the hogs are beyond recovery. Serum
treatment is very expensive and, as it requires a strictly septic operation of
injecting the serum, the average hog raiser or grower is not qualified to
administer the treatment properly. An additional and necessary expense is the
services of a Veterinary Surgeon. Therefore, I strongly urge adoption of
preventive measures as stated. Use some good disinfectant, such as Crude
Carbolic Acid, which destroys the Bacillus of Hog Cholera. Also administer hog
regulator and tonic as prescribed on first page of this chapter. This will expel
worms, tone the system, regulate the bowels and fortify your hogs against
Hog Cholera.
INDIGESTION.
Cause.—Worms are perhaps one of the most common causes.
Unwholesome, irritating food or swill containing soap or washing powder have
a tendency to derange the process of digestion.
Symptoms.—Abdominal pain, vomiting, back arched, breathing rapid and
temperature elevated from two to three degrees. There may be diarrhoea or
the animal may be constipated. Vomiting, as a rule, relieves acute attacks by
expelling the irritant from the bowels. When it takes a chronic form, the hogs
become stunted.
Treatment.—Endeavor to find out the cause and remove it. If constipated,
give Calomel, fifteen to twenty grains, or, if diarrhoea appears, give hog
regulator and tonic as prescribed on first page of this chapter. Feed with hot
wheat bran mashes. This will expel all worms and aid digestion.
JAUNDICE.
(Yellows)
KIDNEY CONGESTION.
Cause.—Hogs are subject to various injuries about the kidneys, due to a
large number of hogs piling up, exposure to cold, wet rains, etc.
Symptoms.—Small quantities of dark colored urine are passed frequently,
appetite poor, no energy to move about. Hogs lie around a great deal; at
times they may be paralyzed and drag their hind quarters.
Treatment.—Apply cloths or blankets wrung out of hot water over the loin;
also give Potassium Acetate in twenty grain doses four or five times a day in
drinking water. Feed soft, sloppy food, containing regulator and tonic as
prescribed on the first page of this chapter. It contains nerve stimulants, just
what is required in paralysis.
KIDNEY WORM.
Cause.—Damp, filthy surroundings seem to favor the growth of embryos of
this worm. They are taken into the digestive canal with the food and
eventually pass to the region of the kidneys, where they find conditions
favorable in which to multiply.
Symptoms.—May produce paralysis of the hind quarters, in which case the
animal would not exhibit such marked tenderness on being pressed over the
loins with the fingers as it would if the weakness of the hind quarters was due
to a sprain or to rheumatism of the loins. Occasionally hogs may suffer from
the presence of one or more worms in the kidneys; but the ailment is rarely
fatal, becoming so only after a long time of suffering resulting in a
degeneration of one or both kidneys. It is almost impossible to diagnose the
presence of worms in the kidneys of hogs, except by chance through a
microscopic examination of the urine. If worms are found in the kidneys of a
hog that has died or has been slaughtered for food it may then be reasonably
supposed that other hogs of the same herd not acting normal are infected
with worms of the same species.
Treatment.—Teaspoonful doses of Turpentine in milk three times a week is
the only treatment I could recommend. Preventive measures is the only
practical method of treating a disease of this nature. Give your hogs pure
water and food. Disinfect pens occasionally and keep them clean.
LICE ON HOGS.
Dip, spray or scrub your hogs with some good Coal Tar disinfectant, but
whatever remedy is used it should be applied more than once which, of
course, causes considerable work where there is a large number of hogs
infested, unless dipped, which is more quickly done. The reason for repeated
applications being necessary is that although the lice which hogs pick up from
the ground, bedding and rubbing places, may be killed by first application, it
often does not affect the nits, which remain intact and hatch within a week or
ten days. A new crop of Lice appears on the hog from this source. Remove all
manure and bedding from pens and sheds and burn it. Disinfect floors and
spray sides of shed, pens and rubbing places with disinfectants, one part to
seventy-two parts of water, once a month and you will be handsomely repaid
for your labor.
LUNG FEVER.
(Inflammation of the Lungs)
LUNG WORMS.
Cause.—By thread-like worms varying in length from one-half to one and
one-half inches and of brownish-white color. They are found in the windpipe
and tubes leading into the lungs. The adult worms in the lungs produce large
quantities of eggs, which are coughed up with mucus and become scattered
over premises where other hogs are permitted to walk. The hogs inhale the
dust containing the eggs into their lungs, where the eggs find moisture
sufficient for their development.
Symptoms.—Severe coughing spells. Large quantities of mucus will escape
from the nose and mouth. The hog becomes stunted, although he may eat
fairly well, but if not relieved, the worms collect in the Bronchi and produce
sudden death due to suffocation. The worms may set up an inflammation of
the lining membranes of the lungs, which is sometimes taken for Swine
Plague, or Cholera. This disease is not uncommon, especially in old, filthy,
poorly drained hog houses and pastures.
Treatment.—Confine the affected hogs to a shed; close the windows and
doors and any large cracks, then compel the hogs to inhale steam from the
following mixture: Turpentine, eight ounces; Pine Tar, one pint; Water, two
gallons. Place in tin receptacle in center of the shed and heat the above
solution by adding hot bricks or stones to the mixture occasionally. Compel
them to inhale this steam for at least thirty minutes twice a day. Feed
wholesome food to which add hog tonic as prescribed on first page of this
chapter. A strong, vigorous hog may have worms, but it retains its vitality so
long as it is well fed.
MANGE.
Cause.—By the Sarcoptes Scabei. This parasite burrows under the outer
surface of the skin.
Symptoms.—The parasite usually manifests itself on the skin under the
armpits, thighs and inside of the fore legs. At first small red blotches or
pimples appear, and these gradually spread as the parasites multiply and
burrow under the skin.
Treatment.—There is no other way of curing this disease, or of preventing it,
than by killing the parasites and their eggs; not only on the pigs themselves,
but also on the sides of the pens, sheds, rubbing-posts, or anything that an
affected hog rubs against.
When treating this disease, the real aim must be to kill the parasite by the
prompt and continuous use of external remedies, such as washing or dipping,
which is better done with some good disinfectant, one part to seventy parts
water. Repeat this every ten days until cured. Two dippings are generally
sufficient. It is well to feed cooling foods, such as clean slops and vegetables,
containing regulator and tonic as prescribed on first page of this chapter.
NAVEL RUPTURE.
(Navel or Umbilical)
PILES.
(Prolapse of the Anus)
Cause.—Although the pig may look well, he has a weakness of the circular
fibres of the intestines, due to irritating foods that either constipate or
produce diarrhoea.
Symptoms.—Very plain. A protrusion of the rectum all the way from two to
four inches. The pig irritates the protrusion by rubbing it against the sides of
pens, etc.; it cracks, bleeds and in warm weather will become fly-blown and
maggots accumulate in large quantities.
Treatment.—In the first stages of this disease, wash the protruded parts with
an antiseptic solution of Carbolic Acid, one teaspoonful to a pint of water. Give
rectal injections of Soap and Warm Water or Sweet Oil, give about two ounces
of Castor Oil internally and feed soft, sloppy food. In chronic cases of long
standing, remove the exposed portion of the intestine after washing nicely
with the antiseptic solution. Remove the protrusion with a sharp knife and
stitch the cut end of intestine edges to the anus. Feed easily digested food,