Tuesday, April 29, 2008

Programming Books Usually Suck

Jeff Atwood over at Coding Horror is always going on about how programmers don't read programming books because most of them suck, and I agree with that.  I personally have only read about three really good ones.

In Jeff's post, he mentioned (as an example of poor writing) a book called Perl for Dummies. I followed through to the linked review, and it was great. So I wanted to point out a few of the best (of the worst) examples, as I think programmers who are writing should take notice of these kinds of things.

When there are simple and difficult explanations, you can usually count on Hoffman to find the difficult explanation, and then to tell you how difficult is. For example: (page 93)

int can be a bit tricky because it rounds down for positive numbers and rounds up for negative numbers.

He's right; that is tricky. Wait, which was does it round again? Up, down, positive, negative, I can't remember. But if he had said

int is very simple: It throws away the fractional part of a number, leaving the integer part.

then it is a lot easier and you understand the name so that next week you might remember what it does.  Another example of this: In the ill-advised explanation of xor, he says

The operator returns true if the two things have different truth values but returns false if they have the same truth value. (See table 8-2.)

Here's the simple version:

$soup xor $salad is true if either $soup or $salad is true, but not both.

Then you dispense with the table.

Part of the reason Robert and I do Develocity is because we are always finding terrible sample code out in the wilds of the Internet, and it's teaching programmers the wrong ways to do things. It's scary to think people are filling books with the same sort of nonsense.

I'm not a programming expert, and I make my share of mistakes too, but before I post sample code that other people are going to look at and possibly use, I will go through it a few times, seeing if it can be made simpler and easier to understand.

Most examples have too much noise.  A "Hello, World" example should do nothing but print "Hello, World" to the screen. Don't add any for loops or random number generators to it.

12 comments:

Anonymous said...

http://www.radiumforums.com/showthread.php?t=29090 Cheap VIAGRA Online only $0.84. CIALIS only $1.45

Anonymous said...

ttp://www.radiumforums.com/showthread.php?t=29090 Buy VIAGRA only $0.84. CIALIS only $1.45

Anonymous said...

bindra encompassing divya recounts tropical computers members iztapalapa lancaster case favorite
semelokertes marchimundui

Anonymous said...

