javaranch/jforum – nailing down a production problem

JavaRanch successfully cutover to our new forum software yesterday.  Unsurprisingly, we had a variety of small problems that cropped up.  One of them was the fact that anonymous users were able to post.

Below follows the thought process and steps involved in fixing it.  And then in fixing the problems caused by the fix!

  • A moderator noticed anonymous users can post – that’s not good
  • I looked at “general” group and saw deny anonymous posts was selected for all forums.  This looks right.  Hmm.  What’s the fastest thing I can change to prevent anonymous users from posting?
  • I know!  I’ll create a new group, put anonymous in it and give that group read only access.
  • Seems to work.
  • I logged a bug that when not logged in we see “new topics” in one stray place.  (At the time this doesn’t seem related.)
  • Things seem stable.  Time to get off the computer and enjoy Saturday night.
  • Another moderator asked why that was a bug since he gets redirected to login at that point. (This moderator is in Europe and had a good chunk of Sunday before I woke up.  It’s nice how things get done around the world.)
  • Chat session with this moderator – we realized he saw one behavior on our sandbox and I saw the error in production.  We discussed the behavior on test is correct/desired.  I need to figure out why it doesn’t work that way in production.  End chat session.
  • I wonder if the database is out of synch due to our data migration yesterday.
  • I edit ed the new group to force a database update.  If the database wasn’t out of synch, this doesn’t hurt anything.
  • I opened a new browser and tried accessing when logged out.  I get the expected behavior now.  I see the button and am prompted to login when I click it.
  • Now to tie up loose ends – I made the same “change” (edit without changing anything) to the “general” group, moved anonymous back there and got rid of the group created yesterday.
  • Marking it off on the bug list and all done.

what is mentoring?

What is mentoring?  Listening?  Advising?  Helping?  I was looking for the definition of mentoring today and came across some interesting things.

dictionary.com lists two definitions:

1, a wise and trusted counselor or teacher.

2. an influential senior sponsor or supporter

These are both correct, but not very helpful to me.  Sometime later I came across an article that really expresses what I was looking for.

Mentoring is about one person helping another to achieve something. More specifically, something that is important to them. It is about giving help and support in a non-threatening way, in a manner that the recipient will appreciate and value and that will empower them to move forward with confidence towards what they want to achieve. Mentoring is also concerned with creating an informal environment in which one person can feel encouraged to discuss their needs and circumstances openly and in confidence with another person who is in a position to be of positive help to them

Parts of this initial paragraph really jump out at me.  I’ve listed the relevant keywords and phrases here with my thoughts on them from both being a formal/informal mentor/mentee:

  • helping – Why am I not surprised the first verb in the description is so critical?  Mentoring really does boil down to helping someone else.  The mentee is still responsible for themselves and everything pertaining to the situation.  Whereas the mentor gives advice/opinions/guidance to help the person.
  • achieve something – The goal might or might not be known to the mentee.  Sometimes there is a specific issue that one wants to discuss.   In that case there is a pretty clear goal.  Sometimes it’s just to hear advice on what is coming.  This is kind of vague.  For example, technical people are known for needing to improve their soft skills.  Yet we don’t tend to seek out advice on the topic.  A good mentor will bring it up anyway helping the person at least realize there is an opportunity out there.
  • non-threatening way – This should go without saying.  The idea of mentoring is to be guidance not “do this or else.”
  • appreciate and value – I found this phrase particularly interesting.  Usually I appreciate and value my mentor’s advice right away.  However sometime it takes time to sink in.  I received some advice related to answering questions about a year out of college.  About two years later, I told the person giving the advice that it finally clicked and now I understand what he was talking about!  At the time I did appreciate that the advice was given, but I wasn’t at the point yet where it could be useful.
  • empower and move forward with confidence – The mentee really is responsible for themselves and the mentor is just trying to help that person succeed.
  • discuss needs and circumstances openly and in confidence – One needs to know what’s going on to provide useful help and advice.  Yet often when we need advice, it’s because something problematic is going on or our innermost desires conflict with others.  Not the easiest thing to talk about in general.  Especially for technical people like us who are more comfortable with computers and logic.  Being assured of confidence allows one to “just talk” as if one is talking to a friend.  Sometimes that means your mentor (or one of your mentors) should be someone you know well or someone you don’t work with directly.
  • informal environment – Some environments are more informal than others.  Part of managing someone involves mentoring and providing career guidance.  This type of mentoring is extremely valuable because a manager knows more about a person’s job than anyone else.  It’s also valuable to have someone to talk to who is NOT your direct manager.  For one thing, it’s uncomfortable discussing things directly relating to your manager with your manager.  For another, no matter how much you trust your manager, there’s still a nagging feeling that the person is your manager which affects openness.  It’s hard to present an idea you haven’t thought through directly to your manager.  It’s also useful discussing things with someone else to gather more points of view.  This “other person” to talk to doesn’t need to be formally named a mentor.
  • in a position to be of positive help – There are multiple levels of help.  Sometimes a person just needs someone talk to.  Expressing ideas to someone else helps clear ones head and make connections between ideas.  This is the really basic level of help.  At higher levels of help, it advances it to making suggestions and asking questions to help the person think about solutions and next steps.

