Saturday, July 07, 2012

Types and Bugs

There are certain discussions in our biz that are so played out they provoke instant boredom upon encounter. A major one is the old dynamic vs. static skirmish, recently resurfaced in a blog post by Evan Farrer. Which is a shame as the post is quite interesting, describing his results transliterating well-tested code in a dynamic language to a static language to see if the type system found any bugs. Which it did.

The full-length paper is a great read as well. He describes his translation methodology and gives some detail on each bug found. At first it may seem the author could be stacking the odds towards the static language as the translation was manually done by himself, but I found his description of the process pretty convincing of its fairness. The choice of Python as a source language probably helped given the pythonic inclination towards straightforward code that avoids sophisticated abstraction and metaprogramming mechanisms.

But the real meat of the paper is in the description of the bugs he found. Upon a not particularly discriminating reading, a clear pattern jumped out. Most of the bugs fell into one of two categories:
  • Assuming that a variable always references a valid value when it can contain a null value. 
  • Referencing constructs that no longer exist in the source.
The first category is also the largest, comprising several places where the original code could be coerced into letting a variable be set to a null value, usually by just leaving it uninitialized, and a subsequent call would attempt to derefence it assuming it contained a valid value. Haskell's type system avoids the problem as it  simply doesn't have any notion of null. Code that has to deal with optional values must do it trough algebraic data types.

How the second category of bug comes about is easy to guess from the projects histories: some method or variable was present but changed, perhaps it was renamed or subsumed, and not all references were updated to reflect the change. Even pervasive unit tests can't hope to catch these kinds of regressions, as the problem is found on the integration between units of code; the units themselves are just fine. A type system helps when the change affects the signature of the referenced construct, which is often but not always.

If the study's findings are generalizable and my observations are correct, these are the main takeaways:
  • If you have a type system at your service, it's prudent to structure code such that behavior-breaking changes are reflected on the types.
  • End-to-end integration tests are a necessary complement to both a suite of unit tests and a type system. In my experience how far should these tests stray off the happy path is a difficult engineering trade-off.
  • If your type system allows nulls — such as Java's, for instance — its role in bug prevention is greatly diminished. The proportion of null-dereference bugs on the analysed code bases helps to makes it clear just how big a mistake it is to allow nulls in a programming language. 

75 comments:

Unknown said...

Why watch for a period of time suddenly go fast, travel time is not stable? Automatic mechanical watches with shockpro of omega replica ability, but if the impact Too large, such as vigorously waving wrist, the impact will make spring up together, to watch too fast or even shut down; more impact will let out of hublot replica watch hairspring,Damping device off, the speed of the needle dislocation, which is fatal for the speed control system. Often suffer from great impact, will make winding efficiency, even failure.What is the "luminous table"? And what is the difference between the electroluminessent table Commonly known as the "luminous table" refers to the nail on the hands or word coated with fluorescent powder, in the dark or light visible hand nail hand Table. There is also a kind of luminous watch is in the middle of 90s appeared to make the entire surface of the fluorescent light. The difference between the two is as follows: 1.luminous watch by Absorption of natural light energy, while the power of yha-travel-insurance the electric meter can be relied on the battery. 2.luminous watch the "glow" light is visible only in the dark, but as long as the electric fluorescent table The corresponding according to the system at any time can shine. 3 light emitting time luminous watch by absorption time and light intensity limit, the electric battery power limit by fluorescence.

vigneswaran said...

There are lots of information about Selenium Testing have spread around the web automate, but this is a unique one according to me.
Selenium Training in Chennai

Unknown said...

When I took possession of the Rolex Submariner,a couple things jumped out at me. First, and this is always nice to find, it had its original Origina Replica Breitling Twinlock crown (Triplocks came later at around the 3M serial number). So many 1:1 Replica Rolex Watches have lost their original crowns to Triplocks along the way,In a weird twist of irony, the Omega Watches Robert-Jan wrote about from this year’s Baselworld contained a Cyclops for the first time in its history. Hermes handbags , in its self-pronounced desire to push innovation.

Ammu said...

Great post.

Thanks,
Lakshmi,
Best Angular Training Institute in Chennai

Pankaj Singh said...

Thank you much for this tutorial; this is an informative and valuable blog. Visit for
Offshore Anonymous Hosting

alex said...

I play a lot and win, what are you capable of? best online casino games with us Play, win or be defeated.

service care said...

Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definitely interested in this one. Just thought that I would post and let you know. Nice! thank you so much! Thank you for sharing.
samsung service centres in chennai
samsung mobile service center in velachery
samsung mobile service center in porur

