Monday, March 12, 2007

by the way, what does 'extraordinarily typesafe' mean?

I was feeling pretty proud about Guice. It went 1.0 last week and has been making the rounds in the blogosphere the last few days; it seems to make a positive first impression on most people.

I showed my wife an announcement that I sent to some mailing list or other about the release. This was like a few days ago. And just now she says to me, "by the way, what does 'extraordinarily typesafe' mean?"

I said,

"In the software world we really like to think in terms of objects, and our favorite programming languages are built to support this object-centric view. An object might be the name 'Caryn', or it might be Kevin's Discover card or the font that I like to post my blog in.

"When things are not 'typesafe', someone can walk up to you and ask for your credit card and you can hand him a font, and he'll say, '30 seconds.' And he'll walk away, many kilograms away and only later will he gleefully try to charge your credit card and explode cosmically. You know, like what was supposed to happen in Ghostbusters when they crossed the streams.

"Java has always been typesafe at some level, because you can't just pass a font to a credit-card processor. But there was a huge, yawning chasm in the type-safety landscape that an entire Stay-Puft man could fit in comfortably: collections of things. See, you might have a roster full of names, or a wallet full of credit cards, or a drop-down box full of font choices, and as soon as you put something into any of these, it would immediately forget what the hell kind of a thing you just put in. And when you'd take something out, you'd say, 'take this thingamabob out, and by the way, that's a credit card I'm taking out.' Yeah. Only it might not actually be.

"What this is, is it's not typesafe. So anyway, what this guy Josh I work with, who I'm always telling you about, helped to mastermind was this huge change in Java a few years ago, that finally plugged this leak, so that you can now say 'this is a bag of credit cards' or 'this is a bag of employees' and you're only allowed to do things with these bags that make sense. Now Java is finally very typesafe.

"So then there's this thing called Dependency Injection that our framework supports, and other things like Spring also support it, except Spring doesn't support all the latest advancements in Java, and it wants you to configure things outside your Java code, in a bloody text file. So you can go to that text file and say 'use this font renderer to process credit card payments' and it will think that's okay, until you try to run everything and then the asploding.

"But Bob and I made this framework where you get to only write Java code, and so as soon as you try to do this bogus thing, it's just like that example of the bag of employees above. The words turn red on your screen and you know something's wrong right away.

"And that's why we say we're 'extraordinarily typesafe'."

Do you buy it?

28 comments:

Geheimdienst said...

Excellent writing style. Way to go! Hope this wasn't the last post.

Charles Finkel said...

awesome. guice+intellij, making java even more type safe.

Dhanji R. Prasanna said...

this is a nice post, I was entertained reading it!

But java's type system is not great, let's not kid ourselves. It is far better than most but erasure generics makes it difficult to do really "extremely typesafe" and cool things. Also erasure means that you dont really know that you have a bag of credit cards, you just have a gatekeeper that lets you into the shopping mall if you have a bag of credit cards. If, after you get in, you slip in some strawberries, you're screwed (and have to resort to things like checkedCollections).

I would have loved it if we followed something like C++ type system where you can declare arbitrary type parameters like:

class List<CreditCard, Strawberry> { }

and I could put in only credit cards OR strawberries.

still guice is awesome, rock on kevin!

Jemaleddin said...

Hey, I feel like I almost understood that! Excellent!

Kelly said...

Re: dhanji's comment

There's a bit of an effort afoot to erase erasure in JDK 1.7:

http://gafter.blogspot.com/2006/11/reified-generics-for-java.html

https://openjdk.dev.java.net/servlets/ReadMsg?list=compiler-dev&msgNo=265

Also, excellent wife-speak explanation Kevin :)

Dave Smith said...

Given a choice between extreme type safety and dynamic type safety, and assuming good test coverage for both, I'll take dynamic type safety almost every time. The contortions people submit themselves (and other) to in the name of extreme type safety can be appalling.

Malcolm Sparks said...

Nice post, and congratulations on Guice. Bugs are bad, type-safety means fewer bugs.

Scott said...

Kevin, I would drop 2 or 3 large each month to read your diatribes. You could be "Kevin on Injection!" Seriously, my wife and I talk tech at the local pub, and people look at us like we should be in the circus. One night she started railing about injection schemes and the bartender asked us to clean up the language!

Anyways, love your stuff and once I'm finished writing this damn Struts2 book, I plan to roll up into your Guice grove to have a look around.

Scott

Stephen Boesch said...

Hi Kevin,
I like and have in the past used a number of google technologies - including guice 2.0, google collections, closure, and jstemplate.

However, when going to Google Code page and "browsing", none of these show up AFAIK.

