Archive for category Virtual Brown Bag
The Virtual Brown Bag tomorrow (April 23) will start at 11am Central due to some scheduling conflicts. The website has been updated to include this information, as well as a link to last week’s video, in case you missed it!
Join us to check out what folks have to share, and maybe share a thing or two yourself. Meanwhile, here’s last week’s video, when we talked about “Now” pages, user stories, and some real neat Emacs tricks:
Remember when we used to Learn and Share at the Virtual Brown Bag Meetings back in 2009? It was so great, we even brought it back in 2016 (thanks to the efforts of my friends JB and George). Well, it’s time to bring it back… again!!
People have been asking me about bringing it back and I’ve been wanting to do it, and now the current situation we live in has just pushed me into getting it back up and running again.
The first meeting in this reboot is happening next week, April 16, 12-1pm Central Time, which by a very fortunately coincidence happens to mark the 11th anniversary of the very first VBB! How appropriate.
All you have to do is to head over to this link on April 16 and join us. If you click on the link now, you even get to set a reminder so you won’t forget it.
The format will be pretty much the same as we’ve done before.
What should you do between now and then? Well, take notes of things you learn, challenges you face, interesting articles your read… and then share those with us at the VBB! If you think you don’t have anything to share, join us anyway, and we may be able to change your mind about that. 🙂
Good things coming up for the Virtual Brown Bag:
The website is back up!
We are also on Slack:
A Community on Google:
Virtual Brown Bag Community on Google
We’re scheduling people to come give us a 10-30 minute talk on specific subjects, in order to get some discussions going. We’ll be publishing our schedule to some online calendar.
Other topics covered this week:
JB’s struggles with Ember
George’s checklist for project estimation:
I also shared about Rails Assets, and asked how the guys handle pulling libraries into Rails app. JB says he’s given up on using gems for that, and just puts the files into the project. I’ll probably try that, too.
JB also shared this: Google assets sync rails
My notes for last week’s VBB…
I talked about my struggles integrating AngularJS templates into a Rails app, which boiled down to me skipping a step or two following instructions on how to use the Angular-Rails-Templates gem.
For my professional blog, www.lassala.net, which is hosted on WordPress, I’ve been using a blogging tool called Blogo, which allows me to write my drafts in Evernote, and then edit the posts and publish it using this tool.
I’ve also mentioned my post Catching up with my Book Reading, and talked about three books I’ve finished recently that I really enjoyed:
Mastering Creativity, James Clear
The 22 Immutable Laws of Marketing, Al Ries & Jack Trout
Last week both George an I couldn’t make it to the VBB, but JB came through and shared more of his Earlang, Elixir and Phoenix love. The video is up and running so you can catch up (I just did!):
These are my notes from the meeting yesterday…
Went over the way I’m using Evernote.
George’s recommendation of a Machine Package Manager. Since I still do some work on Windows, I’ll check out this tool.
Vimium is a Chrome plugin that adds VIM commands to your web navigation. I’ve been using it for several years now, mostly for the following feature: I hit the F-key, and then Vimium assigns a combination of letters to anything clickable on the page, so I can do all of my web navigation without using the mouse.
George mentioned this tool as a etter console for Windows: https://conemu.github.io/
I’ll definitely check it out. I’ve been using Console2 for a long time, but ConEmu seems to be a lot better.
Emergent Task Planner
JB’s recommendation for a paper task planner. As much as I like doing everything electronically, I have started using paper for a couple of notes here and there (which I keep syncing it back into Evernote), just in order to try doing things differently. I may try out this task planner and see if it works with my flow.
JB shared a little of the awesomeness of Elixir’s pattern matching and how you can write some expressive code with it.
The video for yesterday’s meeting is up!
Back in 2009 I decided to take the brown bag meetings I used to host at the company I work for to another level, starting a meeting with folks online, where we would Learn and Share at the Virtual Brown Bag Meetings.
Back then we used to hold the meetings using Live Meeting, which was a problem for Mac users. It was also painful to turn the Live Meeting recordings into YouTube-compatible videos. Now we’re using Google Hangouts, which works for everyone, and automatically makes the recordings available on YouTube just a couple of minutes after the meeting is over.
You can check out the Virtual Brown Bag category on my blog to see what kind of things we’ve shared at our meetings. Lots of goodness, I can tell you that much!
Last week we’ve had our comeback meeting, just to see how Hangouts would work, and we took the chance to catch up and share a couple of things as well. Check it out! We’ll be meeting every Tuesday, at 12:30pm Central Time.
Follow us on https://twitter.com/virtualbrownbag, where you’ll be finding the link to join the meeting.
At this week’s Virtual Brown Bag, we’ve tackled mocks, stubs, Rhino mocks, and related things, since that was one of most voted suggestions from our folks VBBers. Mark Wilkinson had mentioned he could do a quick intro to Rhino since he had just presented on that topic, so that was great: the more people sharing, the better. Make sure to check out the notes and video.
Also, check out this great post by George.
Please keep your suggestions coming, and vote for the ones that are out there. We won’t have a Virtual Brown Bag this Thursday, since it’s Thanksgiving and most people are going to be taking the day off, but we’ll back next week! Happy “oversized bird celebrations” for all of you.
It’s usually not easy to find good examples that explain the Liskov Substitution Principle (LSP) to developers. But really, how hard could it be? The definition is so simple:
“What is wanted here is something like the following substitution property: If for each object o1 of type S there is an object o2 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when o1 is substituted for o2 then S is a subtype of T.”
Say what? I don’t know about you, but that kind of definition usually flies way over my head. Some people use the Rectangle versus Square example to explain the principle, which is a good one, but that doesn’t necessarily relate to things we normally do.
I like Uncle Bob’s definition a lot better:
“Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.”
Recently we’ve run across a violation to that principle in a project. We have an interface defined like so:
It’s a very small interface that represents resources that can be loaded in memory, and persisted afterwards in case there were changes to it.
Let’s pretend we have the following implementations of that interface:
The actual implementation of those methods doesn’t matter here; just assume that the real implementation loads and persists application and user settings.
Somewhere in the application we have some way to retrieve a list of instances of implementations of that interface, kind of like this:
Some place else, we have a method that takes in a list of those objects, and call Persist on them:
And somewhere else we may use those methods, like so:
Everything works great, until a new class is added to the system in order to handle, let’s say, some “special settings”:
It looks like the Load method does whatever stuff it’s supposed to do in order to handle loading these special settings. The Persist method, on the other hand, throws a NotImplementedException. As it turns out, those settings are meant to be read-only, therefore, the Persist method can’t really do anything.
The system is told to load the new class along with the other ones that implement that same interface:
Now when we run the app everything should still work fine, until we hit the code that tries to persist all of those loaded resources, at which point we get a big and fat “NotImplementedException”.
One (horrible) way to address this would be to change the SaveAll method:
If the specific resource being processed is of type SpecialSettings, we skip that one. Brilliant! Well, maybe not. Let’s look back at a simplified definition of the Liskov Substitution Principle:
“An object should be substitutable by its base class (or interface).”
Looking at the SaveAll method it should be clear that “SpecialSettings” is NOT substitutable by its “IPersistedResource” interface; if we call Persist on it, the app blows up, so we need change the method to take that one problem into consideration. One could say “well, let’s change the Persist method on that class so it won’t throw an exception anymore”. Hmm, having a method on a class that when called won’t do what its name implies is just bad… really, really bad.
Write this down: anytime you see code that takes in some sort of baseclass or interface and then performs a check such as “if (someObject is SomeType)”, there’s a very good chance that that’s an LSP violation. I’ve done that, and I know so have you, let’s be honest.
Another great definition for LSP comes from this motivational poster that the folks at Los Techies put together:
So what’s the fix?
The fix here is to tailor the interface based on what each client needs (Interface Segregation Principle, or ISP). The LoadAll method (which is one client of those classes) is really only concerned about the “Load” capability, whereas the “SaveAll” method (another client) is only concerned about the “Persist” capability. In other words, these is what those clients need:
The SaveAll takes in something tailored to its needs, IPersistResource’s, and the same goes for LoadAll, which only cares about ILoadResource’s (in the real app, the actual instantiation of these classes happen somewhere else). This is what the granular new interfaces look like:
Yup, it’s pretty much the former “IPersistedResource” split up into two separate interfaces, tailored to their client needs. Both the UserSettings and ApplicationSettings classes can implement these two interfaces, whereas the SpecialSettings class would only implement ILoadResource; this way, it isn’t forced to implement interface members it can’t handle.
Very often people ask what’s the most appropriate number of members in an interface. In the real world example I gave here, the original interface had only 2 members; one could say that was small enough, but as it turns out, it wasn’t. The IPersistedResource interface was doing too much (both loading *and* persisting stuff) based on the clients that use its implementers. In the end, two interfaces with a single method on them fit the bill a lot better. Interfaces with single responsibility? Yup, Single Responsibility Principle (SRP); as with design patterns, sometimes SOLID principles go hand in hand together.
Also check out A Good Example of Open-Closed Principle!
Another great Virtual Brown Bag last week.
Conferences, Speaking, etc.
Right at the start Alan brought up the fact that PDC 2010 was going on, with live streaming and all of that, but several of us decided to join the VBB instead. The idea of learning something useful, which you can start using immediately, over watching marketing conferences, seems to appeal to some of us.
That conversation reminded me as to one of the reasons why I decided to take a break from speaking: I have no interest in speaking at big conferences anymore. In the past, I’ve been asked to speak at some conferences where I was given the topic, content, the script, etc., and in both cases, I didn’t care about the things I was talking about. Several people have told me that they enjoy my talks because I’m very passionate. Well, it’s kind of hard to be passionate about something I don’t necessarily care about.
Also, several conferences are only interested in topics about whatever “the latest tools or technologies” are, regardless as to whether those things have been tried out in the real world or not. They favor those topics over things that people actually need on a daily basis.
I’ve submitted session proposals to some conferences and heard back things like “we don’t want talks on object-oriented programming, patterns, or that kind of stuff; we want talks on whatever thing that has just come out as a beta…“. Sometimes those things don’t see the light of the day, or are phased out after one or two releases.
The interesting thing is that my most popular talks are usually the ones that big conferences don’t care about. There’s a *huge* number of people out there who needs help with OOP, patterns, writing clean code, refactoring, etc. That’s why I’ll probably just focus on speaking at some selected user groups, CodeCamps, etc., where I know the organizers, they know me, and we both agree on what topics are of interest to the attendees, as opposed to this or that vendor.
Speaking of user groups, the Houston C# User Group is currently looking for speakers. I’ve presented there before, and it looks like I’ll be there again early on next year.
There were some other topics we covered at the meeting, but I’ll save details for another post. For instance, I shared something around Liskov Substitution Principle, Interface Segregation Principle, etc., but I plan on blogging about it in the next couple of days.
JB also share some stuff around Cucumber that looked cool. I’ll have to investigate more into that.