Posts

Showing posts from July, 2009

My Apprenticeship - Friday, July 30, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Friday 7-30-04 IntelliJ IDEA 4.5 just came out and there's a been a flurry of emails about how it lets you analyze your code. The Martins (Micah and Bob) are trading barbs about whose code is more redundant. Paul looked some 10 year old code he was working on and it had hundreds of repetitions. I've only just installed 4.5, so I haven't had time to try the new features. Dare I analyze my old projects? The pawn is killing me. My chess program takes the pretty obvious tact of having a ChessPiece interface from which all the pieces inherit. Bishops, Knights, Rooks, don't really need to know about the ChessBoard. You can just give them their move and they'll tell you if it's legal. The ChessBoard will do a check to see if any pieces are in the way of a move. But the Pawn -- What a jerk! Pawn

My Apprenticeship - Thursday, July 29, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Thursday 7-29-04 So I was doing one last re-install of Word Press, just to make sure I understood everything that could go wrong -- But apparently there was one more thing. I just couldn't sign in from my laptop when I pointed it's browser at the Linux box. I know I had the right login and password because it worked on the other machine. After spending too much time messing around in the Linux terminal, I went back to my laptop, deleted the cookies associated with that website, and everything was fine. Cookies are a problem. The chess program is proving to be an interesting problem. Everything wants to know about everything else. Must... Manage... Dependencies... "Everything wants to know about everything else" I fight this battle every day. And I continue to fight cookies and other browse

My Apprenticeship - Wednesday, July 28, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Wednesday 7-28-04 Not a whole lot going on today. I messed around with Word Press. Paul continues to remove the html from FitNesse. Which is more like storing the html inside methods so that the chance of a typo is reduced -- if you have to constantly add in a bunch of cryptic strings then you probably will mistype somewhere which can cause hard to find problems. However, if you make a method that adds in a html tag, then either every instance of that tag works or fails. The IDE will tell you if you've entered the method correctly, thereby reducing the chance of a typo causing a troublesome error. Susan and Ellen are pretty swamped under the pressure of getting XPAU up and running. David's having a good time with his class, but they're working him like a red headed stepchild. I got to meet Micah'

My Apprenticeship - Tuesday, July 27, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Tuesday 7-27-04 Today I worked on cleaning up Word Press so that it looked nicer and behaved better. Alex King was nice enough to hold a contest for the best Word Press skins and publish the results here: www.alexking.org/index.php?content=software/wordpress/styles.php For now, 'But Uncle Bob,' is using the 'Dark Fire' skin. I also spent a fair amount of the day figuring out the various features of the program so that I can teach Micah when he comes back. Once you get it working (and, if the server has already been set up for you, that is not too hard) WP is a nifty little program. Tomorrow I think I'm going to wipe the Linux box, reinstall the OS, and put WP back up because the first install was so crazy that I'm not completely sure I can repeat it without wasting a whole bunch of Micah

My Apprenticeship - Monday, July 26, 2004

Image
This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Monday 7-26-04 Word Press is up and running! I had a bunch of ideas when I arrived, but before I got too far I said to my self: 'Self, maybe you outta try starting Apache, MySQL, and run install.php from Mozilla just one more time' Well, I wouldn't be telling ya about it if it hadn't worked. Of course when I say it worked, I mean that the install actually started but not that everything was fine from the get go. First I gave it the path that the wordpress folder was in, but not where the files were. So everything failed, but did so is a way that I could see that every place it was looking was missing a '/wordpress' so I fixed that. Then I tried to look at it on another computer but I was getting a screwed up version of the site. What wordpress really wants when it asks for the location

Point Inside a Polygon in Ruby

