from my work as a developer
Posts tagged design patterns
copy pattern
Jun 8th
Recently I’ve joined a new ongoing project. In theory it should have been easily jump into it, but as usual each project is specific. The team developed a custom framework to generate JSF view base on an entity class. The framework after first look is quite simple, but as always the devils is in the details
So, I’ve spent a bit of time to catch up what is real going on. The next thing I had to implement was an option to export entire view to PDF – there was already an example how to do it and I followed it. Just copied the source and started adjusting it to my needs.
That’s the Copy Pattern. It’s used very often when you join a new project, when you learn a new language, when you do something first time. You need a pattern to base on, to follow.
So, it isn’t a bad idea to use the copy pattern, but you cannot stop on that. After first step, after you grasped the problem you must apply another patterns – real software development patterns. Leaving the code as is after using the copy pattern is bad – we’ve seen it a lot in many places. The copy pattern is just a beginning, is the easiest way to get into the project.
And the beauty of this is that you can change the name of the class, extract methods, extract new classes – just before messing with a code repository, before posting too match changes,that no one will know what is really happening;-)
Don’t be afraid to use the copy pattern, but also don’t stop on it!
And as usual at the end a talk from TED, this time about a car for blind people. And about new control interfaces we can face soon
Enjoy!
bugs, gwt and appengine, ocr
Feb 3rd
At last I got a new task – I mean new bugs to solve
Yea all were related to a print layout. Many simple text changes, it took me around half a day to solve them all. I still have some bugs to solve but first I need to investigate how they will impact application – the changes I made to layout till now were safe, they will not brake application. So it’s a bit boring but better than nothing
Another thing, I started learning Google Web Toolkit – as a member of Warszawa Java User Group I have access to group’s bookshelf and free books from many publishers – you know “book for review”. Anyway I had a copy on my PC and started reading it.
In the same time when I’m reading GWT in Action I started working on Maven2 archetype to work with Google AppEngine. You can find some over the Internet but they are not really suitable to what I want. After two day I had stable environment to work with GWT and AppEngine. I’m using my good old IntelliJ IDEA instead existing plugin for Eclipse
The last thing, I’ve presented my idea about Open Code Review on Design Patterns Study Group’s meeting, I explained what it’s about, how to steer the whole activity and how to solve problem with “gurus”
I hope they will be able to introduce it in their teams! I’m waiting for feedback!
dark ages
Oct 6th
The whole last week was as black whole – without passion, hopeless and so one
Maybe because of weather or something – Autumn is coming
Nevertheless that’s over, today day was absolutely brilliant – I got my books from Amazon:
- The Power of Less: The Fine Art of Limiting Yourself to the Essential
- Pragmatic Thinking and Learning: Refactor Your Wetware (Pragmatic Programmers)
- Getting Things Done: How to Achieve Stress-free Productivity
As you can see, quite interesting readings – so the Autumn can be very productive period, especially when the weather will be bad
I also solved many bugs today and it was even nice – it wasn’t either boring nor frustrating – I was fascinated that I could help someone to achieve his goals. Passion!
The second main achievement today was meeting of Warsaw Design Patterns Group – we started implementing mentioned early application. It base on Maven 2, Wicket and on some common stuff like Hibernate and Spring. There was enormous pill of knowledge – we used TDD first methodology, with mocks base on Mockito. I never used Mockito before and I’m delighted what you can do with it! We developed almost the whole functionality within one hour! Well designated and suited! I’m looking forward what we do on the next meeting!
Preparation for Warsjawa are also going well – the agenda is almost done, the conference room is booked and the pizza is coming! We will be discussing about Scrum and Agile – from one person to distributed teams! If you are in Warsaw at 24. of October, come visit the conference!
duplications
Sep 23rd
The whole day I’ve been solving bugs – it was so boring
Tons of small “cosmetics” changes to print layout – “add line here”, “remove line there”, and so on, nothing exciting. And the most annoying thing was bug duplication. The First was bug with the High priority with description to change some logic to show or not given part of layout. And when started solving bugs with the Low priority I discovered the second, almost the same bug – the description was a bit different. That would have be ok, if it was registered by another tester. But no, it was the same tester as for the first bug – what a mess
I also continued work with requirements for application that will be used as example during DP groups meetings and it’s almost done. Additional ideas will be added when they come up.
restart
Sep 22nd
The day was so bored, I’ve been fixing bugs regarding the new print template I had made last week. Many small and stupid mistakes, few of them were significant but most have never wouldn’t happen when I got more focus at first time when I did the template. Nonetheless I closed around 30 bugs, that improved my statistics
After work we had first meeting of Warszawa Design Patterns Study Group for this season. It was purely organizational meeting, we’ve been discussing about what we want to do for up coming weeks. What kind of expectation we have and how to achieve them. We decided to learn TDD on some real example, next we will add DDD, maybe some Scrum and XP methodology. We will see! As a example we decide to develop software to manage conferences. As a organizer of Javarsovia 2009 conference I had experienced lots of problem that I can address in the requirements. Hopefully we will be able to build either something useful or at least some basis for a real project.
I must prepare a backlog and next time we will be able to start coding
The quite interested technique was suggested during meeting. The meeting should start as a Code Kata session when we will get some functionality and learn coding techniques. The second part will be like a Randori Session when we will be able to refactor the code and learn (maybe) some Design Patterns with live examples!
I’m looking forward for the next meeting!
new stuff
Sep 21st
Today I’ve got a new PC box. The most surprising thing was the Graphic Card – it’s capable to support up to four monitors. So I already connected additional one, to have ad least two
It’s nice to have such a thing!
The next was installation, I spent the whole day on that. Copping back data and installing needed software took me rest of the day. Even in unified environment you have to waste lots of time setting up your workspace and common tools
Hopefully, the next upgrade wouldn’t happened for next three years! Tomorrow I can be more productive and we are opening the new season of Warsaw Design Patterns Study Group, come in and help us build a new agenda for whole year!
half a way
Sep 15th
I started, mentioned early code clean-up and refactoring. It was huge task but quite simply – I just had to keep focus on what I was doing. I implemented all the changes and confirmed that everything was ok with Unite tests. No problem so far!
Then I decided to committed the code to have clean starting point for next step. In first step I just introduced one common interface which base on Template Method pattern and reimplemented all needed concrete classes. After all I had one common interface to use in many places, it simplified many operations and I was able to cut off bunch of unneeded methods.
That was the half of way. The second part was to used custom Enums instead of String constants. I implemented the Enums and started replacing Strings. It was very bored and could introduce accidental bug. Hopefully it didn’t – lots of manual typing without mistake!
I reran the tests to confirm that I didn’t break anything. Done and committed! That was all for today, tomorrow I will still try to simplify the interface. To have less code needed to cover by tests
