Months ago, I wrote a post on some of my preferred HTML Code Styles during which I shared two specific things that I do whenever I am writing markup.
Specifically, I do the following things:
- Comment Terminating Tags
- Underscore Class Names
When it comes to writing code, there are always going to be standards – well, at least there should be – that depend on the proverbial sandbox in which we’re playing.
These standards will outline certain things that we should do, but there are always bound to be gray areas. Case in point: I know people have often commented (no pun intended) that they aren’t a fan of the way that I terminate certain closing blocks with comments such as `// end if` or `// end while` or `// end class`.
Which is completely fine – to me, that’s an example of a gray area that gives us, as developers, room for implementing our own unique styles. But then there are others that really should be reconsidered.
And that’s what I’ve had to do with some of my markup styles.
HTML Code Styles, Revisited
During the course of a developer’s career, there are going to be changes that are made in the tools that we use, in the strategies that we employ for designing and building software, and even in the way we write code.
Case in the point, I once wrote the following:
The second thing that I’m trying to implement on a more consistent basis is to use underscores rather than dashes to space out multiple words in ID’s and classnames.
This is because that when you opt to select the text, most IDE’s will only select the word leading up to the hyphen whereas if you use an underscore, then it will highlight the entire word.
But, to be honest, this choice was made for the sake for convenience rather than for the sake of good semantic conventions. And that’s a wrong reason for writing code in one style over the other.
Cool Story, Bro
I know, I know. There’s not really anything practical in this post other than simply sharing a convention that I’ve changed of my own.
However, since it is something that I’ve discussed before and that I’ve changed during the course of my work, and since this blog has been (and will continue to be) more or less a showcase various things that I’ve worked on over the past few years, it seemed fitting to include it here.
Leave a Reply
You must be logged in to post a comment.