Best Practices to writing Frontend code