560 blogs tracked7,114 posts indexed

#representative-line

8 posts · 1 company · newest first

1

Representative Line: Terning White as a (Style)Sheet (opens on the source site)

Years ago, Stefan's company was short handed, especially on the developer team. But they had a large hell-desk support team. And at some point, someone had the genius idea: "PHP is easy for anyone to learn, and so our helpdesk folks should have no problem. Let's hand them development tasks." Which meant Stefan inherited lots of lines which look like this: $bgc = $tno ? '#FFFFFF' : '#FFFFFF'; Unlike many examples of this pattern, this is not the result of a pre-processing or templating step generating a conditional where both branches are the same value. Someone actually typed this. Also,…

representative-lineexcerpt only · body stays at the source
From the web
2

Representative Line: What it Doesn't Do (opens on the source site)

Alastair found this comment in his codebase, and wondered, "who wrote this comment?" A quick blame answered the question: he did. He did not, however, write the code. public function getAllMailers() { // This function neither returns Mailers, nor all of them. ... } I suppose the comment was easier to add that doing a global find/replace to update the function name everywhere. But I do wonder, what does this function return? In any case, sing along: "I wrote the comment, but I did not pick this function name". [Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with…

representative-lineexcerpt only · body stays at the source
From the web
3

Representative Line: Readable Formats (opens on the source site)

We all love format strings for generating human readable text. Certainly, they're a better choice than string concatenation. Even if I have a blind spot that keeps me from remembering the printf format tokens, I still prefer to use format strings. Jasmine has a co-worker that does use format strings, but they also miss using string concatenation. So they've found a way to combine them, and avoid the perils of making readable code that describes the format of their text. myField.DataFormatString = "{0:#,##0." + new string('0', 2) + ";(#,##0." + new string('0', 2) + ")}"; Now, in their defense,…

representative-lineexcerpt only · body stays at the source
From the web
4

Representative Line: A Diamond in the Rough (opens on the source site)

Mandy's co-worker recently learned about virtual inheritance in C++. It's become their new favorite button to push, and they only use virtual inheritance. Virtual inheritance is one workaround for the "diamond problem", where you have an inheritance tree that "recombines" via multiple inheritance: when a child class has a Hapsburg-esque parentage, it's hard to decide which inherited methods are being invoked or overridden. In C++, imagine you have class A, which gets derived into classes B and C. Class D then uses multiple inheritance to inherit from B and C. In practice, this means that D…

representative-lineexcerpt only · body stays at the source
From the web
5

Representative Line: Unique Testing (opens on the source site)

Nikolai M's team had a flaky CI/CD build. About 0.5% of the time, one of their tests would fail: frequent enough to be annoying, but not so frequent that it motivated management to assign anybody to investigate. Nikolai eventually dug in, taking the initiative. Microsoft's implementation of UUIDs calls them GUIDs. The GUID is, per the docs, really just a wrapper around UUID algorithms, and supports a variety of different UUID variants. I'm sure at some historical point, this wasnt't true, and Microsoft had some weird internal algorithm. That's not really here nor there, but the test that was…

representative-lineexcerpt only · body stays at the source
From the web
6

Representative Line: So Much Room (opens on the source site)

Today's representative comment ran out of room. int maxLen = getColumnSize(session, "audit", "text_value1") - 16; // Leave some room for No, it isn't continued on the next line and just got trimmed out, except perhaps by a careless merge. This is the entire comment. Clearly, written by David Chase, the creator of "The Sopranos". There are so many things we might be leaving room for. We could leave some room for dessert. Leave some room for activities. Leave some room for the holy spirit. Leave some room for improvisation. [Advertisement] ProGet’s got you covered with security and access…

representative-lineexcerpt only · body stays at the source
From the web
7

Representative Line: Both Ways Bug Me (opens on the source site)

There are many cases where some sort of debugging block sneaks by, especially cases where we see preprocessors or templates working, which leave us with nonsense like if (true == false) running in production. But Codemonkey found a new twist on that sort of thing, in a SQL query being run in production. WHERE (some conditions) AND (1 = 0 OR (1 = 1 AND (other conditions))) The OR means that by twiddling the first equality check, we can toggle "always return rows" with "return based on condition". Toggling the second we can make it "never return rows", which I'm not certain is actually useful.…

representative-lineexcerpt only · body stays at the source
From the web
8

Representative Line: We All Register This (opens on the source site)

Today's maybe more of a "representative data sheet entry" than anything else. Every developer has the experience of reading the documentation. If you've been at this for some time, you've probably read bad documentation. Documentation that is incomplete, inaccurate, or otherwise flawed. Or, my personal favorite, the brief time where Oracle tried to put all of its documentation into an Adobe Flex site (aka, a Flash application, not a real web app). That one had fun bonus features, like "breaking copy and paste" and "preventing you from deep linking to a piece of the documentation". But…

representative-lineexcerpt only · body stays at the source
From the web
8 shown

Privacy choices

Reading never requires analytics. These choices last 90 days on this browser.

Essential sign-in and security storage always stays on. Read the privacy notice.