jvimala said...

Really awesome blog. Your blog is really useful for me
Regards,
Best Selenium Training Institute in Chennai | Selenium Course in Chennai

luckys said...

whatsapp groups

luckys said...

1movies

luckys said...

gomovies

whatsapp plus said...

mobile whatsapp groups

whatsapp plus said...

mobile whatsapp groups

Devender Gupta said...

dtc bus app
dtc bus
dtc bus app download
dtc bus pass
dtc bus route
dtc bus route app
dtc bus app download

Devender Gupta said...

dtc bus app
dtc bus
dtc bus app download
dtc bus pass
dtc bus route
dtc bus route app
dtc bus app download

Devender Gupta said...

funny WiFi names
cool WiFi names
claver WiFi names
cool and claver WiFi names
funny WiFi names list
Good wifi names
wifi names 2020
Disney wifi names
wifi name for gamers
bollywood movies funny WiFi names

shivam said...

Flying Shift - Packers & Movers in Bhopal

easylearn said...

Hi,
Good job & thank you very much for the new information, i learned something new. Very well written. It was sooo good to read and usefull to improve knowledge. Who want to learn this information most helpful. One who wanted to learn this technology IT employees will always suggest you take python training in pune. Because python course in pune is one of the best that one can do while choosing the course.

Abhishek rajpoot said...

WhatsApp Status Video Download :WhatsApp introduced the status feature in 2015, in which we can share images, videos, and gifs as our story for 24 hours. Before this feature, WhatsApp had only text status option in which we can write our bio, but the new status feature is different. The story or status disappears after 24 hours and can’t be archived as still in WhatsApp.

Boy attitude status video download for whatsApp
Boy attitude status video download
Boy attitude status video download

Most romantic status video download for whatsApp
Sad video status download
Most Romantic status video download

video status download for whatsApp


we have latest & best collection of video status download for whatsapp

khushboo said...

The registrations and auditions for the Bigg Boss 13 are going to start soon. The official list of contestants is not yet announced by the officials. That will be announced by the makers on the inaugural day which is 15 the of September. bigg boss 13 contestants name list with photo Though a few rumored names are coming up as the expected celebrity contestants of the year. They are Nia Sharma, Raghav Juyal, Punit Pathak, Divyanka Tripathi, Garima Chaurasia, Ridhima Pandit, Aditya Narayan, Jasmin Bhasin, Zain Imam, Bhuvan Bam, Chetna Pande, Krystle D’Souza, and Devoleena Bhattacharjee. This year too, the show will be back with a new theme and the star host, Salman Khan. Though the theme is not declared yet officially. Stay tuned with us to know more about the show Bigg Boss 13.

gokul said...

Thanks for this informative blog
Top 5 Data science training in chennai
Data science training in chennai
Data science training in velachery
Data science training in OMR
Best Data science training in chennai
Data science training course content
Data science certification in chennai
Data science courses in chennai
Data science training institute in chennai
Data science online course
Data science with python training in chennai
Data science with R training in chennai

Vijiaajith said...

Very nice
freeinplanttrainingcourseforECEstudents
internship-in-chennai-for-bsc
inplant-training-for-automobile-engineering-students
freeinplanttrainingfor-ECEstudents-in-chennai
internship-for-cse-students-in-bsnl
application-for-industrial-training

Vijiaajith said...

nice
interview-

questions/aptitude/permutation-and-

combination/how-many-groups-of-6-persons-can-be-

formed


tutorials/oracle/or

acle-delete


technology/chrom

e-flags-complete-guide-enhance-browsing-

experience/


interview-

questions/aptitude/time-and-work/a-alone-can-do-1-

4-of-the-work-in-2-days


interview-

questions/programming/recursion-and-

iteration/integer-a-40-b-35-c-20-d-10-comment-about-

the-output-of-the-following-two-statements


Devender Gupta said...

WhatsApp group links

MIUI theme

Devender Gupta said...

Dr Driving is one of the my favourite game ever and today I am going to share Dr Driving Mod Apk
https://www.drdrivingmodapk.xyz/

Nicolay said...

Nice article

Bulletproof Domain Registration

Vijiaajith said...

how to hack flipkart payment
react native developer resume
group selector css
chemistry interview questions
sample complaint letter to bank for wrong transaction

Vijiaajith said...

