The VP Geek Speaks
- Home /
- The VP Geek Speaks
Write Bulletproof JavaScript
While display issues have long been the bane of a web developer’s existence, current web development projects tend to have much more client side interactivity, focusing ever more attention on the reliability and resilience of the JavaScript you write to deliver the complete interactive experience. Many things can cause unexpected errors in your carefully crafted code.
However, there are a few things that you can do to make sure that your site degrades gracefully and still provides a basic level of functionality when something in the browser goes wrong. The following snippet of code illustrates a few best-practices for defining your JavaScript namespaced modules.
JavaScript Can Have An Interesting Interpretation of Order
There is an interesting little quirk with the way in which JavaScript decides which function it should execute next. You see, while the JavaScript engine has a single thread of execution, it creates the illusion of multiple simultaneous processes running at once by utilizing a queue of functions to execute. This means that every time you make a call to a function in your JavaScript, there is no absolute guarantee that it will be the next piece of code run, as there may have been other events triggered that beat your custom function onto the execution queue.
Avoid Custom mod_rewrite Rules with Varnish
When you are working on a website project running PHP on Apache, and you need to redirect a single device type to a different URL than the rest of your visitors, I’m sure the first thought that many of you would have is to utilize Apache’s mod_rewrite. It is a highly flexible URL rewriting engine that would allow you to rewrite with almost any combination of requirements to a just as complex set of URLs depending on the situation.
Let's talk about equality
Equality has been a major topic of discussion over the last few weeks. Whenever this topic comes up, I am always suprised how limited many people’s knowledge about true equality is. Relax everyone, I am talking about equality operators in JavaScript, and not the topic of national discussion recently.
Thinking back to some interviews I have been a part of recently, it became extremely obvious how little most Front End Web Developers know about the JavaScript equaltiy operators. You got that right, I said “operators” because there are two operators that test for equality between two objects, == and ===.
Top Job Applicants Never Stop Learning
From time to time, my job allows me to be a part of the hiring process for our technical positions. Unfortunately for some of the applicants, I repeatedly come away from these interviews amazed at the responses I get from pretty standard and basic technical questions related to Web Development.
Recently we were looking for a front-end web developer that was good at UX and design and proficient at HTML, CSS, and JavaScript. One of the things that we tend to ask everyone is to rate themselves on a scale of 1 to 10 as to how good they are with each technology. The majority of responses are in the 5-8 range with the corresponding answers to the questions about each techology falling about in the range you would expect. A couple of applicants were brave enough to rate themselves at a 9.5 out of 10 on HTML, CSS, and JavaScript, leading us to believe they were “exceptional applicants”.
Bing ignores robots.txt
One of the long-standing conventions on the web is that automated search engine crawlers should follow a set of rules about what pages they should and should not visit and index. For many crawlers or bots, all you have to do is properly setup your robots.txt file, and viola, you control what the bot will and will not visit. The GoogleBot tends to behave well according to what is in the robots.txt file, but there are others, specifically BingBot that do not.
Top 3 Reasons to Avoid Magento's getFirstItem()
Magento utilizes a lot of helper functions as well as the Zend Framework and ORM. While this makes things easier to develop, there are areas where this actually makes getting things done more difficult. The very first area that comes to mind is when you are trying to only retrieve a single record from the database. If you were to search Google for the proper way to do this, you would do the following, assuming $collection is your collection object.
Do you have too many big balls?
Managing a software development team can be a difficult task when everything is moving along exactly as expected. When you add in the paradigm shift of Agile Software Development with Scrum, management doesn’t always have the same insights into what makes up an efficient use of a development team’s time. For the rest of this post, lets assume that we are working with a 2 week sprint, with the first day half-used for sprint planning, and the last day half used for the sprint retrospective.
Web Browser Font Rendering is the New Edge Case
In the early days of the web, designers and developers relied upon visitors to the sites they were developing to have their chosen font pre-installed on their computers so that their web browser of choice would be able to properly render the selected font. As quickly became obvious, there is a wide variety of fonts installed across all computers worldwide, so this was not an achievable scenario, especially when print level typography was desired. Unfortunately, at that time, the solution was to put all of the text in an image, ensuring the text would display exactly as the designer had specified, but hiding the same text from search engines and blind users.
LocalStorage and Safari Weirdness
One of the technologies that has been intriguing to me for a while has been LocalStorage on the web browser. One of my first adventures into using persistent storage other than cookies on a web browser was the short-lived HTML 5 standard of the webSQL database. It turns out that it was simply a SQL Lite database that was accessible via JavaScript in all the WebKit browsers as well as Firefox. However, Internet Explorer did not implement this functionality, and the webSQL standard was soon dropped from the HTML 5 standard itself, leaving only the LocalStorage key/value storage mechanism.
Categories
Tags
- 100pounds
- 2020
- Acp
- Adblock-Plus
- Adoption
- Agentic
- Agents
- Agile
- Ai
- Ai-Agents
- Amazon
- Apache
- Apple
- Architecture
- Authorize-Net
- Automation
- Azure
- Bing
- Bingbot
- Blog
- Book-Reviews
- Books
- Burnout
- Business-Tools
- Cache
- Career
- Chatgpt
- Chrome
- Cicd
- Claude
- Cloudflare
- Code-Quality
- Code-Review
- Codex
- Coding
- Coding-Agents
- Compass
- Conversion
- Copilot
- Css
- Culture
- Cursor
- Cve
- Design-Patterns
- Developer-Experience
- Developer-Tools
- Developer-Velocity
- Development
- Disqus
- Docker
- Documentation
- Enterprise
- Fine-Tuning
- Firefox
- Future-of-Work
- Gemini
- Genesis-Framework
- Getting-Started
- Ghost-Tag
- Github
- Github-Copilot
- Githubpages
- Google-Slides
- Google-Workspace
- Governance
- Helper
- Hiring
- How-Not-To
- How-To
- Html
- Hugo
- Infrastructure
- Integration
- Internet-Explorer
- Interviews
- Iphone-6
- Javascript
- Jekyll
- Jetbrains
- Jquery
- Junior-Developers
- Knowledge-Management
- Laravel
- Leadership
- Legal
- Lessons-Learned
- Local-First
- MacOS
- Magento
- Magento 2
- Magento2
- Management
- Mcp
- Meetings
- Mental-Health
- Mentorship
- Metr
- Metrics
- Microsoft
- Moltbot
- Multi-Agent
- Mysql
- Netlify
- Nginx
- Nodejs
- Open-Source
- Openai
- Openclaw
- Orchestration
- OSX
- Performance
- Personal
- Php
- Policy
- Presentations
- Process
- Productivity
- Programming
- Prompt-Injection
- Pull-Requests
- Python
- Quality
- Rant
- Remote-Work
- Research
- Responsive-Web-Design
- Retrospective
- Roi
- Safari
- Sales
- Scrum
- Security
- Senior-Engineers
- Series
- Sitecatalyst
- Sota
- Sql
- Sql-Server
- Tasks
- Teams
- Technical-Debt
- Testing
- Tier-Pricing
- Tips
- Tmobile
- Tools
- Trust
- Unittest
- Ux
- Varnish
- Verification
- Vibe-Coding
- Visual-Studio
- Web-Development
- Windows-7
- Windows-Vista
- Woocommerce
- Wordpress
- Workflow
- Workflows
- Xml