When and where to determine the ID of an entity

It always amazes me when I randomly come across an article or a blog post precisely on the subject that I’m mulling over in my head – all without searching specifically for the solution or even researching the problem domain.  It’s almost like the universe knows what I’m thinking and sends help my way.

When and where to determine the ID of an entity” is an example of exactly that.  Lately, I’ve been working with events in CakePHP a lot.  And for one particular scenario, I was considering the beforeSave() event in the model layer, which would trigger some functionality that modifies data in other models.  So, having a reference of the current ID would be useful for debugging and logging purposes.  But since the current entity hasn’t been saved it, the ID is not there.   And that’s where I started thinking about this whole thing and considering where is the right place to generate the ID.

One thing that kind of bothered me on top of the theoretical discussion, was the practical implementation, especially in different frameworks.  If I remember correctly, the earlier version of CakePHP framwork, used the presence or absense of the ID in the entity to differentiate between insert and update operations.  It might still be true now, but at least there is a way to work around it, as CakePHP now has isNew() method to check if the entity needs to be inserted or updated.

 

A guide for how to talk to a developer

A guide for how to talk to a developer“:

We built this resource to help you better communicate with any developers and other technical people that you work with. These flashcards teach and review basic technology vocabulary and computer science terms. We hope it’s helpful to you as you hire, manage, and collaborate with software engineers, your CTO, or other members of your technical team.

The guide is a collection of flip cards, broken down into three categories:

  • Computer Science (29 cards)
  • Languages and Frameworks (25 cards)
  • Developer Tools (12 cards)

Super cool!

11 Best Programming Fonts

It’s that time of the year once again, when you should take a five minute break from whatever it is you are doing.  Here are “11 Best Programming Fonts” that might help you out in being a little bit more productive.  If not that, than at least bring you a slight change and some eye candy, when staring at your code.

For me personally, Source Code Pro by Adobe (featured in the screenshot above) is still the best option.  I have it setup in the Terminator as Source Code Pro Semibold at size 11, which makes it large enough to work with the code comfortably and small enough to eat too much screen space.

If you want to find and compare more fonts, have a look at these two resources:

 

Understanding disk usage in Linux

Understanding disk usage in Linux” is a well written in-depth look into the Linux filesystem layer and how things work under the hood.  This is probably not something most people would have to deal on a day-to-day basis, but it is very useful for anyone doing system administration and looking for the better understanding of operating systems.