javascript int max value
passage writing in fiserv
vijay invested rs.50,000 partly at 10% and partly at 15%. his total income after a year was rs.7000. how much did he invest at the rate of 10%?
residue on ignition
the simple interest earned on a certain amount is double the money

mary Brown said...

Great Article. Thank you for sharing! Really an awesome post for every one.
Project Centers in Chennai

JavaScript Training in Chennai

Final Year Project Domains for IT

JavaScript Training in Chennai

Swetha K said...

Such a nice article thanks for sharing this with us. Really so impressible and interesting post. You’re doing a great job Man, Keep it up.
Excel Training in Chennai
Excel Course in Chennai
Tableau Training in Chennai
Linux Training in Chennai
Oracle Training in Chennai
Advanced Excel Training in Chennai
Job Openings in Chennai
Oracle DBA Training in Chennai
Pega Training in Chennai
corporate training in chennai
Power BI Training in Chennai
Excel Training in Anna Nagar

pnjsharptech said...

PNJ Sharptech is a leading Social Media Optimization company in India, specializing in handling both organic and paid Social Media Marketing (SMM) campaigns successfully. We have many years of experiencing increasing online social presence on various social media platforms such as Facebook, Twitter, LinkedIn and Pinterest, and many others. Our SMO experts have a rich knowledge of increasing traffic and maintaining the online social reputation for a long period. How our SMO services make you different from others? Our low-cost social media marketing services are very helpful to build your online reputation and increase sales.

BB Arora said...


40 Lakh mp3 song download pagalworld, tik tok viral song ,Mr jatt. GetSongName.com – Presenting the audio song ” 40 Lakh ” this song by Jerry Burj Ft. Ellde Fazilka , song is been written Ellde Fazilka40 Lakh mp3 song download pagalworld

BB Arora said...

Presenting Latest New Bollywood Song Lyrics of Fauj Ki Dahaad Song Lyrics Mr. BratBea From Kartikeye Ojha & Pranshu Jha . The latest Upcomin Movie Code M Song Fauj Ki Dahaad Lyrics are written by Kumaar Mr. BratBeat and Music Directed by Kartikeye Ojha & Pranshu Jha

Fauj Ki Dahaad Song Lyrics Code M | Mr. BratBeat

Unknown said...

Good post....thanks for sharing.. very useful for me i will bookmark this for my future needs. Thanks.
Aloha Browser Turbo For PC

web design company said...

thanks for your information.it's really nice blog thanks for it.keep blogging.
web design company in nagercoil
website design company in nagercoil
web development company in nagercoil
website development company in nagercoil
web designing company in nagercoil
website designing company in nagercoil
digital marketing company in nagercoil
digital marketing service in nagercoil

python coaching said...

Check for full practical courses:
python course in coimbatore
java course in coimbatore
python training in coimbatore
java training in coimbatore

Daniel Bryan said...

Graceful written content on this blog is really useful for everyone same as I got to know. Difficult to locate relevant and useful informative blog as I found this one to get more knowledge but this is really a nice one.
digital marketing service provider

glass artwork said...

thanks for your details.
glass art work in pondicherry
glass painting work in Pondicherry
glass artwork in Puducherry
glass painting work in Puducherry
glass wall art in Pondicherry
glass artist in Pondicherry
church glass artwork in pondicherry
wedding hall glass artwork in Pondicherry
temple glass artwork in Pondicherry
mosque glass artwork in Pondicherry
interior glass artwork in Pondicherry
marriage brokers in nagercoil
nadar matrimony in nagercoil
thirumana thagaval maiyam in nagercoil
nagercoil matrimony
csi matrimony nagercoil
hindu matrimony in nagercoil
christian matrimony from nagercoil
matrimony in kanyakumari
matrimony in marthandam

renshiya said...

thanks for your information.
web design company in nagercoil
best web design company in nagercoil
website design company in nagercoil
web development company in nagercoil
website development company in nagercoil
web designing company in nagercoil
website designing company in nagercoil
digital marketing company in nagercoil
digital marketing service in nagercoil
seo service in nagercoil
seo company in nagercoil
social media marketing in nagercoil
ppc service in nagercoil
web design company in nagercoil
best web design company in nagercoil
web design company in nagercoil
website design company in nagercoil
web development company in nagercoil
website development company in nagercoil
web designing company in nagercoil
website designing company in nagercoil
digital marketing company in nagercoil
digital marketing service in nagercoil
seo service in nagercoil
seo company in nagercoil
social media marketing in nagercoil
ppc service in nagercoil

renshiya said...

