Skip to main content

What code makes you happy?

I can't say what code makes you happy but I can tell what code makes me happy.

My greatest satisfaction is from :

  • Getting things done (documents, features, working with people, etc).
  • Understanding / learning how a specific framework, library or tool ready works.
  • Visualizing how and why a design works or does not work.

A while back I had a couple of very pleasurable moments working with some code.  One moment was working with the Java Swing GUI Library and the other was in a design pattern that was a variation of MVC (Model View Controller), or so I thought.

I was working with the Java Swing library trying to get a panel contained in a JScrollPane to set the scroll bar at the top of the viewport.  For a normal panel this is a piece of cake but not when the panels components are dynamically added to the panel after it's made visible.  What made me happy about this task was that it forced me to think of not what I wanted to do but what was really happening inside the library.  My first try at a solution was the standard brute force method (which did not work), then scanning the forums for solutions (which did not cover my issue or work) and then looking at the problem from a very different angle.  I needed to logically think of what must be occurring in the Swing library during the dynamic addition of components and look for injections points where a solution could be applied.  This lead to a very simple, clean and easy solution to my problem.  It's the re-training of the thoughts to come after a problem in completely different direction that makes me happy.  It's the Aha moment that makes me happy.

My second happy moment is from looking at a design pattern that I have seen used long ago involving an SOA service request where the results used a Publish / Subscribe pattern to update the (MVC) Views that utilized the returned data.  I had seen this pattern decades ago when Window's development was just getting started.  Developers where using the WinAPI for not only the built-in messages but also created their own messages by defining new MessageIDs (aka "WM_USER + n") and passing their own data around inside the application.  You do not see this patten anymore as the number of messages and transient data gets very complex as structure and API are replaced with messages that magically go somewhere.  I could not quite put my finger on the other reason for why this pattern felt wrong, and then it hit me.  It was combing the behavior of both the Model updates with the View notification.  These are two separate concerns that are being combined into a single operation.   This variation of the MVC pattern was not MVC at all, it was just the old WinAPI message pattern but with very little structure behind it.  It was being called MVC was it was not.  It's this process of removing hype and comments from others and learning for myself what is really occurring that I enjoy.  Again it's the pealing away of miss-information, hearsay and preconceived notions to find the facts buried beneath that make me happy.

By diving deeper into what is really occurring in the code or design I get to understand what I need to do.  For me this generally results is writing less code that I hope is clear and easy to maintain.  This is what makes me happy.

Next: Truth -vs- Facts.

Comments

Popular posts from this blog

My Current Desktop and Happy Vining.

It's been a big switch when I quit my old procession (Software Engineer) and ventured into the unknown.  So this is my current desktop.   First it's a REAL desktop and not a computer screen. Second, I've had to learn a whole new set of tools.  You would think a pencil is just a pencil and a paint brush is just a paint brush, but noooooo, they are tools into you mind and that's what needs re-tooling. The tactual nature of these tools and operation as much more rewarding (and frustrating too) than typing code in an IDE.   That had it's incentive but that well went dry and life changes,  so I changed. The pleasure of creating colors (no RGB involved) ad hoc wise is interesting.  Getting the technique to merge them on paper is very tough.  You do not know what you're going to get, so you just have to go with it. I'm glad that I can do a lot of other things instead of Software, but I hope that others in my past procession work on other pa...

3rd Try is a Charm

I've been trying to draw / paint these barns for a couple of years but never felt or got them right.  This time I think they turned out right. So What went wrong before and what's right now with this drawing?  This time, the light was right.  It's coming from the upper right and the shadows just looked right.  The other thing is the corn field on the left had to "be in season", otherwise it's just a plowed field.  I had taken other photos from different angles but they never felt right.  This angle has the road, power lines, corn field, etc. all leading to the right.  The shadows on the lower right helps fill in that corner (don't forget about the corners!).  The last part is trying to draw (ink paint maybe) the trees in the background.  Not so easy when they are kind of a blob is green shades. So yeah, it's composition that is king.  Many times I just don't see it until the drawing / painting is finished and when it's right it feels goo...

A Trip Abroad

 Just back from our trip abroad as Asheville continues to recover from the hurricane.  This trip has been planned for a long time and we almost didn't make it because our dog sitting business will be closed for a while. But make it we did and now we are back. We love Amsterdam.  What a fun place to visit.  So many things to too and do there.  The weather was not the best but it did not have an impact on our visit.  Just bundle up. Got some quick painting in while on the boat (i.e., Viking) as we moved from port to port.  This painting is of a garden at a heritage site of windmills.  I thought it looked nice. Nice time on the trip to de-stress from what was happing back home.  We were fine back home but not everything is well with many others.