Archive

Posts Tagged ‘howto’

Learn this: Strategy pattern vs Decorator pattern

May 10th, 2009

As mentioned in a previous article, one thing I like to do when giving interviews is throwing out a curve ball. A standard type of questions I like to ask about are design patterns. Normally I will ask them to describe a specific pattern and seeing that both Strategy patterns and Decorator patterns are pretty common, I will ask about those. Most of the time, they can answer at least one of those. Whenever they answer both, I like to throw in the ‘Describe the difference between them and when you would use them.’

I ask this normally because it is kind of a gray area. Well maybe gray area isn’t the correct phrase, but they are strikingly similar*. They both encapsulate and delegate the behavior of the classes. They both encourage composition. Both are great alternatives to inheritance. And they both allow for new behaviors to be easily added to existing classes. With all the similarities, its hard to see where they differ, making it a great question to ask in an interview.
Read more…

Best Practices, Design Patterns, Learn This, Opinion, tutorial , , , ,

Twitter-Google Maps Mashup

April 26th, 2009

Love it or hate it, its hard to ignore Twitters recent explosion in popularity. Not only are they super popular to the masses, but they are nice enough to give us an API to use in order to create our own twitter applications. I don’t use it too much, but I figured it would be worth checking out at least from an API stand point.

Turns out, the API is actually just a series of webservice calls that just return a json or atom string, so it is extremely easy to use (and it explains the mass amount of twitter programs out there). I don’t feel it would be too beneficial to create a bunch of ‘This is how you search for people’, ‘This is how you do a post’, so I decided to turn this into a mashup between this and google maps.

What I decided to do an article on is how to take twitters geocoded search feature and place them on a map within google. This article will explain how to call Twitters search service, parse that and then using Googles Geocoder, plot where those users are twittering from.
Read more…

Flex, Google Maps API, tutorial , , ,

Fabrication: Intro to using Interceptors

April 12th, 2009

In one of my previous articles, I spoke about how to use Fabrication, or at least one portion of Fabrication (respondTo and reactTo). Given that there are other really cool things about Fabricaiton, I felt it deserved some more attention. One thing Fabrication supports are interceptors. Interceptors allow you to stop the normal flow of your notification to your commands or mediators. You can stop the notification, alter them, even send a different notification in its place. In this article, I will be focusing on a few different uses for interceptors.
Read more…

Flex, tutorial , , ,

Rebuilding vs Refactoring

March 29th, 2009

Recently at work, I was approached by my boss and was tasked with estimating how long it would take to fix a list of bugs. I accepted and said I would have the estimation come end of day. Then I found out which project this was for. It was *THE* project. Every company has this project. It’s the project that no one likes working on. The codebase is horrible, poorly designed and could be described as brittle at best. The problem isn’t just the code looks bad, it is just that to fix a bug in here causes a rippling effect through out program.

Instead of offering a time estimation, my manager got something pretty much every manager hates to get. She got a list of what needs to be rebuilt and how long it should take. Almost everywhere you read, they say rebuilding an application should never happen. I can agree with this to a point. When developers use that word “rebuild”, they often use it like a child who just found their father’s gun in the closet. It can be dangerous and not treating this with careful planning and consideration, you will be rebuilding yourself right into a corner.
Read more…

Best Practices, Opinion, Random Notes ,

Generating PDF’s within java using iText

March 23rd, 2009

With PDFs becoming more and more prevalent in todays world, if you are doing any sort of exporting or sales, generating PDFs is probably going to find its way into your program. Using iText, you are given a large amount of functionality in order to create custom PDFs on the fly. This article will be focusing on how to generate an PDF for a sales receipt. With this, I will show how easily you can setup tables, images, barcodes, and links.
Read more…

java, tutorial , , ,