programming languages

Monkeypatching For Humans

c#

Monkeypatching For Humans

Although I love strings, sometimes the String class can break your heart. For example, in C#, there is no String.Left() function. Fair enough; we can roll up our sleeves and write our own function lickety-split: public static string Left(string s, int len) { if (len == 0 || s.Length == 0)

By Jeff Atwood ·
Comments
Spartan Programming

programming languages

Spartan Programming

As I grow older and wiser even older as a programmer, I’ve found that my personal coding style has trended heavily toward minimalism. I was pleased, then, to find many of the coding conventions I’ve settled on over the last 20 years codified in Spartan programming. No, not

By Jeff Atwood ·
Comments
Regular Expressions: Now You Have Two Problems

regular expressions

Regular Expressions: Now You Have Two Problems

I love regular expressions. No, I’m not sure you understand: I really love regular expressions. You may find it a little odd that a hack who grew up using a language with the ain’t keyword would fall so head over heels in love with something as obtuse and

By Jeff Atwood ·
Comments

programming languages

ASCII Pronunciation Rules for Programmers

As programmers, we deal with a lot of unusual keyboard characters that typical users rarely need to type, much less think about: $ # % {} * [] ~ & <> Even the characters that are fairly regularly used in everyday writing – such as the humble dash, parens, period, and question mark – have radically different meaning

By Jeff Atwood ·
Comments

ruby

Exploring Wide Finder

I have decidedly mixed feelings about the book Beautiful Code, but one of the better chapters is Tim Bray’s “Finding Things.” In it, he outlines the creation of a small Ruby program: counts = {} counts.default = 0 ARGF.each_line do |line| if line =~ %r{GET /ongoing/When/dddx/(dddd/

By Jeff Atwood ·
Comments
The Greatest Invention in Computer Science

programming languages

The Greatest Invention in Computer Science

What do you think the single greatest invention in computer science is? Besides the computer itself, I mean. Seriously, before reading any further, pause here for a moment and consider the question. I’ve talked before about how young so-called modern computer programming languages really are, and it bears repeating

By Jeff Atwood ·
Comments
Strong Opinions, Weakly Held

programming languages

Strong Opinions, Weakly Held

I seldom pause to answer criticism of my blog. If I did, I’d have time for little else in the course of the day, and no time for constructive work. But occasionally I’ll encounter a particularly well written critique that gives me pause, such as Alastair Rankine’s

By Jeff Atwood ·
Comments
It’s Clay Shirky’s Internet, We Just Live In It

programming languages

It’s Clay Shirky’s Internet, We Just Live In It

I can’t remember when, exactly, I discovered Clay Shirky, but I suspect it was around 2003 or so. I sent him an email about micropayments, he actually answered it, and we had a rather nice discussion on the topic. I’ve been a fan of Clay’s writing ever

By Jeff Atwood ·
Comments
PHP Sucks, But It Doesn’t Matter

php

PHP Sucks, But It Doesn’t Matter

Here’s a list of every function beginning with the letter “A” in the PHP function index: abs() acos() acosh() addcslashes() addslashes() aggregate() aggregate_info() aggregate_methods() aggregate_methods_by_list() aggregate_methods_by_regexp() aggregate_properties() aggregate_properties_by_list() aggregate_properties_by_regexp() aggregation_info() apache_child_terminate(

By Jeff Atwood ·
Comments

xml

XML: The Angle Bracket Tax

Everywhere I look, programmers and programming tools seem to have standardized on XML. Configuration files, build scripts, local data storage, code comments, project files, you name it – if it’s stored in a text file and needs to be retrieved and parsed, it’s probably XML. I realize that we

By Jeff Atwood ·
Comments
Understanding Model-View-Controller

programming languages

Understanding Model-View-Controller

Like everything else in software engineering, it seems, the concept of Model-View-Controller was originally invented by Smalltalk programmers. More specifically, it was invented by one Smalltalk programmer, Trygve Reenskaug. Trygve maintains a page that explains the history of MVC in his own words. He arrives at these definitions in a

By Jeff Atwood ·
Comments
Programmers Don’t Read Books – But You Should

programming languages

Programmers Don’t Read Books – But You Should

One of the central themes of stackoverflow.com is that software developers no longer learn programming from books, as Joel mentioned: Programmers seem to have stopped reading books. The market for books on programming topics is miniscule compared to the number of working programmers. Joel expressed similar sentiments in 2004’

By Jeff Atwood ·
Comments