NewsTechTechnology

One of my favorite analogies for breaking code down is from Nicole Sullivan.

All by combining the same little tiny pieces in different quantities, in a different way, and in a different order.

So, instead of looking at your project and preparing to build a monolithic contact page, think about combining a series of inputs and buttons inside a content area, which is next to a sub content area, which in turn is surrounded by a header and a footer.

Stop thinking in terms of pages and start thinking in terms of components. If you need to build a search form, you can probably reuse and repurpose the same inputs from the contact form. Breaking your code down into Lego-like chunks gives you the ability to do a lot more with it.

Keep your class names relevant but neutral, sensible but portable. Instead of writing class names that describe the content, try to write names that can be applied to any type of content, and that describe the visual treatment that the class will add.

Lastly comment

Writing classes that describe content is redundant and serves to help no one. What is useful is knowing a class isn’t tied to a particular type of content, and that it is abstracted enough to be reused elsewhere. Nicole Sullivan’s media object14 is a perfect example of this way of thinking. Class names that don’t allude at all to the type of content are highly reusable.

Tags

Related Articles

Leave a Reply

Back to top button
Close