2

I recently started as a consultant for a company. I've been asked to set up the base for a custom portal being built for the company. I decided to use Bootstrap as the front-end framework.

The problem is that my manager and the tech lead insist on using tables for layouts instead of the div-based way that I'm used to and is the norm nowadays. The reason for using tables is that the structure of the page remains the same irrespective of page size.

Apart from that, CSS and JS is written inline and scattered all over the place. When I pointed this out, the response was "Everyone has their way of doing things. This is my way."

How do I convince them to follow best practices?

6

Show, don't tell

Frankly, I doubt you'll be able to convince them solely through presenting a case for or against a particular way of doing things, especially given the response you've already received (which suggests that they may not be open to a logical argument).

Instead, just start implementing best practices as you go. You'll have to deal with the table layouts for existing pages, but new pages (and better yet, projects, if your company does projects) provide you with a chance to convert to a div-based layout. For existing pages, you can move all of the inline styles to stylesheets and clean up the HTML as you go along.

Additionally, prepare responses for the questions you'll likely receive for making such changes. Here are some ideas:

Q. Why did you remove all of the styles from the HTML?
A. I moved them to an external style sheet so that styles can be reused and so that we can leverage the cascading nature of CSS. This will allow us to reduce file sizes, which not only increases download speed, but also makes maintaining the pages easier and faster. It will also allow us to leverage browser caching, because external stylesheets get cached and, therefore, only downloaded once.

Q. Why did you use divs for layout?
A. The W3C specifies semantic meanings for elements, and tables have a semantic meaning as tabular data. My migrating to divs, we can reserve tables for tabular data, making them more meaningful, especially to visitors that aren't using visual browsers (including screen readers, and search engine spiders). It will also help SEO, because search engine spiders may not see a table-based layout as primary page content.

Q. Why did you move the JS?
A. Like the CSS, putting the JS in its own file allows us to reuse the same code, allowing us to follow DRY principles, and it will be cached by the browser. It also enables us to write non-obtrusive code that will degrade gracefully in the event that the user doesn't have JavaScript enabled and will eventually allow us to refactor the code to better leverage the power of JavaScript's capabilities.

The W3C has taken quite a bit of time determining the elements and their semantic meaning so that a well-written page is usable on a large variety of devices. You can find their accessibility guidelines here, which go into great detail about why writing to these standards are important, and how to go about doing thing. You'll probably be able to find references in it and the spec itself to back up most, if not all, best practice arguments you come across, until you start moving away from raw HTML, CSS, and JavaScript, and into frameworks and libraries (Sass, Bootstrap, etc) and other higher-level concepts (OOCSS, etc).

  • I agree with this answer and think it is the best approach - but I don't think it's fair to say their behavior suggests they may not be open to a logical argument. There are lots of logical reasons for a company not to adopt current best-practices. – Rob P. Oct 2 '13 at 20:03
  • 1
    I went through this, cleaned up the web pages, and when the supervisor changed the skin of the site, those inline CSS declarations are back. – Mickael Caruso Oct 8 '15 at 15:58
2

This is a typical position many people will have with technology. They know how to do some things, but needed to hire someone to dedicate more time to a growing project and to a certain extent add expertise. However, they don't want you to add so much expertise that they no longer can understand and possibly enhance the work you do.

Are using divs so much better? Will you be able to demonstrate this? There may only be a few cases where this applies. Could you take some additional time to get the client up to speed on this technology?

Another approach is to indicate how much this is going to slow you down and probably anyone else they could hire who is accustomed to the new technology. Time is money.

They're just trying to mitigate risk and some people choose to water-down the technology. All you can do is provide the pros and the cons. I'm not sure claiming "standards" alone is enough without demonstrating more drawbacks.

2

How do I convince them to follow best practices?

"Best practices" are a misnomer.

At their "best", Best Practices are advice that works well in many contexts. At their "worst", Best Practices are advice that worked well in a particular context, but has no relevance elsewhere. Typically, practices fall somewhere in the middle of this spectrum.

Each context is different from the next. What worked well for you in the past, may have fatal flaws for your customer today. You may value elegance, readability, or maintainability most, they may value shipping early, or using a familiar layout most. Unless you know all of the details of their thinking (both explicit and implicit) you'll have a hard time deciding what is best for them. You may be able to settle on good enough, though.

Instead of worrying about Best Practices, focus on "what works well in the particular context at hand".

Unless you were hired to teach them your thoughts on what constitutes a Best Practice for Web Design, talk with your manager. Explain the differences between what you are suggesting, and what they have chosen.

Learn what's important to this company, and how they decide between design alternatives.

Point out the pros and cons of your solution (and if you cannot find any cons, I suspect you aren't trying hard enough). Point out the pros and cons of their solution. Then, let the customer (your manager) make an informed decision, live with that decision, and move on.

In business, "Good Enough Practices" are usually what works.

0

I have worked in software development for 14 years. I do not like the term 'best practice'. It's a novice term. There are not really 'best practices' because who defined them and why is this person so special? I have found that when people throw 'best practice' at me, they usually don't know anything...

That being said, experience will teach you better ways to do things. So talk to your manager about why you think we should do 'x' and why it will make things better. All reasons for changes should be associated with what is called 'value added reasons'. These do not include it means 'x best practice' because that is bogus. It means 'this is how doing 'x', will reduce bugs, reduce 'run around like a chicken with your head cut off time, reduce cost, and improve the product.

Apply this directly and show how it will make things better. If possible give examples from previous employers or from previous managers. Do not quote 'best practice'. That just tells people you are a novice.

It is critical to sell this as a 'phased in' change that will not disrupt development time. That is so you can add it in pieces as you move forward.

All this being said, it's tough to fight City Hall. Every workplace has a culture. Many have a culture of stupidity. I have been in places where people do stupid stuff and the is response 'we always do it this way so what is one more time'. Then they turn around and complain about it the next day, but the time it happens again they forget about the complaint. Do not expect immediate results.

  • 9
    "who defined them and why is this person so special?" - It may have to do with the fact that the W3C has defined them, in depth, and they're "so special" because they created the spec that we all use, every day. When it comes to front end web development, it's very rare that best practices are arbitrary. – Shauna Oct 2 '13 at 16:13
  • 1
    @Shauna Can you point to a reference where w3c says using divs is a 'best practice' over using tables ? – happybuddha Oct 2 '13 at 16:48
  • 1
    Though not really an answer, I like this. Downvoters should care to explain. Upvoted – happybuddha Oct 2 '13 at 16:49
  • 7
    @happybuddha - Right here. Specifically point number 2, which is too long to directly quote here, but in a nutshell says that elements should be used according to their semantic meaning. The semantic meaning of tables is to display tabular data, not to lay out elements on a page. – Shauna Oct 2 '13 at 16:59
  • 4
    Additionally, the W3C specification, itself, says explicitly, Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. – Shauna Oct 2 '13 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.