Recently my team needed to find out if a point was inside a given polygon and, as usual, we found some code on the internet that did what we wanted. And, as usual, there wasn't much explanation as to what it was doing. Here's the code (after we converted it to Ruby): 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 def contains_point? (point) c = false i = -1 j = self .size - 1 while (i += 1 ) < self .size if (( self [i].y <= point.y && point.y < self [j].y) || ( self [j].y <= point.y && point.y < self [i].y)) if (point.x < ( self [j].x - self [i].x) * (point.y - self [i].y) / ( self [j].y - self [i].y) + self [i].x) c = !c end end j = i end return c end end So, you know, it works and I'm grateful to somebody for posting it but we had no idea how it works. So we wrapped 2 tests around it (one where the point is not in the polygon and another where it is

My Apprenticeship - Thursday, July 22, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Thursday 7-22-04 Finished up the patterns class today and I have to say that David did a pretty good job. With new material, not much teaching experience, and Paul and I firing questions at him he was able to get through the class rather easily. Sure there were some confusing slides and weird-ball patterns, but the cool thing about OM giving him this week to flesh out the course is that he can make note of the problems and then talk to Micah or Bob to straighten things out. Next week he does it for real with paying customers and I think he'll do fine. I, however, need to write more code. This Word Press/Linux/MySQL/Apache/PHP adventure I've been on has been very informative but sorely lacking in full-on coding. I need to remember to ask Micah (or Bob, or David, or Paul) for some advice on a side project

My Apprenticeship - Wednesday, July 21, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Wednesday 7-21-04 Our payroll UML diagram (from yesterday) had some needless complexity but, other than that, it was fine. Well, mostly fine. Lots more patterns today. Many of the patterns boil down to the server-client relationship. Let's say you have a laser scanner object that can scan a bar code and identify a product. There's also going to be a sale object which gets a message from the scanner and then does some sort of sale stuff. Well now the scanner has to have code that knows about the sale and the sale might even have code that depends on the scanner. This system is now tightly coupled. But if you stick and interface between them, you can have them both know about the interface and not each other. Therefore swapping out the scanner for another one doesn't affect the sale code. And changes

My Apprenticeship - Tuesday, July 20, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Tuesday 7-20-04 Second day of A.O.O.D. and I'm getting pretty good with UML. Today we discussed the various principles of software development: Single responsibility , Open/closed , Liskov , Interface segregation , and Dependency inversion (Which, all together, spells S.O.L.I.D. - you can learn things from XPAU mouse pads). Paul an I spent an hour or so trying to design an system that could take in information about a bunch of different types of employees. Then, after we designed a system with enough interfaces and uses of inheritance to avoid violation of the principles, more user stories were added and we had to refactor. It was an initially frustrating, but ultimately fun project to take a system and make it do something new without, hopefully, coupling the classes together too much. I think we got

