Beautiful Bash: Let's make reading and writing bash scripts fun again!
Writing beautiful code - not just for aesthetic value
-
Upload
today-software-magazine -
Category
Documents
-
view
223 -
download
2
description
Transcript of Writing beautiful code - not just for aesthetic value
Writing beautiful codenot just for aesthetic value
-- Attila-Mihály Balázs
Double d1 = (5.0d - 5.0d) * 1.0d;Double d2 = (5.0d - 5.0d) * -1.0d;System.out.println(d1.equals(d2));
double d1 = (5.0d - 5.0d) * 1.0d;double d2 = (5.0d - 5.0d) * -1.0d;System.out.println(d1 == d2);
Double Trouble
BigDecimal d1 = new BigDecimal("1.2");BigDecimal d2 = new BigDecimal("1.20");System.out.println(d1.equals(d2));
* http://hype-free.blogspot.ro/2008/12/negative-zero-what-is-it.html
Double Trouble
Double v = null;Double d = true ? v : 0.0d;System.out.println(d);
Where is my null at?
Collection<V> items;
if (items.size() == 0) { ... }
if (items.isEmpty()) { ... }
We come up empty
// WRONG! DON’T DO THIS!Vector v1;...if (!v1.contains(s)) { v1.add(s); }
Remove old cruft!
● Effective Java, 2nd edition● Java Puzzlers
● Modern Perl
● Sonar● Jenkins violations plugin● Perl::Critic● pep8, pylint
Conclusions