Why is that? Are they not being actively promoted? Is there some backdoor to be able to see "all" of google code technologies even if they're not listed explicitly there?

I mean google's stuff is typically far more mature than many other open source things, so I'd like to get more of them!

thanks,

stephen b

trustme said...

Hello, wonderful blog!thank you. By the way,here we offer a lot of good nike shoes,you can come to have

a look.
nike shox r5
nike air max 180
nike nouvelle
tn chaussures
nike tn
tn chaussures
nike air max
pour nike air max 91
shox oz
pour nike air max
nike nouvelle collection
air max tn
nike air max 97
nike store
nike dunk sb high
nike air max
shox vital
basket nike enfant
tn chaussures
nike air max
enfant chaussures
wholesale nike dunk
achat chaussures nike homme nouvelle collection
air max 91
nouvelle requin tn
nike dunk sb
basket nike shox
nike air max 180
nike nouvelle air max

Unknown said...

Latest film "007: license to kill" the story
Sanchez learned that King of drug trafficking in Latin America, the message stays near the Bahamas, the British spy James Bond 007 to get there with Wright and Sharkey, tried to Sanchez arrested. But Sanchez is not only escaped, but also Wright dropped into a shark pool. Although Wright saved a life, has become disabled. Mr. Bond boss M issued a warning, but Bond is to continue the pursuit, then was relieved of his duties, was also confiscated the license to kill. Sanchez in Panama City, Isthmus has a bank of a nightclub, he was there and a group of drug traffickers from the East to meet a big deal to co-operate. Bent on revenge for the Wright Bond inquired into the news after posing as a speculator who arrived there. Just looking for a chance Bond, Hong Kong agents seized him in a wide, this "escape the spies" taken to a secret location, to the British spy agencies. The secret location was subsequently Sanchez armed men blew up, cleaning up debris, they found a Bond has survived an accident. Bond Sanchez defrauded the trust and taken to an underground drugs factory, a men being recognized Sanchez, the Bond pre-emptive fire to Sanchez. Finally, Bond lit a cigarette lighter with Wright Sanchez clothes soaked in gasoline, burned alive to Sanchez.


We look forward to this wonderful movie please oh.........link: Dell Latitude D600 battery|dell d830 ac adapter|dell d610 ac adapter|pa3468u 1aca ac adapter|dell latitude d520 ac adapter|5150 ac adapter|d400 ac adapter|d600 ac adapter|nadp 90kb|zd8000 battery|c1295 battery|pa3399u-1brs|pa3400u 1brs|HP 365485-001 Keyboard|HP/Compaq Laptop keyboard|Compaq M2000 Keyboard|HP Pavilion zv5000 Keyboard|HP Pavilion NX9100 Keyboard .........

Unknown said...

Latest film "Nightmare on Elm Street" Plot
"The new Nightmare on Elm Street" played by the screenwriter Wesley Stricker, will follow the original director Wes Craven's

Queen's routine, to stimulate a bloody killer scenes big screen again. According to reports, film the story will be a

nightmare killer Freddy is how to burn the first incarnation of devils as the main history.

We look forward to this wonderful movie please right..............................................
New Nightmare on Elm Street "will be April 30, 2010 capture of the North American cinemas.

combattery84 said...

laptop battery
laptop battery
Power tools battery
Camcorder Battery
Digital Camera Battery
CANON Camcorder Battery
JVC Camcorder Battery
PANANSONIC Camcorder Battery
SONY Camcorder Battery
SHARP Camcorder Battery
CANON Digital Camera Battery
CASIO Digital Camera Battery
FUJIFILM Digital Camera Battery
JVC Digital Camera Battery
NIKON Digital Camera Battery
SANYO Digital Camera Battery
SHARP Digital Camera Battery

IBM Laptop Battery
acer laptop battery
apple Laptop Battery
toshiba laptop battery
hp latptop battery
dell laptop battery
sony laptop battery
asus laptop battery
compaq laptop battery
FUJITSU Laptop Battery
laptop battery
ACER Laptop Battery
APPLE Laptop Battery
laptop battery
laptop battery
laptop battery
laptop battery
laptop battery
laptop battery

combattery84 said...

Dell Inspiron 600m battery
Dell Inspiron 8100 Battery
Dell Y9943 battery
Dell Inspiron 1521 battery
Dell Inspiron 510m battery
Dell Latitude D500 battery
Dell Latitude D520 battery
Dell GD761 battery
Dell NF343 battery
Dell D5318 battery
Dell G5260 battery
Dell Inspiron 9200 battery
Dell Latitude C500 battery
Dell HD438 Battery
Dell GK479 battery
Dell PC764 battery
Dell KD476 Battery
Dell Inspiron 1150 battery
Dell inspiron 8500 battery
Dell Inspiron 4100 battery
Dell Inspiron 4000 battery
Dell Inspiron 8200 battery
Dell FK890 battery
Dell Inspiron 1721 battery