Formal mentoring tends to be easier to visualize.  As an example of informal mentoring, I talked to a collegue at JavaRanch (where I volunteer, not my “real” job) about something this weekend.  This is someone who I really respect – especially when it comes to process and team dynamics.  And with mentoring!  He asked me a bunch of questions to understand both the scenario and what I was thinking/what I wanted.  He also asked some higher level questions.  This was the most valueable thing for me.  If I had talked to someone I work with, this question would have been unlikely to come up because everyone would be thinking within the job and taking certain things for granted.  Now this is the only time I asked this particular person for advice (that I can recall.)  But I’ve absorbed so much from him over the years.  I think this shows that there is informal mentoring (“can I talk to you about this one thing” vs just learning from watching/listening to someone who doesn’t even realize they are mentoring.)

why do we violate law of demeter?

I was watching a Google Tech Talk on Dependency Injection.  Sixteen minutes in the speaker gave an interesting example of the Law of Demeter: If buying item for $25 in store, do you hand clerk $25 or give clerk your wallet and have him/her retrieve the $25.

This got me thinking about why we so frequently violate the Law of Demeter.  I can think of three reasons that come up frequently.

Familiarity with code/process

When we think about what needs to be done, we think “I’ll get out my wallet and get the money.”  This does translate literally to handing the clerk the $25. Since the wallet is an inanimate object, we think more about the wallet than the cash.

Wallet wallet = customer.getWallet();
Cash cash = wallet.getMoney(25);
customer.payCashier(cash);

If it were a person, we would think of the separate step.  If a six year old was buying something, he might think of the transaction as “ask mommy or daddy for $25 and then hand that to the clerk $25.”  This translates better to:

Cash cash = parent.getMoney(25);
customer.payCashier(cash);

In the real life scenario of an intermediary person, the requestor (child) never even rifles through the wallet.  (Granted in the real life scenario, the child doesn’t really ask the wallet – rather the person holding the wallet.)

Access data we shouldn’t

This is really a variant of being overly familiar with all the objects/data.  We tend to think about what we are doing rather than from the object’s point of view.

Can’t touch other code

To me this is the most interesting reason.  We have an object that we think really should have a new method but can’t touch that object.  One solution to this is to create a new object that holds the original and does contain the new method.  This solution is useful when the object belongs to a third party and really can’t be changed.  Sometimes it’s more of a mental block.

I recently came across a case where two numbers where compared via a string comparison (and some other logic) because the author didn’t want to touch the object that owned the data (and was exposing it via a string.)  After further discussion we concluded the owning object really needed a method that told us if this number was positive or negative.  And the complex logic was a “code smell” pointing us to that fact.

Personally, I find the reasons behind things to be more interesting than the actual instance.  It’s easy to say “don’t violate the Law of Demeter.”  Discussing why is plenty interesting (as in the Google Tech Talk.)  It’s thinking about what drives us to such things that helps actually prevent them.