thanks for your information.nice blog.
glass art work in pondicherry
glass painting work in Pondicherry
glass artwork in Puducherry
glass painting work in Puducherry
glass wall art in Pondicherry
glass artist in Pondicherry
church glass artwork in pondicherry
wedding hall glass artwork in Pondicherry
temple glass artwork in Pondicherry
mosque glass artwork in Pondicherry
interior glass artwork in Pondicherry
marriage brokers in nagercoil
nadar matrimony in nagercoil
thirumana thagaval maiyam in nagercoil
nagercoil matrimony
csi matrimony nagercoil
hindu matrimony in nagercoil
christian matrimony from nagercoil
matrimony in kanyakumari
matrimony in marthandam
glass art work in chennai
glass painting work in chennai
glass artwork in chennai
glass painting work in chennai
glass wall art in chennai
glass artist in chennai
church glass artwork in chennai
wedding hall glass artwork in chennai
temple glass artwork in chennai
mosque glass artwork in chennai
interior glass artwork in chennai

Photo Tour said...

I don’t know if it’s just me or if perhaps everyone else encountering problems with your blog. It appears as if some of the written text in your posts are running off the screen. Can somebody else please comment and let me know if this is happening to them too? This may be a issue with my web browser because I’ve had this happen before. Thanks https://royalcbd.com/product/cbd-oil-1000mg/

shane lee said...

With so many to choose from it can be difficult knowing which one is the best service for you. how to choose best stocks for next day

merlin said...

It's very useful blog post with inforamtive and insightful content and i had good experience with this information.
Selenium Training in chennai | Selenium Training in annanagar | Selenium Training in omr | Selenium Training in porur | Selenium Training in tambaram | Selenium Training in velachery

Data Analytics Cerification Training Course in Hyderabad said...

Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also.
Data Analytics Course in Hyderabad

Admin said...


Super Dj Remix Song New Latest Song Available On This Website,

Good Job Sir

Latest Official Song Download Now Click Here

Download Now Click Here

Customer relationship management said...

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot.

Devops Certification Online Training in bangalore

Devops Certification courses in bangalore

Devops Certification classes in bangalore

Devops Certification Online Training institute in bangalore

Devops Certification course syllabus

best Devops Certification Online Training

Devops Certification Online Training centers

Customer relationship management said...

I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you.

salesforce crm training in bangalore

salesforce crm class in bangalore

learn salesforce crm in bangalore

places to learn salesforce crm in bangalore

salesforce crm schools in bangalore

salesforce crm school reviews in bangalore

salesforce crm training reviews in bangalore

salesforce crm training in bangalore

salesforce crm institutes in bangalore

salesforce crm trainers in bangalore

learning salesforce crm in bangalore

where to learn salesforce crm in bangalore

best places to learn salesforce crm in bangalore

top places to learn salesforce crm in bangalore

salesforce crm training in bangalore india

Customer relationship management said...

Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.

Hadoop Spark Online Training

Hadoop Spark Classes Online

Hadoop Spark Training Online

Online Hadoop Spark Course

Hadoop Spark Course Online

Customer relationship management said...

Very interesting blog Thank you for sharing such a nice and interesting blog and really very helpful article.

Data Science Online Training

Data Science Classes Online

Data Science Training Online

Online Data Science Course

Data Science Course Online

IT said...

IEEE Final Year projects Project Centers in India are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Projects for CSE It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

JavaScript Online Training in India

JavaScript Training in India

The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

deiva said...

Thank you much for this tutorial; this is an informative and valuable blog.
java training in chennai

java training in omr

aws training in chennai

aws training in omr

python training in chennai

python training in omr

selenium training in chennai

selenium training in omr

Jayalakshmi said...

After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article.
hardware and networking training in chennai

hardware and networking training in tambaram

xamarin training in chennai

xamarin training in tambaram

ios training in chennai

ios training in tambaram

iot training in chennai

iot training in tambaram

praveen said...

This blog is Very Informative. And i glad to find your blog. Keep Sharing like this useful blog.

data science training in chennai

data science training in porur

android training in chennai

android training in porur

devops training in chennai

devops training in porur

artificial intelligence training in chennai

artificial intelligence training in porur

jeni said...

Outstanding blog post, I have marked your site so ideally I’ll see much more on this subject in the foreseeable future.
sap training in chennai

sap training in velachery

azure training in chennai

azure training in velachery

cyber security course in chennai

cyber security course in velachery

ethical hacking course in chennai

ethical hacking course in velachery