My Apprenticeship - Monday, July 19, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Monday 7-19-04 Today was the first day of my Advanced Object Oriented Design (AOOD) class. David's teaching Paul and I in order to make sure he's familiar with the material and can teach paying customers next week. After covering the usual X.P. verses Waterfall stuff and briefly touching on how good OO design can keep your code loosely coupled (in a tightly coupled design each class depends on several other classes, which in-turn depend on a few other classes and so on. The bad news is that changing one class means that you have to change every other class that depends on it. And since everybody is holding hands with everybody else, that could mean hundreds of changes for each modification. No me gusta. Loosely coupled code has objects that, through interfaces and clever structure, can be changed withou

My Apprenticeship - Friday, July 16, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Friday 7-16-04 Today I rode my bike into the city in search of a passport. City Hall: Big, confusing, lots of stairways leading to locked doors. First goal: Get a birth certificate. Long line, filled out misleading paperwork wrong, but accomplished. Second goal: Get passport. Not so fast, Mr. man, this office is closed inexplicably for an hour starting... Now. Kill time, eat pizza, come on back. I was waiting at the wrong place! Even thought the sign above the door clearly said 'U.S. Passports.' But the real passport place is upstairs in the same room where you apply for city jobs. Silly of me. For all those of you who like to complain about yer passport photo, I'd like to point out that you probably didn't wear a bike helmet in rain and let your hair dry in a pizza parlor before you got your ph

My Apprenticeship - Thursday, July 15, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Thursday 7-15-04 So I downloaded and installed Apache -- which wasn't too much trouble. But MySQL was a different story. When typing in the bizarre list of commands to install it, I made a slight typo which took a little while to track down. But, even worse, I ran into the same problem as before -- MySQL would run but Word Press couldn't find it. After a lot of messing about I finally figured out that Linux had installed MySQL automatically and that was causing conflicts. Which I couldn't figure out how to resolve. Before I installed PHP I decided to look and see if it was on the hard drive. I found the documentation, and when I typed in PHP at the command line something happened. But I couldn't find where the files where installed. If this were windows I would have some idea how to go about loo

My Apprenticeship - Wednesday, July 14, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Wednesday 7-14-04 The problem with a 'five minute install' is that if you go beyond 5 minutes, you are screwed. A five minute install is doing a lot of things behind the scenes. If those hidden processes fail, then you don't have anything to look at. The configuration file for Word Press is very simple: You tell it the database's name, the user's name, the user's password, and where to look for the server. Once you've verified that the database does exist (by messing around in MySQL), the user has access, and the password is correct then only the server is left. Which is quickly crossed out by accessing the database through the server (which is running on the localhost). Now what? There's really nothing else to change. After banging my head against this all day (Well not actually

metric_fu graphing, 1.9, and 'awesome' templates

Image
So there have been a bunch of metric_fu releases since I announced 1.0.0 on this here blog. It's now up to version 1.1.4 and we've added: Flog, Flay, Reek, Roodi, and Rcov now have graphs over time (thanks Édouard Brière ). Cool, dare we say 'Awesome,' templates for the metrics (thanks Nick Quaranto and Edouard Brière). Flog report now tracks average Flog score per method and the average of the worst 5% of your methods. MetricFu now works with Ruby 1.9.1 (thanks to Robert E. Rouse for his help). On to the pics: Homepage Google Group Github Repo Enjoy!

My Apprenticeship - Tuesday, July 13, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Tuesday 7-13-04 What was supposed to take a half hour yesterday actually did take 30 minutes today (after we got yesterday sorted out). Email problems turned out to be mostly a matter of restarting Outlook a few times. With the SMCCSharp compiler taken care of, I could go back to my other project: getting Word Press, MySQL, and PHP running on the Linux box. Although Micah and I had downloaded, installed, and successfully used Mozilla (a web browser -- like Internet Explorer) I couldn't find it today. Paul came over and he couldn't find it. And he's been using Linux for years! It was somewhere on the hard drive, but after wasting about an hour looking for it I decided to stop throwing good time after bad and just re-install Linux (for a third time) and this time make sure I installed almost everythin

My Apprenticeship - Monday, July 12, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Monday 7-12-04 Today was a day of unintentional diversions. Paul and I came up with an idea of how to test an area of our state map compiler that had been eluding us. We would build up an input file, in the tests, and then send that input file into the SMC which would create an output file that we could read and check to make sure it works. If we had been designing this SMC thing from scratch using TDD, we could have made it easier to test, but since large parts of the program are a legacy, we had to resort to the building/writing/reading file method. But the parser in the SMC program doesn't like to be called twice, so a fair amount of the day was spent figuring out how to get around that for multiple tests. The other part of the day was spent writing a bunch of tests that had to be thrown out because ther

My Apprenticeship - Friday, July 9, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Friday 7-9-04 Revision: the State Map Compiler C Sharp version isn't done. It doesn't actually work, as Micah showed us. I feel pretty bad about it because we should have tried the things he tried before showing it to him. The SMCC# produces code that's meant to be part of a larger program. We really should have written the larger program to make sure it works. Bad apprentices. Bad! On the positive side, I'm becoming a lot more familiar with how this SMC thing functions as we plow through it again (and again, and again). After looking at some UML with Micah we decided to re-design how the C# version of the SMC is written to avoid using inner classes. Which is good because they were confusing me. David and Paul have suggested that they start writing an 'Anti-Jake' blog. Treachery! We shal

My Apprenticeship - Thursday, July 8, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Thursday 7-8-04 Today Paul and I set up the conference room for next week's class by making sure IntelliJ, FitNesse, and M.S. Visual Studio were installed and current on the mini computers. It's gonna be a full house for the TDD (test driven design) class -- six computers with 2 people at each. Then Micah gave us a choice: one of us could try to track down a mysterious file on a computer about to be re-formatted and the other was to figure out Word Press and install it. I chose Word Press -- it's a program that can be installed on a server so that blogging (weB LOGging) is quick and easy. We are setting up a blog so we can start the site www.butunclebob.com where individuals can object to Uncle Bob's (Bob Martin, founder of Object Mentor is often referred to as 'Uncle Bob.' I don't k

My Apprenticeship - Wednesday, July 7, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Wednesday 7-7-04 Most of today was the State Map Compiler. We got it to work, but almost all the work was being done in a 600+ line class. Armed with a bunch of passing tests, we proceeded to brake just about all of them in the refactoring process. But, and this is important, we only broke one test at a time. The goal was to offload a whole mess of functionality into a bunch of other classes. By the time we got back to a refactored green, we had about 100 lines in the controlling method and much more readable code. Whoo! Then it was time to do a real conversion of the OMwiki to FitNesse. Previously Paul and I had used a copy of the OMwiki files for practicing purposes. Today we shut down the OMwiki and ran our program on the wiki pages. Due to an unfortunate use of a backslash in a program designed to deal with

My Apprenticeship - Tuesday, July 6, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Tuesday 7-6-04 Fun things you learn when Micah returns: Your tests? -- don't really test what they should. The regex expression you labored over? -- can be done a lot better. All the time it takes to run your program? -- is because your program is doing 20 more operations per file than it needs to. All that polymorphism stuff you vaguely grasp? -- you don't know at all. All part of the learning process. Other than that it was a pretty good day. I got back from Vegas last night and was pretty tired (Cirque de Soile's 'O' and 'Mystere' are amazing. Stop reading this blog and go see them now). Before Micah knocked some sense into our heads, Paul and I spent most of the day working on the State Map Compiler. Writing tests for this thing sucks. The output is basically one long string (whi

My Apprenticeship - Friday, July 2, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Friday 7-2-04 We did use my code in the wiki conversion program. And while it was good to finish up that project, this meant we had to start working on the State Map Compiler. A program first written in 1993 in C++, then later re-written in Java in '98. No tests, very long methods, and the documentation gives lots of examples in C++ (which I don't know much about -- it seems like Java, but it most definitely is not.) The point of the program is to take in a simple statement of a 'state machine' and output source code that implements the state machine in either Java or C++. We are going to be adding a C# output option to this program. Now, at this point, you might be wondering: 'What is a state machine?' Well, let me attempt to regurgitate the turnstile example. A turnstile has two states

My Apprenticeship - Thursday, July 1, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day. Thursday 7-1-04 There's just one problem with our conversion program: the Double Dash (cue the dramatic music). In FitNesse, two dashes in a row (--) mean strikethrough. But in the old OMwiki, two dashes had no meaning. A fair amount of people use two dashes to separate their thoughts ' as you might expect. So our pages were getting translated with lots of text 'struck out.' Okay, so all we had to do was write a program that looks through all the wiki pages and replaces two dashes with one. Which, it turns out, is not as easy as we thought. The proper way to do this is with regular expressions (mentioned in the previous post), but neither Paul nor I understand them too well. So we looked around for the regex (regular expression) book at OM, but somebody had probably taken it home for some light