Dragon fruit cultivation in Sri Lanka (english)Green Lanka
GREEN LANKA was founded in 2017 and its principles (vision, mission, goals and target, achievements, promotion, trade approach and assessments of daily activities) were developed by a group of young-educated entrepreneurs. It is operated by GREEN LANKA, which utilizes a distinctly skilled and experienced team of professionals in performance with the extensive resources.
OUR AREAS ARE AGRICULURE RESEARCH ,AGRICULURE PRODUCTION,AGRICULTURE BASED INNOVATIONS ,ONLINE MARKETING..
MORE DETAILS GreenLanka mentors (pvt) ltd.
www.greenlanka.lk | +94 772984757
ravirajeevan@gmail.com
identification of weed plants ,commonly occurs in hilly region of Uttarakhand akanshasingh249
weed identification during PCP course (hilly region of Uttarakhand) .A weed is a plant considered undesirable in a particular situation, "a plant in the wrong place". weed control is very important in agriculture ,and this is possible ,only by proper identification of weed plants present in crop field. Here I am presenting some common weeds ,which occurs in hilly region of Uttarakhand.
Dragon fruit cultivation in Sri Lanka (english)Green Lanka
GREEN LANKA was founded in 2017 and its principles (vision, mission, goals and target, achievements, promotion, trade approach and assessments of daily activities) were developed by a group of young-educated entrepreneurs. It is operated by GREEN LANKA, which utilizes a distinctly skilled and experienced team of professionals in performance with the extensive resources.
OUR AREAS ARE AGRICULURE RESEARCH ,AGRICULURE PRODUCTION,AGRICULTURE BASED INNOVATIONS ,ONLINE MARKETING..
MORE DETAILS GreenLanka mentors (pvt) ltd.
www.greenlanka.lk | +94 772984757
ravirajeevan@gmail.com
identification of weed plants ,commonly occurs in hilly region of Uttarakhand akanshasingh249
weed identification during PCP course (hilly region of Uttarakhand) .A weed is a plant considered undesirable in a particular situation, "a plant in the wrong place". weed control is very important in agriculture ,and this is possible ,only by proper identification of weed plants present in crop field. Here I am presenting some common weeds ,which occurs in hilly region of Uttarakhand.
Litchi (Litchi chinensis) is a delicious juicy fruit of excellent quality. Botanically it
belongs to Sapindaceae family. Litchi fruit is famous for its attractive red colour, excellent
quality characteristics and pleasant flavor.
Soil and climate:
Litchi is a sub-tropical fruit and thrives best under moist sub-tropical climate. It usually
prefers low elevation and can be grown up to an altitude of 800 m. (m.s.l.). Deep, well drained
loamy soil, rich in organic matter and having pH in the range of 5.0 to 7.0 is ideal for the crop.
Litchi cannot tolerate frost during winter and dry heat in summer. The temperature should not
go beyond 40.5 0C in summer and below freezing point in winter. Prolonged rain may be harmful
especially at the time of flowering, when it interferes with pollination.
Cultivars:
A large number of varieties are grown in different parts of India. Bambia, Ellaichi,
Muzaffarpur, Seedless early, Seedless late, Shahi, Pottee, Rose scented, China, Purbi, and Kasab
are the suitable varieties for NE region.
Propagation:
Air layering is the most common method of propagation. Select healthy and vigorous one
year old twigs and remove 2 cm wide ring of bark just below a bud. IBA or Rooton may be
applied at cut portion for early and more rooting. The cut is surrounded by mud ball containing
moss (2 parts damp moss and 1 part of soil from the basin of old litchi tree) and wrapped with
polythene sheet. Both ends are tied with fine rope to make it air tight. When sufficient roots are
formed in about 2 months, the branch is cut below the soil or sphagnum moss and potted in a
nursery. July to October is the most appropriate time. About 6 months old air-layered plants
should be planted in permanent field in monsoon.
Planting:
Pits of 90 x 90 x 90 cm in dimension are dug at the spacing of 8 – 10 m apart in square
system. Pits are filled with topsoil mixed with about 40 kg decomposed compost, 2 kg
neem/karanj cake, 1 kg bone meal/single super phosphate and 200-300 g muriate of potash.
Incorporation of about 2 baskets of soil from the root zone of old lychee trees encourages the
mycorrhiza growth. Planting is done during June to July. At the time of planting a hole the size
of ball of earth is made in the centre of the pit at the marked point where the plant is fixed and
the soil is pressed to remove air. Watering is done immediately after planting for proper
establishment. Subsequently the plant is regularly irrigated till it is properly established.
Training and pruning:
Training of the plant in the initial stage is essential to provide the required framework.
Unwanted branches should be pruned to provide definite shape and to promote growth of the
trunk and crown of the tree. Three to four branches 60-75 cm from ground opposite to each other
are allowed to form the proper frame of the tree. Further, crowded and crisscross branches are removed to facilitate better growth.
Prepared by subash sapkota and sanjay aryal. A assignment topic to be prepared for the course Pomology, first semester under postgraduate 'MSc. Program, Agriculture and Forestry university, rampur chitwan
Diseases of pomegranate is not completely managed by adopting a single method of control. Therefore integrated approach of control measure is done to reduce the incidence of several diseases
It is plant of both aromatinc and medicinal purpose. The species comes under it are- arvensis, spicuta and piperata.But most commomly used species are-
Arvensis -Called Japanese mint in English and pudinah in hindi,
Spicuta - Called Spearmint in English and pudinah in hindi.
Family – Labiateae
Part used-
Leaves and flowering tops and in some cases whole plant.
Constituents-
Volatile oil- menthone , menthol , isomenthol , methyle acetate,neomenthol,piperitone.
Uses-
Aromatic,Digestive,stimulant,antiseptic,spleen disease,jaundice,antibacterial antifungal
Developers spend up to 20% of their time writing repetitive code that machines could generate more reliably. This presentation explores the problem of duplicated source code that stems from manual implementation of patterns and reveals how to automate the boring side of programming and get a 19x ROI.
The presentation provides insight into:
- the problem of manual implementation of patterns, resulting in boilerplate code
- the cost of boilerplate for companies
- existing technologies for pattern automation
- the key reasons to consider pattern-aware compiler extensions
The white paper was written for CTOs, software architects and senior developers in software-driven organizations—specifically in financial, insurance, healthcare, energy and IT industries that typically write a lot of repetitive code.
How I Learned to Stop Worrying and Love Legacy Code.....Mike Harris
Legacy Code. I never wrote it; everybody else did!
How many times have you waded through an ageing, decaying, tangled forrest of code and wished it would just die?
How many times have you heard someone say that what really needs to happen is a complete rewrite?
I have heard this many times, and, have uttered that fatal sentence myself.
But shouldn’t we love our legacy code?
Doesn’t it represent our investment and the hard work of ourselves and our predecessors?
Throwing it away is dangerous, because, before we do, we’ll need to work out exactly what it does, and we’ll need to tweeze out that critical business logic nestled in a deeply entangled knot of IF statements. It could take us years to do, and we’ll have to maintain two systems whilst we do it, inevitably adding new features to them both. Yes we get to reimplement using the latest, coolest programming language, instead of an old behemoth, but how long will our new cool language be around, and who will maintain that code, when it itself inevitably turns to legacy?
We can throw our arms in the air, complaining and grumbling about how we didn’t write the code, how we would never have written it the way it is, how those that wrote it were lesser programmers, possibly lesser humans themselves, but the code still remains, staring us in the face and hanging around for longer that we could possibly imagine. We can sort it out, we can improve it, we can make it testable, and we can learn to love our legacy code.
Litchi (Litchi chinensis) is a delicious juicy fruit of excellent quality. Botanically it
belongs to Sapindaceae family. Litchi fruit is famous for its attractive red colour, excellent
quality characteristics and pleasant flavor.
Soil and climate:
Litchi is a sub-tropical fruit and thrives best under moist sub-tropical climate. It usually
prefers low elevation and can be grown up to an altitude of 800 m. (m.s.l.). Deep, well drained
loamy soil, rich in organic matter and having pH in the range of 5.0 to 7.0 is ideal for the crop.
Litchi cannot tolerate frost during winter and dry heat in summer. The temperature should not
go beyond 40.5 0C in summer and below freezing point in winter. Prolonged rain may be harmful
especially at the time of flowering, when it interferes with pollination.
Cultivars:
A large number of varieties are grown in different parts of India. Bambia, Ellaichi,
Muzaffarpur, Seedless early, Seedless late, Shahi, Pottee, Rose scented, China, Purbi, and Kasab
are the suitable varieties for NE region.
Propagation:
Air layering is the most common method of propagation. Select healthy and vigorous one
year old twigs and remove 2 cm wide ring of bark just below a bud. IBA or Rooton may be
applied at cut portion for early and more rooting. The cut is surrounded by mud ball containing
moss (2 parts damp moss and 1 part of soil from the basin of old litchi tree) and wrapped with
polythene sheet. Both ends are tied with fine rope to make it air tight. When sufficient roots are
formed in about 2 months, the branch is cut below the soil or sphagnum moss and potted in a
nursery. July to October is the most appropriate time. About 6 months old air-layered plants
should be planted in permanent field in monsoon.
Planting:
Pits of 90 x 90 x 90 cm in dimension are dug at the spacing of 8 – 10 m apart in square
system. Pits are filled with topsoil mixed with about 40 kg decomposed compost, 2 kg
neem/karanj cake, 1 kg bone meal/single super phosphate and 200-300 g muriate of potash.
Incorporation of about 2 baskets of soil from the root zone of old lychee trees encourages the
mycorrhiza growth. Planting is done during June to July. At the time of planting a hole the size
of ball of earth is made in the centre of the pit at the marked point where the plant is fixed and
the soil is pressed to remove air. Watering is done immediately after planting for proper
establishment. Subsequently the plant is regularly irrigated till it is properly established.
Training and pruning:
Training of the plant in the initial stage is essential to provide the required framework.
Unwanted branches should be pruned to provide definite shape and to promote growth of the
trunk and crown of the tree. Three to four branches 60-75 cm from ground opposite to each other
are allowed to form the proper frame of the tree. Further, crowded and crisscross branches are removed to facilitate better growth.
Prepared by subash sapkota and sanjay aryal. A assignment topic to be prepared for the course Pomology, first semester under postgraduate 'MSc. Program, Agriculture and Forestry university, rampur chitwan
Diseases of pomegranate is not completely managed by adopting a single method of control. Therefore integrated approach of control measure is done to reduce the incidence of several diseases
It is plant of both aromatinc and medicinal purpose. The species comes under it are- arvensis, spicuta and piperata.But most commomly used species are-
Arvensis -Called Japanese mint in English and pudinah in hindi,
Spicuta - Called Spearmint in English and pudinah in hindi.
Family – Labiateae
Part used-
Leaves and flowering tops and in some cases whole plant.
Constituents-
Volatile oil- menthone , menthol , isomenthol , methyle acetate,neomenthol,piperitone.
Uses-
Aromatic,Digestive,stimulant,antiseptic,spleen disease,jaundice,antibacterial antifungal
Developers spend up to 20% of their time writing repetitive code that machines could generate more reliably. This presentation explores the problem of duplicated source code that stems from manual implementation of patterns and reveals how to automate the boring side of programming and get a 19x ROI.
The presentation provides insight into:
- the problem of manual implementation of patterns, resulting in boilerplate code
- the cost of boilerplate for companies
- existing technologies for pattern automation
- the key reasons to consider pattern-aware compiler extensions
The white paper was written for CTOs, software architects and senior developers in software-driven organizations—specifically in financial, insurance, healthcare, energy and IT industries that typically write a lot of repetitive code.
How I Learned to Stop Worrying and Love Legacy Code.....Mike Harris
Legacy Code. I never wrote it; everybody else did!
How many times have you waded through an ageing, decaying, tangled forrest of code and wished it would just die?
How many times have you heard someone say that what really needs to happen is a complete rewrite?
I have heard this many times, and, have uttered that fatal sentence myself.
But shouldn’t we love our legacy code?
Doesn’t it represent our investment and the hard work of ourselves and our predecessors?
Throwing it away is dangerous, because, before we do, we’ll need to work out exactly what it does, and we’ll need to tweeze out that critical business logic nestled in a deeply entangled knot of IF statements. It could take us years to do, and we’ll have to maintain two systems whilst we do it, inevitably adding new features to them both. Yes we get to reimplement using the latest, coolest programming language, instead of an old behemoth, but how long will our new cool language be around, and who will maintain that code, when it itself inevitably turns to legacy?
We can throw our arms in the air, complaining and grumbling about how we didn’t write the code, how we would never have written it the way it is, how those that wrote it were lesser programmers, possibly lesser humans themselves, but the code still remains, staring us in the face and hanging around for longer that we could possibly imagine. We can sort it out, we can improve it, we can make it testable, and we can learn to love our legacy code.
Scripting experts from Inductive Automation cover general best practices that will help you add flexibility and customization to HMI, SCADA, IIoT, and other industrial applications. Some specific tips about using scripting in the Ignition platform will be included as well.
In this webinar, learn more about:
• Common scripting pitfalls and how to avoid them
• The best programming languages to use
• Things to consider before using scripting
• How scripting environments work
• Scripting timesavers
• And more
Scripting experts from Inductive Automation cover general best practices that will help you add flexibility and customization to HMI, SCADA, IIoT, and other industrial applications. Some specific tips about using scripting in the Ignition platform will be included as well.
In this webinar, learn more about:
• Common scripting pitfalls and how to avoid them
• The best programming languages to use
• Things to consider before using scripting
• How scripting environments work
• Scripting timesavers
• And more
What is "Agile"?
Why would someone like to be agile?
What are the 3 pillars for agile software development?
How can you achieve technical excellence in your software teams?
Are developer skills more important than languages, methods or frameworks?
A talk explaining how to define `good code`. Using `Code Complete` as a reference to guide over the quality definition and introducing Linters (each category) for Golang.
Basic concept on Systems/Software Analysis, Design & Development, how software engineering, large projects are done, collaborated, best practices & standards.
Capability Building for Cyber Defense: Software Walk through and Screening Maven Logix
Dr. Fahim Arif who is the Director R&D at MCS, principal investigator and GHQ authorized consultant for Nexsource Pak (Pvt) Ltd) discussed the capability of building cyber defense in the Data Protection and Cyber Security event that was hosted recently by Maven Logix. In his session he gave the audience valuable information about the life cycle of a cyber-threat discussing what and how to take measures by performing formal code reviews, code inspections. He discussed essential elements of code review, paired programming and alternatives to treat and tackle cyber-threat
Container Days, 23.09.2021, online: Talk of Mario-Leander Reimer (@LeanderReimer, Principal Software Architect at QAware)
== Dokument bitte herunterladen, falls unscharf! Please download slides if blurred! ==
Abstract:
The clean code principles are well-known in modern, agile software development. But what has become the default for our business code, unfortunately by no means applies to our infrastructure code. Instead, we find badly crafted, complicated and highly tangled code that is manually tested using a trial and error approach. However, for modern cloud based systems the infrastructure code plays a crucial role. So it's about time we being to treat it as a 1st class citizen! In this hands-on session we show several useful patterns, practices, tools and frameworks that help to write and craft clean infrastructure as code.
Maintaining the product is one (if not the most) expensive area of the overall product costs. Writing clean code can significantly lower these costs, making it more efficient during the initial development and results in more stable code. In this session participants will learn how to apply C# techniques in order to improve the efficiency, readability, testability and extensibility of code.
How we think about branding at Jellypepper, including:
- Why branding is harder for startups... disruptive startups especially
- What makes a good brand
- The intersection of brand + culture
- What you can do as a startup to start creating a brilliant brand
(without investing a heap of cash)
Learning to unlearn: how to design for disruptive startupsHayden Bleasel
I was invited to the Sydney UI/UX meetup hosted at SafetyCulture to talk about designing for disruptive startups. I talked about what defines a startup, the cyclical nature of learning and unlearning, and finally how we approached this at Spaceship.
I was invited by the Hatchery+ to give a presentation and workshop on building products - a brief overview on modern web apps, tech stacks, languages, frameworks, services, APIs and more.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)MdTanvirMahtab2
This presentation is about the working procedure of Shahjalal Fertilizer Company Limited (SFCL). A Govt. owned Company of Bangladesh Chemical Industries Corporation under Ministry of Industries.
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
How to write good quality code
1. Code Quality
A brief introduction to writing code that is
scalable, shareable and usable.
Wednesday, 18th May 2016
2. Hayden Bleasel
Product Designer, Entrepreneur &
Full-Stack Developer. Previously
at Zookal, Sumry and Palantir.
@haydenbleasel on Twitter,
GitHub and pretty much
everywhere else.
Nice to meet you.
3. What languages do you write and how
do you ensure code quality?
Quick Question
4. • Bad code: use once, copied from StackOverflow, thrown
away after or used to hotfix a bug
• Good code: used multiple times over several projects,
maybe a small plugin
• Great code: well-thought-out, up to date, unit tested and
maybe even open-sourced and built by the community
• We need to measure and enforce quality code.
What is “Quality Code”?
5. • Clear and understandable design and implementation.
• Well defined interfaces.
• Ease of build and use.
• Ease of extensibility.
• Minimum extra dependencies.
• Tests and examples.
• Great documentation or self-explaining code.
• Up to date means to contact the developer.
Goals of Quality Code
6. • European Space Agency took 10 years and $8
billion dollars to develop Ariane 5 (heavy lift
launch rocket).
• On June 4, 1996, it took its first voyage with $500
million cargo. In 40 seconds its inertial reference
system failed.
• 64-bit floating point number representing the
horizontal velocity of the rocket was converted
into 16-bit signed integer — conversion failed
because of overflow.
Why bother with quality?
7. • Finding, fixing problem in production is 100 times more expensive than during
requirements / design phase.
• 40-50% of effort on projects is on avoidable rework.
• ~80% of avoidable rework comes from 20% of defects.
• ~80% of defects come from 20% of modules; about half the modules are defect free.
• ~90% of downtime comes from at most 10% of defects.
• Peer reviews catch 60% of defects.
• Perspective-based reviews catch 35% more defects than nondirected reviews.
• Disciplined personal practices can reduce defect introduction rates by up to 75%.
• ~40-50% of user programs have nontrivial defects.
But seriously, why bother?
8. • Nobody has time to check their code, we’re all
busy trying to make amazing things.
• You need 2 things:
A. To know how to write good code (you think
you do but you really don’t).
B. To start using an array of tools and workflow
to your advantage.
But I don’t have time to check code!
9. • Not really. The QA is meant to go over your output
and look for bugs in runtime and edge cases, not
to browse your junk code and make incremental
improvements.
• The only thing that does is gives the QA a reason
to yell at you about writing janky code and you’ll
go back to the drawing board (that, or more likely
it’ll leak into production and hilarity ensues).
Isn’t this the job of a QA?
10. This is basically a giant to-do list for when you go home,
things you can add to your product, startup or app.
Practical Implementation
12. • Writing code with style
• Keeping code in check
• Making code less confusing
Overview
• Managing dependencies
• Git and GitHub
• Automation and Testing
14. • Don’t give variables cryptic names e.g.
Meaningful Variable Names
001. Writing code with style
x1 = 60;
x2 = 24;
x12 = x1 * x2;
• They don’t save space - you can compress the
output using a minifier. Might as well just use:
minutesPerHour = 60;
hoursPerDay = 24;
minutesPerDay = minutesPerHour * hoursPerDay;
15. • This doesn’t lead to scalable code:
Using Constants
001. Writing code with style
coffee = makeCoffee(2)
• What does 2 mean? What does this function even
accept? We can introduce constants here:
SIZES = { small: 1, large: 2 };
coffee = makeCoffee(SIZES.large)
• We generally use uppercase for constants.
16. • This function utilises it’s purpose stringently:
Flexible functions
001. Writing code with style
makeGrid = function (width) {
for (var i = 0; i < 12; i++) {
makeColumn(12 / width, 30);
}
}
• We can make this a bit more flexible:
makeGrid = function (width, columns, gutter) {
for (var i = 0; i < columns; i++) {
makeColumn(columns / width, gutter);
}
}
makeGrid(1170)
makeGrid(1170, 12, 30)
17. • It’s pretty simple stuff, just go through all your
code and find thing to improve or fix.
• Look for runtime errors (overflows, type checking,
overwriting variables, memory leaks, etc).
• Look for syntax errors (missing a bracket or
semicolon, using 1 ampersand instead of 2)
• Look for logic errors (passing in the wrong
number, calling the wrong function).
Code Analysis
001. Writing code with style
18. • There are two pretty fundamental things you
should avoid when writing large projects
(especially for open-source):
• Black boxes: Functions where parameters go
into, pure magic happens and an output comes
out, but we have no idea how it works.
• TODOs and Hacky Workarounds: Avoid them.
However, if you’ve got hacks or unfinished
code, document them somewhere outsite the
codebase, like GitHub issues.
Avoid Black Boxes and Hacks
001. Writing code with style
19. • More lines of code typically means less code
quality. In each file or function, pick one thing and
do it really well, a bit like running a startup.
• Repeated lines of code or code that looks
incredibly similar in terms of structure and
purpose can be rewritten as a function.
• Seperate your code out into different files. Make
sure each file handles a small part of your app.
Refactoring and LOC
001. Writing code with style
20. • If your linter, terminal or whatever throws a
warning, don’t ignore it.
• Warnings can outline hidden problems that you’ll
run into severely later on.
• Use the compiler or linter to treat warnings as
errors and you’ll be writing amazing code.
• If absolutely necessary (legacy code or
something), you can suppress warnings.
Treat Warnings as Errors
001. Writing code with style
21. • Some languages, like Javascript and Perl, have a Strict mode that
you can enable.
• It makes several changes to normal language semantics.
• In JavaScript for example, Strict Mode:
• Eliminates some silent errors by changing them to throw errors.
• Fixes mistakes that make it difficult for JavaScript engines to
perform optimisations: strict mode code can sometimes be
made to run faster than identical code that's not strict mode.
• Prohibits some syntax likely to be defined in future versions of
ECMAScript.
Strict Mode
001. Writing code with style
23. • A giant report documenting how you
and your collaborators should write
code on a particular project.
• Google has a massive one covering
every language they use: https://
github.com/google/styleguide
• Useful for when you’re running a
company or agency where heaps of
people are touching the same code.
Style Guides
002. Keeping code in check
24. • Everything we’ve just discussed - that’s a lot of
work. Checking, refactoring, rewriting…
• Wouldn’t it be better if the code just checked
itself? (before it wrecked itself)
• Welcome to the wonderful world of rules. You
want your codebase to have rules, such as “make
sure every file ends with a newline” and “make
sure I use anonymous function callbacks all the
time”. The possibilities are endless.
Automagical code checking
002. Keeping code in check
25. • Check it out at http://
editorconfig.org/
• Comes as a plugin for almost
every text editor and IDE
imaginable.
• Define extension-based rules
like newlines, charsets and
indenting.
• Runs and fixes on file save.
.editorconfig
002. Keeping code in check
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
[*.json]
indent_size = 2
26. • My absolute favourite part of
this topic on code quality.
• Linters are absolutely
amazing and indispensable.
• They check your code as
you’re writing it.
• They literally enforce your
style on everyone else.
Linting
002. Keeping code in check
27. • Some languages, like Javascript, have lots of
linters to choose from: JSLint, ESLint, JSHint, etc.
All of these can be configured, but the default
options and extensibility varies.
• ESLint is the one shown in these examples. It’s
the newest, most extensible linter for Javascript.
• You can most linters via CLI, automation module
(Gulp or Grunt) and text editor plugin.
Choosing a Linter
002. Keeping code in check
28. "comma-dangle": [2, "never"],
"no-cond-assign": [2, "always"],
"no-console": 0,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-empty-character-class": 2,
"no-empty": 2,
Linter Configuration
002. Keeping code in check
• Configuring your linter is a tedious process.
My .eslintrc is 350 lines long:
eslint.haydenbleasel.com
29. How I use my linter
002. Keeping code in check
brew cask install atom
apm install linter linter-eslint
npm install -g eslint
• Getting a Linter set up is mad easy. Just install the
module and plugins:
• That’s it! Just start writing code and save!
31. • Text editors can massively affect code quality,
from default intent style to external plugins.
• I use Atom, a text editor by GitHub. It comes with
an inbuilt package manager.
• Packages like linter (+eslint), atom-beautify and
editorconfig address things we’ve talked about.
Text Editors and Plugins
002. Keeping code in check
33. • Coupling determines how much one component
of your code knows about the inner workings of
another. We want to aim for LOW coupling.
• Ex: iPods are a good example of tight coupling:
once the battery dies you might as well buy a new
iPod because the battery is soldered fixed and
won’t come loose, thus making replacing very
expensive. A loosely coupled player would allow
effortlessly changing the battery.
Coupling
003. Making code less confusing
34. • Cohesion refers to the extent that a component
of your code is focused only on what it should be
doing. We want to aim for HIGH cohesion.
Cohesion
003. Making code less confusing
function main (a, b) {
var x = (a * b) / 3;
var body = $(‘body’);
body.appendChild(x);
}
main(1,2);
function multiply (a, b) {
return (a * b) / 3;
}
function append (number) {
var body = $(‘body’);
body.appendChild(number);
}
var number = multiply(1,2);
append(number);
35. • There are two main ways to minimise the complexity of
your code. Neither should be your ultimatum, but rather
a great referencing guide:
1. Pretty simple: just minimise the number of
parameters, depth (nesting) and statements per
function
2. Run a cyclomatic complexity test. It calculates
the overall intricacy of a function and to give a
score that reflects it’s complexity. Lower is better.
Complexity
003. Making code less confusing
37. • A common pitfall that results in loss of code quality,
even in large organisations, is poor dependency
management.
• Vendor code is downloaded, chucked in a random
folder and modified to the core if it doesn’t work the
way you want it to.
• This results in all sorts of bugs and creates a generally
crap work environment for the developer.
Dependency Management
004. Managing dependencies
38. • Bower is a package
management system
developed by Twitter.
• Bower is used to download
and manage front-end
development packages like
jQuery and Bootstrap.
• For example:
Bower
004. Managing dependencies
bower install jquery --save
39. • Server-side applications also have dependency
management, except much better.
• Node.js has NPM, Ruby has Bundler and PHP has
Composer. There are plenty of dependency
management tools out there for any language.
• Rather than messing around with files and versions,
just get the latest version of Request with:
NPM / Bundler / Composer
004. Managing dependencies
npm install request --save-dev
40. • If you’re not using a dependency manager but still want
to maintain the integrity and separation of your
codebase from third-party components, CDNJS is a
good option.
• Again, front-end components. Doesn’t have everything
but should have 99% of what you need.
• Just throw in a script tag like:
CDNJS
004. Managing dependencies
<script src=“https://cdnjs.cloudflare.com/ajax/libs/jquery/
3.0.0-beta1/jquery.min.js"></script>
42. • You should kinda know this already. Git tracks version
history so you can see what you’ve done, revert
changes and blame mistakes on other people.
• Remember to check in your code in small batches,
frequently. Reverting massive amounts of unrelated
code is a nightmare plus it helps avoid merge conflicts.
• Version control is also helpful for semver integrity.
Version Control
005. Git and GitHub
43. • GitHub is the best platform ever for developers.
• Use Issues to track your TODOs, hacky workarounds,
suggestions from others, etc. Keep the discussion out
of your codebase.
• Use PRs to filter external changes to your code. PRs
allow for Code Reviews where you can go through
every change in the diff and add comments.
Issues and PRs
005. Git and GitHub
44. • Can happen in a variety of ways, but likely when you
gather all the homies together and start reviewing
code that you’ve written or that’s in your codebase.
• Great way to pick up and debate really small things that
might lead to a significant improvement in
performance, or maybe just be really pedantic.
• Theoretically, you’re meant to be positive i.e. instead of
“that’s lousy long method” say, “why don’t you split
that method…” but TBH most of us are savages.
Code Reviews
005. Git and GitHub
46. • The original task-runner.
• Their architectural concept
sucks (pickup and put-down)
but it’s pretty widely used.
• Stop writing production code
in source, focus on quality of
source code and let your
automation handle the rest.
Grunt
006. Automation and Testing
47. • Best task runner available -
unix streaming ideology
inside the JS ecosystem.
• Set up a bunch of tasks and
send files through the
pipeline (stream) without
touching the file system.
• Compile languages, remove
debug code, whatever.
Gulp
006. Automation and Testing
48. • Write a script to test your
app. Can be as simple as
“npm start” which just runs
the app.
• Will automatically run this
every time you push to
GitHub.
• Also tests GitHub PRs - test
new code before you merge.
Travis CI
006. Automation and Testing
49. • So you’ve written unit tests for your code, but how
much have you written in the scheme of things?
• JS has Mocha, Chai, Istanbul and other libraries to
handle this sort of things.
• It’s called test coverage - TL;DR it will give you a report
on how much of your codebase is covered by unit tests.
Most of them compute statement, line, function and
branch coverage with module loader hooks.
Coverage
006. Automation and Testing
50. Go forth and stop writing bad code.
That’s everything
http://codequality.haydenbleasel.com/