Code Validation - Clean Code
What is Code Validation?
Code validation is the process of checking that the coding of a web page is in compliance with the standards and recommendations set by the World Wide Web Consortium (W3C) for the web. Code validation helps to produce clean code.
Web page HTML (Hyper Text Markup Language), Cascading Style Sheets (CSS), hyperlinks (also know as links) and accessibility can be validated.
Code validation is done through the use of HTML validators, Cascading Style Sheet validators, link checkers and accessibility validators available on the Net or as downloadable software. Each type of validator will be covered in this article and the resulting benefits of clean code explained.
Why Validate Your Code?
Why Code Validation - Clean Code is Important
There is a whole planning process when designing a website which includes evaluating the audience's needs, capabilities (net savvy or not) and products and machines they have among other things.
Code validation helps eliminate problems (such as incorrect html document structure) so there is a better chance of the website being viewed by all on the Net as intended. The W3C has set standards that the browser programmers are to follow. Some browser are not fully compliant but if you validate the website code, basic coding errors will be eliminated that will cause problems when displaying the web page and result in a web page with clean code.If you validate your code it wil make it easier for:
- search engines to index your pages = Search engine optimization
- text readers to convey your information to the visually impaired = Accessibility
- those using special devices to surf the web = Accessibility
When using free coding and scripts found on the Net make sure that you select ones that are Cross-Browser Compatible and validate. Some of the free coding and scripts available on the Net do not validate because the creator has not implimented clean compliant coding techniques.
If you include affiliate links or reference a map at somewhere like MapQuest your page may not validate due to the coding you were given. If you are a beginner I would suggest that you leave the coding as it is and just get the rest of your page to validate.
So to summarize, Code validation is important for:
- Search engine optimization
- Cross-browser compatibility
- Code clean up
- Valid HTML coding
Code Validation from the Accessibility Point of View
Code validation increases the overall accessibility of the website. Alternate browsers for disabled users read all of the coding. If there are errors the browser will not convey your information correctly, a reason that clean code is important. Having clean code and accessible pages (beyond the scope of these tutorials) will help your page be viewable in a number of other devices.
New Web Designers (and the Old Timers) who wish to contract to Federal and State/Provincial agencies have to produce fully accessible sites. Validation gets the website part way there.
Code Validation from a Search Engine Optimization Point of View
Code validation is important to search engine optimization also. Search engines read the page coding from the top down. Having valid clean code will make it easier for the search engine spider to index your page.
HTML code missing quote marks in a tag can be a problem for the spider. Also, errors in coding can hide content from the spider. The page may render as intended but the coding errors stop the spider from reading the content you worked so hard to optimize. Once you validate the page coding these will be found and when corrected will result in clean code that the search engine spider can read and index.
The size of HTML coding and page affects the search engine spider's reaction to your page. The spider reads the HTML coding and text actually contained in the page. Code validation will help find some extra HTML coding that is not necessary. Scripts and features like Flash are not evaluated by the search engine spider. It is much better to have more text than HTML coding. Each search engine spider has an optimal page size so you will have to do some research to determine what would be the best size page (as far as html file size).
Moving formatting of font, images and other presentation styles to an external stylesheet will reduce the HTML coding side of you page size, leaving more room for the important stuff, content and result in a page with clean code.
Code Validation with Code Validators
- HTML (Hyper Text Markup Language) Code Validators What HTML code validators do, HTML code validators available, using the W3C's Validation Services, why your page won't validate and why when validating web pages you get "Fatal Error: No DOCTYPE specified!"
- CSS Code Validators What CSS code validators do, CSS code validators available, using the W3C's CSS Validation Services and why your page won't validate.
- Link Validators What link check validators do, link check validators available, using the W3C's Link Checker Services and what to do when the link checker finds broken links.