Web-Development – General Notes

Do not add css styles and javascript handler for the same class

Separate css styles and javascript logic for not making your code extremely tight coupled.
For example add these 2 classes for the element: “.navbar-search .navbar-search-action”.
And then add styles for the first one and bind javascript events for the second one.

Do not use ID selector

Bad thing about it that you cannot use same ID selector twice on page and you cannot use multiple ID selectors for the same element.

The only case you need to use ID for is the label-input connection. The other cases better to replace it with classes selectors.

Keep the same naming in BE, FE and DB

If the field in db was renamed from active to is_active, then rename this variable to is_active in FE and BE too. This will save you a lot of time while developing and maintaining the app.

Avoid too much of abstraction

It is much better to have show_state() and hide_state() than toggle_state(‘show’)

No code = No problems

Less code means less bugs, less time on maintenance, less time to found the issue, little bit less time on execution.

Leave a Reply

Your email address will not be published. Required fields are marked *