New website: Take Two

Hey Craig. I’ve made some changes (hopefully improvements!) to the website:

Only the home page is working at the moment. I will get the other pages working soon, hopefully today.

Please do let me know (in no uncertain terms!) what you think of the new design. I’ve gone “mobile first”, so it should look respectable on your smart phone.

Passing myself off as respectable

There’s been a little bit of spring cleaning around here today!

I’m trying to get my house in order so I can pass myself off as respectable when I start promoting my new show In The Lab With Jay Jay in earnest.

To that end I have reviewed the look and feel of my wiki. It no longer has that black, green, and orange monospaced font vibe going on, but now uses the relatively unoffensive default theme.

It’s not using the latest Vector theme, but rather the legacy one. This was deliberate because I have a lot of big tables in my wiki (such as on my computers and shopping pages) and the legacy theme plays nicer with those.

I’ve also been tweaking the website for my show, including an updated about page.

The blog, the wiki, and the show also now all use my new favicon which is my take on the Hacker Emblem:

John's new icon, based on the Hacker Emblem

Context object versus global variables

I’m reading A Philosophy of Software Design by John Ousterhout and he says:

The context object unifies the handling of all system-global information and eliminates the need for pass-through variables. If a new variable needs to be added, it can be added to the context object; no existing code is affected except for the constructor and destructor for the context. The context makes it easy to identify and manage the global state of the system, since it is all stored in one place. The context is also convenient for testing: test code can change the global configuration of the application by modifying fields in the context. It would be much more difficult to implement such changes if the system used pass-through variables.

Contexts are far from an ideal solution. The variables stored in a context have most of the disadvantages of global variables; for example, it may not be obvious why a particular variable is present, or where it is used. Without discipline, a context can turn into a huge grab-bag of data that creates nonobvious dependencies throughout the system. Contexts may also create thread-safety issues; the best way to avoid problems is for variables in a context to be immutable. Unfortunately, I haven’t found a better solution than contexts.

Okay, so I’m just gonna step way out of line over here and suggest something heretical… but shouldn’t you just use global variables? You only introduced the context object so you could tweak it in unit tests, and you could just change your tests so that each one ran in a new process. Just sayin’.

…I suppose for the sake of completeness I should add a little more from Ousterhout which he said prior to the above:

Another approach is to store the information in a global variable, as in Figure 7.2(c). This avoids the need to pass the information from method to method, but global variables almost always create other problems. For example, global variables make it impossible to create two independent instances of the same system in the same process, since accesses to the global variables will conflict. It may seem unlikely that you would need multiple instances in production, but they are often useful in testing.

…so he is bending over backward to support multiple tests in one process, but he could just run each test in its own process and his problem evaporates.

6 Horribly Common PCB Design Mistakes and AppCAD

Today I enjoyed watching 6 Horribly Common PCB Design Mistakes and the follow-up video Design Mistakes You Must Avoid on Your New Electronic Product.

In the first video I learned about AppCAD Design Assistant which is a free tool which boasts a broad bunch of features (and, particularly, it can help you design an antenna on your PCB):

  • S-Parameter Analysis and Plotting
  • Active Circuit Bias Design
  • Cascade Noise and IP3 Analysis
  • Transmission Line Analysis
  • Signals and Systems
  • Complex Math Engineering Calculator

I haven’t used AppCAD yet, but I will check it out soon.