Tag: jquery

Basic Coding Standards

I came across lot of front-end developers asking “What are the basic coding standards for front-end development?” Well, honestly everyone have their own way of writing codes, the way they are comfortable. But, if you ask me we should follow a practice of coding that all the developers understand and also, saves their time.

Few points that I follow are most important while coding:

  1. Code Indentation – The code should be properly indented with tabs and spaces. The hierarchy should be in such a way that by looking it we as a developer easily understand the structure. Also, it avoids missing any tags to close.
  2. Comments  A lot of developers do not comment or else they comment a lot, comment tells yourself and another developer what is your code about and why is it there in the first place. Second a lot of comments increases the file size and which also leads to slow down the website.
  3. Nomenclature – This is a very crucial and one of the most important factor of coding standard, when writing HTMLs we often us classes and now here’s the issue “What should I use for classes? Hyphens(-)? CamelCase?” Again, CamelCase is apt for javascript/jQuery but, for CSS it is recommended to use hyphens because while typing you need not hit shift key again and again for capital letters in between which increase your chances of making mistakes. People say using hyphens increases the size of css well, so does a capital letter so its recommended to avoid hitting special keys and save time. Using names of classes related to div is important. If its a container we better name it as container instead main-container or main-section. Using smaller names increases the speed of coding and reduces the code length.
  4. Project Structure – Well it goes as follows:
    1. Project Name (Folder)
      1. img (Folder)
      2. fonts (Folder)
      3. js (Folder)
      4. css (Folder)
      5. index.html (Files)
  5. Image Sizes – To avoid large images in website few tips, choose .jpg images over png if background transparency isn’t an issue. Saving it with quality of 50% or Medium also helps in reducing the files size. It is recommended that we convert icons to fonts (https://icomoon.io/app/) for fast loading and optimization.
  6.  Minify – Once all the code is tested its a best practice to minify all the css and combine them in one which reduces the server calls. Same applies to javascript/jQuery post development multiple js files can be combined, minified and hosted. If possible we can minify HTMLs too.
  7. Backup – Backup has always been an issue but, its never an issue if we start our projects after creating a repository on git. I usually use https://gitlab.com/ and https://www.sourcetreeapp.com/

 

So, these are points that we all should follow while we code as a front-end developer.

Leave a comment for any queries or requests.

Why Hello world?

Hello There!

I have also thought why do we have this “Hello World” Program every time we start with a new language.  Being the first blog too I thought what better than this?

So here was what i found out, the reason for “Hello World”

Brian Kernighan actually wrote the first “hello, world” program as part of the documentation for the BCPL programming language developed by Martin Richards. BCPL was used while C was being developed at Bell Labs a few years before the publication of Kernighan and Ritchie’s C book in 1972.

The first documented use of code to print the message “Hello, World!” Brian Kernighan remembered writing the code for part of the I/O section of the BCPL manual. Martin Richards — who seems to have a treasure trove of notes, old documents, etc. — found the manual and confirmed that the this was the original appearance of the program. The code was used for early testing of the C compiler and made its way into Kernighan and Ritchie’s book. Later, it was one of the first programs used to test Bjarne Stroustrup’s C++ compiler.

It became a standard for new programmers after it appeared in Kernighan and Ritchie, which is probably the best selling introduction to programming of all time.

Reference: https://stackoverflow.com/questions/602237/where-does-hello-world-come-from

Powered by DisenoBox