Dell Inspiron 1300 Battery
Dell Inspiron 1520 Battery
Dell Latitude D600 Battery
Dell XPS M1330 battery
Dell Latitude D531N Battery
Dell INSPIRON 6000 battery
Dell INSPIRON 6400 Battery
Dell Inspiron 9300 battery

Anonymous said...

SONY PCGA-BP71A battery
SONY VGP-BPL1 battery
SONY VGP-BPL2 battery
Sony vgn-t2xp/s battery
Sony vaio vgn-s4xp battery
Sony vaio pcg-z1rsp battery
SONY NP-FT1 battery
SONY NP-FC10 Battery
SONY NP-F330 Battery
SONY NP-F550 Battery
SONY NP-FM50 Battery
SONY NP-FP50 Battery
SONY NP-55 Battery
SONY NP-FM70 Battery
SONY NP-33 Battery
SONY NP-F970 Battery
SONY NP-FP90 Battery
FUJITSU Lifebook C2220 battery
FUJITSU Fpcbp63 Battery
FUJITSU Fpcbp68 Battery
FUJITSU Fpcbp77 Battery
FUJITSU Fpcbp78 Battery
FUJITSU Fpcbp79 Battery
FUJITSU Fpcbp95 Battery
FUJITSU Fpcbp98 Battery
FUJITSU Fpcbp121 Battery
FUJITSU Fpcbp151 Battery
FUJITSU lifebook t4010 Battery

Anonymous said...

FUJITSU lifebook t4020d Battery
GATEWAY NX7000 battery
UNIWILL 258-4S4400-S1P1 Battery
TOSHIBA PA3307U-1BRS Battery
TOSHIBA PA3383U-1BRS Battery
TOSHIBA PA3384U-1BRS Battery
TOSHIBA PA3465U-1BRS Battery
Toshiba PA2487UR battery
Toshiba A100 Battery
Toshiba Satellite A105 battery
Toshiba A70 battery
PA3062U-1BAT battery
Toshiba Satellite P30 battery
Toshiba PA3084U-1BRS battery
Toshiba PA3098U battery
PA3107U-1BAS battery
PA3107U-1BRS battery
PA3166U-1BRS battery
PA3176U-1BAS battery
TOSHIBA PABAS076 Battery
Toshiba pa3399u-1brs battery
TOSHIBA PA3399U-2BAS Battery
TOSHIBA PA3421U-1BRS Battery
TOSHIBA PA3456U-1BRS Battery
TOSHIBA Pa3356u-1brs battery
Satellite a10 battery
Pa3331u-1brs battery
Satellite m30 series battery
Satellite pro m30 battery
TOSHIBA PA3399U-1BRS Battery

Anonymous said...

ACER TravelMate 240 Battery
ACER BT.00803.004 Battery
ACER Travelmate 4002lmi battery
Acer travelmate 800 battery
Acer aspire 3613wlmi battery
Travelmate 2414wlmi battery
Acer batcl50l battery
Acer Travelmate 2300 battery
ACER aspire 3610 battery
ACER travelmate 4600 battery
Dell Latitude D800 battery
Dell Inspiron 600m battery
Dell Inspiron 8100 Battery
Dell Y9943 battery
Dell Inspiron 1521 battery
Dell Inspiron 510m battery
Dell Latitude D500 battery
Dell Latitude D520 battery
Dell GD761 battery
Dell NF343 battery
Dell D5318 battery
Dell G5260 battery
Dell Inspiron 9200 battery
Dell Latitude C500 battery
Dell HD438 Battery
Dell GK479 battery
Dell PC764 battery
Dell KD476 Battery
Dell Inspiron 1150 battery

Anonymous said...

Dell inspiron 8500 battery
Dell Inspiron 4100 battery
Dell Inspiron 4000 battery
Dell Inspiron 8200 battery
Dell FK890 battery
Dell Inspiron 1721 battery
Dell Inspiron 1300 Battery
Dell Inspiron 1520 Battery
Dell Latitude D600 Battery
Dell XPS M1330 battery
Dell Latitude D531N Battery
Dell INSPIRON 6000 battery
Dell INSPIRON 6400 Battery
Dell Inspiron 9300 battery
Dell INSPIRON 9400 Battery
Dell INSPIRON e1505 battery
Dell INSPIRON 2500 battery
Dell INSPIRON 630m battery