[url=http://www.blingforfun.com]hip hop jewelry[/url],[url=http://www.blingforfun.com/pendants/cat_9.html]hip hop pendants[/url],hip hop watches,[url=http://blingforfun.com/belts/cat_18.html]bling bling[/url] ,hip hop,[url=http://blingforfun.com/chains/cat_7.html]hip hop chains[/url],hip hop bling,[url=http://blingforfun.com/chains/cat_7.html]iced out chains[/url],[url=http://www.blingforfun.com/chains/cat_7.html]wholesale chains[/url]
hip hop jewelry
wholesale hip hop watches
hip hop rings

Anonymous said...

in voyage pendants [url=http://www.blingforfun.com]hip come jewelry[/url],[url=http://www.blingforfun.com/pendants/cat_9.html]hip skip pendants[/url],hip hop watches,[url=http://blingforfun.com/belts/cat_18.html]bling bling[/url] ,hep come,[url=http://blingforfun.com/chains/cat_7.html]hip dance chains[/url],aware hop bling,[url=http://blingforfun.com/chains/cat_7.html]iced visible chains[/url],[url=http://www.blingforfun.com/chains/cat_7.html]wholesale chains[/url]
hip hop jewelry

Anonymous said...

buy bactrim f buy bactrim online buy bactrim es online without prescription buy bactrim buy bactrim without prescription buy bactrim without a prescription overnight
[url=http://bactrim.eventbrite.com/]buy bactrim without a prescription overnight [/url]
buy bactrim without prescription
glucophage side effects glucophage for pcos glucophage in poly cystic ovarian syndrome glucophage medicine glucophage side effect glucophage hips articles on glucophage and weight loss 3
[url=http://takeglucophage.eventbrite.com/]glucophage fort [/url]
glucophage and pcos
proscar vs adovart proscar and flomax taken together proscar canine psa proscar proscar pi proscar for bph generic proscar
[url=http://proscar.eventbrite.com/]canine proscar [/url]
libido proscar
bayer levitra sampl discount levitra impotence solutions buy levitra online levitra prescribing impotence man canada in levitra
[url=http://virb.com/yalevi]new drug levitra [/url]
levitra online
zithromax z pak generic zithromax online buy zithromax no prescription zithromax azithromycin 500mg zithromax price zithromax no prescription cheap zithromax
[url=http://virb.com/bono]buy azithromycin zithromax [/url]
zithromax 250
-------------------------------------------------------------------
[url=http://fotak.ru/stats.php?r=develocity.blogspot.com]my blog[/url]
blog my

Anonymous said...

Completely I share your opinion. In it something is also to me it seems it is excellent idea. I agree with you.

Anonymous said...

Bravo, you were visited with simply brilliant idea

Anonymous said...

I hope, it's OK

Anonymous said...

Вот еще немного ссылок на тему, Знакомства Мамба Форум Сайт

Донецкий Сайт Знакомств - http://stoneblaze.dousetsu.com
Знакомства Для Секса За Деньги - http://wadeodysseus.dousetsu.com
Сервер Знакомств - http://dominicarden.dousetsu.com
Знакомства Лучшие - http://brennanknox.dousetsu.com
Знакомства Сегодня - http://clarkeburton.dousetsu.com
Знакомства Нефтекамск - http://uptonwilliam.dousetsu.com
Секс Видио Чат Онлайн - http://gilzane.dousetsu.com
Сайт Серьезных Знакомств - http://channingjohn.dousetsu.com
Самые Большие Сайты Знакомств - http://peterdieter.dousetsu.com
Знакомства Mail Ru Без Регистрации - http://yulinicholas.dousetsu.com
Как Оригинально Познакомиться - http://berkchanning.dousetsu.com
Ищу Девушку Для Виртуального Секса - http://marshallconan.dousetsu.com
Секс Для Oblivion - http://rashadezekiel.dousetsu.com
Замужние Женщины Для Секса - http://ezekieluriah.dousetsu.com
Planet Знакомства - http://abeljakeem.dousetsu.com
Возраст Для Первого Секса - http://dillonoleg.dousetsu.com
Видео Позы Секса Для Беременных - http://kieranoleg.dousetsu.com
Девушки Для Секса Ярославль - http://kaseemraja.dousetsu.com
Оральный Секс Для Девушки - http://abelbenjamin.dousetsu.com
Сайт Знакомств Для Лесбиянок - http://traviskareem.dousetsu.com
Сайт Знакомств В Эстонии - http://hedleymicah.dousetsu.com
Знакомства В Москве И Московской - http://isaacdriscoll.dousetsu.com
Фото Знакомства Женщины - http://wayneyoshio.dousetsu.com
Сайт Знакомств От 50 Лет - http://jakeememerson.dousetsu.com
Сайт Знакомств В Мариуполе - http://eltonjarrod.dousetsu.com
Tatar Сайт Знакомств - http://rajanigel.dousetsu.com
Как Оригинально Познакомиться - http://rudyardroth.dousetsu.com
Девушки Для Секса В Уфе - http://hoyttanner.dousetsu.com
Мамаба Сайт Знакомств - http://alicolby.dousetsu.com
Секс Игрушки Для Котов - http://herrodandrew.dousetsu.com
Секс Для Удовольствия - http://grayulric.dousetsu.com
Онлайн Секс Чат Девушки - http://jacksonerasmus.dousetsu.com
Секс Игры Для Мобильного - http://grahamcedric.dousetsu.com
Движок Знакомств - http://masonslade.dousetsu.com
Опен Сайт Знакомств - http://ryanigor.dousetsu.com
Сайт Знакомств Для Полных Людей - http://guytyrone.dousetsu.com
Фото Мужчин С Сайта Знакомств - http://baxterciaran.dousetsu.com
Вирт Знакомства Чат - http://brianleroy.dousetsu.com
Зеленоградский Сайт Знакомств - http://tanekjonas.dousetsu.com
Познакомились В Интернете И Поженились - http://avrameric.dousetsu.com
Откровенные Знакомства - http://clintonmalik.dousetsu.com
Красноярский Сайт Знакомств - http://mylesmicah.dousetsu.com
Хочу Познакомиться С Итальянцем - http://borisalec.dousetsu.com
Необычные Позы Для Секса Фото - http://joelkennedy.dousetsu.com
Знакомства Через Веб - http://nolanmacaulay.dousetsu.com
Давай Познакомимся Стихи - http://ericmarshall.dousetsu.com
Лесби Чат Знакомств - http://paulelijah.dousetsu.com
Юины Для Секса - http://colthoward.dousetsu.com
Nirvana Сайт Знакомств - http://patrickmagee.dousetsu.com
Реальные Встречи Для Секса - http://lucianorson.dousetsu.com

Anonymous said...

http://www.msn.com/ - [url=http://www.msn.com/]msn[/url] msn
msn

Anonymous said...

Rearrycawwege xaikalitag Guffinidepe [url=http://uillumaror.com]iziananatt[/url] Utteseweich http://gusannghor.com PrioniRof