Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
171

Michael Durrant's answer is IMHO not bad, but it is not literally answering the question (as he admitted by himself), so I'll try to give an answer which does: I also understand that comments should explain why the code does what it does, not how. Given all this is it even possible to write good coding standards that capture this idea? Obviously you ...


151

Major anti-pattern leading to poor quality code with less clarity btw readers, the title was originally "comment every line of code?" and you can imagine the instinctive reaction of many of us, myself included. I later retitled to the longer more accurate title. At first, reading your question I thought, yuch duplicate stuff in comments , but ok, maybe if ...


140

The North American Numbering Plan reserves 555-01 numbers for fictitious purposes. If you want an example Seattle number, for example, +1 206 555 0100 - +1 206 555 0199 would do. In the United Kingdom, Ofcom, the regulator, has set aside numbers for this purpose. For example, if you want a Leeds number, +44 113 496 0000 - +44 113 496 0999 may be used. I'm ...


63

Never attribute to malice that which is adequately explained by stupidity. -- Robert J Hanlon. That, and a lack of communication. So, it's not a conspiracy of anti-ISO sentiment making people think "I know, I'll use UK instead of GB", nor is it an inclination that "they know better", or even a sense that the standard is no good. It'll be entirely because ...


55

Not for UTF-8, but see the various caveats in the comments. It's unnecessary (UTF-8 has no byte order) unlike UTF-16/32 and not recommended in the Unicode standard. It's also quite rare to see UTF-8 with BOM "in the wild", so unless you have a valid reason (e.g. as commented, you'll be working with software that expects the BOM) I'd recommend the BOM-less ...


45

There are a few reasons why sticking to the standard is a good thing. Being locked into a compiler sucks hard. You're completely at the mercy of a group of developers with their own agenda. They're obviously not out to get you or anything, but if your compiler starts lagging on optimizations, new features, security fixes etc, too bad; You're stuck. In ...


40

An oft-used example phone number is the numeric progression. (123) 456-7890 It's widely understood that this doesn't mean you should call that number -- it's an example. Additionally, according to the North American Numbering Plan, it's an invalid number -- area codes can't start with 1. Alternatively, if you don't need digits, the pound sign, all ...


34

update: See bottom of reply This answer comes a bit too late, but I hope to shine light to others (particularly now that C++ standard committee wants to incorporate Cairo into std): The reason nobody really cares about "accelerated vector graphics" is because of how GPUs work. GPUs work using massive parallelization and SIMD capabilities to colour each ...


32

Let's think about the specifics here for a moment, using examples you've cited: ntfs - Proprietary to Microsoft. Anyone who is not Microsoft cannot use this, therefore would have to use/create something different. Now, if you are Microsoft, you want to use this over FAT because of the issues of the next bullet point. fat32 - Not sufficiently modern. The ...


32

When I program in Ruby, I generally always ignore the ISO Ruby standard. Why? Because it's incredibly restrictive! ISO Ruby is a minimal subset of the intersection of Ruby 1.8 and Ruby 1.9. The current version of Ruby, which is supported by all Ruby implementations (or at least will be very soon) is Ruby 2.1, and it has many features that make programming ...


27

This is a fairly common practice, although I wouldn't say supportability is the main benefit. The real benefit for this approach is keeping an audit trail. It's also common place to have an extra column containing the username of the user who made the last update. If you're dealing with any kind of financial or sensetive data, I'm sure you've heard of ...


27

The coding standards aren't the problem. The problem is that management can't figure out what the problem is. This leads to "Do something…anything!" mode. You're looking for a rational solution, but it's an irrational problem. The best you can do is: Give constructive criticism of their ideas, but once the decision is made don't continually whine ...


25

I'd argue that it's not so much won as ceased to matter. ARM which makes up basically all of the mobile market is bi-endian (oh, the heresy!). In the sense that x86 basically "won" the desktop market I suppose you could say that little endian won but I think given the overall code depth (shallow) and abstraction (lots) of many of today's applications, it's ...


25

I don't think it is really true that nobody really cares about "accelerated vector graphics" as written in this answer. Nvidia seems to care a fair bit. Besides Kilgard who is the lead technical guy on NV_path_rendering (henceforth NVpr to save my fingers), the Khronos president, Neil Trevett, who is also a VP at Nvidia, has promoted NVpr as much as he ...


24

Short answer: One size does not fit all. There are trade-offs. For example if you want a journaled FS, you pay (efficiency, complexity, etc.) for it but get something out of it. Some don't feel the need for a journaled FS and don't want to pay for it, some do. Same with other "features" of the FS.


23

Short answer: 830-1998 is not a standard, it is a recommended best practice on how to write SRS in the style of 1998. I can't find how it was superseeded (even with IEEE's advanced search :( ) But I guess it's because the whole method on how we specify requirements has changed drastically in recent years. So, from now on, I try to answer a bit of ...


23

I don't think a coding standards document is the place to specify what is already common sense. The purpose of a coding standard is to guarantee consistence (and avoid arguments) about issues where reasonable people might disagree and there is no single obvious right answer, e.g. naming conventions, indentation etc. Such commenting as in your example is ...


22

Per your example, "GB" is the country code for the United Kingdom. However, "UK" was the at one time the MARC (US Library of Congress) standard code, although I believe that's deprecated. And the IANA uses .uk for the top-level domain for the United Kingdom. So, if something doesn't conform to an ISO standard, it doesn't mean that no standard is being ...


21

Many of the older standards organisations do still charge for their standards, but IMHO it acts as a barrier to wider adoption of the standards. Many standards organisations already manage to provide their standards free. IMHO organisations like ISO and ANSI seem quite outdated by still charging. Here is an arbitrary personal selection of important ...


21

The term "standards" in programming often refers to a technology/document that is governed by a group or community. The members of that group often share common invested goals, are active users of that technology and want to ensure the technology continues. There are many "things" in programming that have a community that governs them. These members can ...


19

It is not possible. What you are essentially trying to do is nearly to mechanize good judgment. When writing critical software such as for life supporting medical systems, huge amounts of checklists and whatnot are virtually inevitable. Not only do even smart people make mistakes, a lot of the software for these devices is written by people that aren't very ...


19

The C standard library is part of the C programming language, so it is a specification (written in English in some technical report). For example, the n1570 document is explaining what is malloc and how it should behave. There is also another relevant specification, the C POSIX library (which is more or less a superset of the C standard library). For ...


18

It used to be, and I hope still is, that anybody can publish anything as a Request for Comments (RFC) draft document at the Internet Engineering Task Force (IETF). This is the perfect place to publish your new protocol: http://www.ietf.org/contact-the-ietf.html It exists entirely so that new protocols and proposed standards can be published, widely read, ...


18

My advice is not to bother. WADL has not been that widely adopted See this question on Stack Overflow and there are some strong views that's it's not a good fit with the kind of 'proper' REST you describe, as shown here on another Stack Overflow question. WADL descriptions are time consuming to build (and mostly manual) and they add a brittleness that ...


17

The former argument is invalid, because adding a few database maintained timestamp fields to a series of tables is not difficult work. This is in fact the kind of mind numbing task that one would give to a junior or an intern, and they could easily do it in a single two week sprint with time to spare. It may or may not even be necessary to map these fields ...


17

With regards specifically to ISO standards, there is a question/answer in their FAQ that addresses why ISO standards cost money: ISO standards cost money to develop, publish and distribute. Someone has to pay. The current system whereby users are requested to pay for the standards they use, not only sustains the development process but also, very ...


17

i,j and k are the standard counter variables. By using them you imply the variables are used to keep loop count and nothing else. If you use another more complex name then its less clear what the variable is used for. If your counter variables are getting confusing then its a sign your code needs breaking up. i.e for(int i=0;i<numMesh;i++) foo += ...


16

For C The Standard says that a return from the initial call to main is equivalent to calling exit. However, a return from main cannot be expected to work if data local to main might be needed during cleanup. For C++ When exit(0) is used to exit from program, destructors for locally scoped non-static objects are not called. But destructors are called if ...


Only top voted, non community-wiki answers of a minimum length are eligible