Dell Latitude D820 battery
Dell Latitude D610 Battery
Dell Latitude D620 battery
Dell Latitude D630 battery
Dell xps m1210 battery
Dell e1705 battery
Dell d830 battery
Dell inspiron 2200 battery
Dell inspiron 640m battery
Dell inspiron b120 battery
Dell xps m1210 battery

tpjewelry said...

Other ways to unlock trapped cash thomas sabo is in the form of selling thomas sabo shop silverware, silver flatware, sterling silver thomas sabo jewellery and scrap silver. Each of these thomas sabo schmuck will fetch different values depending on charm club thomas sabo the product and purity factors. sabo charm club With the current economic condition, selling thomas sabo 2010 precious metals, either pure or scrap, has gained thomas sabo sales a lot of importance since it thomas sabo reduziert has great intrinsic value attached to it and selling the scrap is one of the smartest ways of making money.

Unknown said...

Both sides also collectively released a 3 festivities to commemorate the tenth anniversary of cooperation
Nike Air Max Shoes
Nike Air Max 2011
Nike Air Max
Nike Air Max 2009
Nike Air Max 95
Nike Air Max 91
Nike Air Max 87
Nike Air Max 180
Nike Air Max Griffey Max 1
Nike Air Max 90
Nike Air Max 1
Nike Air Max Wildwood Supreme
Nike Air Max Turbulence
Nike Air Max Skyline
Nike Air Max Goadome
Nike Air Max Fitsole
Nike Air Max Zenyth
Nike Air Max Boots
Nike Air Max Zoom Kobe
Nike Air Max Tn
Nike Air Max LTD
Nike Air Max Presto
Nike Air Max BW
Nike Air Max 24 7
Nike Air Max 2010
Nike Air Max 2011
Abercrombie and Fitch London
Abercrombie & Fitch Clothes
Vibram Shoes
Cheap Air Max
Nike Air Max Shoes
I saw peach falling from the window in your house. Walking really happy, to ensure that all of the uncomfortable into simple

silence. I'm the only person who heard one's heart beat.

Unknown said...

For almost everybody, the solution will be no. You will find practically nothing incorrect using the hardware -- it is the limitations of the computer software and crucially the price that kill it. This is not your father's laptop computer -- you can't put in courses on it. No IM customer, no Spotify, no Photoshop, no Steam, no substitute browser. You've to undertake all the things by way of internet sites, Apple macbook a1181 Battery
Apple macbook A1185 Battery
Apple A1175 Battery MacBook
Apple A1189 Battery MacBook
Apple MA561 Battery
Apple MacBook MA566 Battery
HP Pavilion dv3t-2000 Battery
HP G70 Laptop Battery
Compaq Presario CQ32 Battery
HP Presario CQ42 Battery
HP Presario CQ62 Battery
HP Presario CQ72 Battery
432974-001 Battery
HP Mini 110-3000 Battery
HP Compaq 8510w Battery
HP Compaq 8710w Battery
HP Compaq 6720s Battery
HP Compaq 6730S Battery
HP Compaq 6735s Battery
hp pavilion dv7 battery
hp pavilion dv4 battery
hp mini 110 batteryinternet apps and Google's online solutions. For nearly all the things other than actively playing again shots and films from the USB adhere, you want an internet link.

Unknown said...

Your blog is so excellent that I like it very much, you must be good at writing.

Asus - 15.6" Laptop - 4GB Memory - 500GB Hard Drive - IMR Matte Dark Brown Suit (K53E-BBR21)

Asus - 15.6" Laptop - 4GB Memory - 500GB Hard Drive - IMR Matte Dark Brown Suit (K53E-BBR19)

Anonymous said...



Hey, Wow all the posts are very informative for the people who visit this site. Good work! We also have a Website. Please feel free to visit our site. Thank you for sharing.Well written article Thank You Sharing with Us pmp training Chennai | pmp training centers in Chenai | pmp training institutes in Chennai | pmp training and certification in Chennai | pmp training in velachery

Rithi Rawat said...

Outstanding blog thanks for sharing such wonderful blog with us ,after long time came across such knowlegeble blog. keep sharing such informative blog with us. machine learning training in chennai
machine learning projects in chennai
machine learning tution in chennai
artificial intelligence and machine learning course in chennai

ShivSai App Developer said...

"Visit Maharashtra Board Resultl"

positive mind said...

great post .. thankx keep posting. you always motivate us..



https://latestwhatsappstatus.com/love-quotes-status/

techcrb said...

WOW!!! This is the most wonderful thing i have ever experience and i need to share this great testimony.



https://techcrb.com/top-10-free-cricket-games-for-computers-2020/

richard bryan said...

great java tips At SynergisticIT we offer the best best java bootcamp