shiny said...

Great insightful content with good information.

sap training in chennai

sap training in annanagar

azure training in chennai

azure training in annanagar

cyber security course in chennai

cyber security course in annanagar

ethical hacking course in chennai

ethical hacking course in annanagar

itpurse said...

replica gucci 1955 horsebit bag
fendi peekaboo fake
Fake Gucci bag

Priyanka said...

Attend The Data Analyst Course From ExcelR. Practical Data Analyst Course Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Data Analyst Course.
Data Analyst Course

vivekvedha said...

Thanks for this informative blog.
acte chennai

acte complaints

acte reviews

acte trainer complaints

acte trainer reviews

acte velachery reviews complaints

acte tambaram reviews complaints

acte anna nagar reviews complaints

acte porur reviews complaints

acte omr reviews complaints


Sages Marketing said...

Very interesting blog. Many blogs I see these days do not really provide anything that attracts others, but believe me the way you interact is literally awesome.You can also check my articles as well.

Security Guard License
Ontario Security License
Security License Ontario
Security License

Thank you..

Data Science said...

Awesome article with valuable information it very helpful waiting for next blog update thank you.
Data Analytics Course Online 360DigiTMG

groarz branding solutions said...

thanks nice blog
digital marketing company in nagercoil
digital marketing services in nagercoil
digital marketing agency in nagercoil
SEO company in nagercoil
SEO services in nagercoil
social media marketing in nagercoil
social media company in nagercoil
PPC services in nagercoil
digital marketing company in velachery
digital marketing company in velachery
digital marketing services in velachery
digital marketing agency in velachery
SEO company in velachery
SEO services in velachery
social media marketing in velachery
social media company in velachery
PPC services in velachery
digital marketing agency in chennai
digital marketing company in chennai
digital marketing services in chennai


web design company in nagercoil
web development company in nagercoil
website design company in nagercoil
website development company in nagercoil
web designing company in nagercoil
website designing company in nagercoil
best web design company in nagercoil
web design company in velachery
web development company in velachery
website design company in velachery
website development company in velachery
web designing company in velachery
website designing company in velachery
best web design company in velachery


branding solutions in chennai
branding solutions in nagercoil
branding solutions in velachery

Tech Institute said...

Excellent blog with very impressive writing and unique content, information shared was very valuable thank you.
Data Science Course in Hyderabad

Data Science said...

Top quality blog with very informative information found very useful thanks for sharing.
Data Analytics Course Online

Cyber Security said...

Nice Information Your first-class knowledge of this great job can become a suitable foundation for these people. I did some research on the subject and found that almost everyone will agree with your blog.
Cyber Security Course in Bangalore

Cyber Security Course said...

Writing in style and getting good compliments on the article is hard enough, to be honest, but you did it so calmly and with such a great feeling and got the job done. This item is owned with style and I give it a nice compliment. Better!
Cyber Security Training in Bangalore

Ethical Hacking Course said...

Great article with valuable information found very resourceful and enjoyed reading it waiting for next blog update thanks for sharing.
Ethical Hacking Course in Bangalore

Mohd Sharique said...

amazing post thanks for sharing.

Python Training In Pune
python training institute in pune

PMP Certification said...

Hello! I just want to give a big thank you for the great information you have here in this post. I will probably come back to your blog soon for more information!. PMP Certification in Hyderabad

Business Analytics Course said...

They are produced by high level developers who will stand out for the creation of their polo dress. You will find Ron Lauren polo shirts in an exclusive range which includes private lessons for men and women.

Business Analytics Course in Bangalore

Data Analytics Course said...

It's like you understand the topic well, but forgot to include your readers. Maybe you should think about it from several angles.

Data Analytics Course in Bangalore

Grace Ella said...

I was worried about my illness as well as studies so that I decided to seek help from a writing service in order to reduce my stress and increase my grades. I am assured that seeking help from can reduce the stress of the students. Dissertation Writing Service

Gloobal Connectt said...

Please keep sharing this types of content, really amazing. Please follow my website for more information in Best Event Management Company in Kolkata.

Pankaj Singh said...

Great Post, thanks for sharing such an amazing blog with us. Visit Ogen Infosystem for creative website design and PPC Services in Delhi, India.
Website Designing Company in Delhi

Unknown said...

Thanks for sharing this amazing blog

Bis Consultant in delhi

Liza Mineli said...

Good post! If you post the same on twitter and want to get many likes on it use this site https://viplikes.net/ to get as much twitter likes as you need