Skip to content

0015: Le Roi Est Mort, Vive Le Roi!


Hello again πŸ™‚

As you can see, periods between posts grow constantly. That sucks, but whole life sucks too – choice between work/family and this project is rather obvious. In fact, I should place “leisure” word close to the “work” and “family”, but who can made me? πŸ™‚ Huh, to be honest I must admit – I’m quite a sluggard and if there is a chance that I could do nothing, I will try to fully exploit this.
After this short prelude I can go to the point.

First of all, I don’t know whether this has been announced (structure of the wordpress blogs kills me…) – I can’t find it, so I assume that wasn’t: RadosΕ‚aw doesn’t work with me anymore.

This project meant to be some kind of training for him. He’s young programmer and I told him once that he should learn more about other languages and techniques (he sits in PHP only). He agreed and we started OLGAtherer project. I spent many hours on planning, writing and other related things only to teach him something. Unfortunately, he’s a worse lazy-bones than me, and after one meeting he told me that he quits. He doesn’t have time, bla, bla, bla – you know how it’s. Of course he has no work, sits on his ass at home and do nothing. I don’t care now – I did what I could to help him, and it’s his business right now.

Considering above OLGAtherer should fall down. But I like this project (mostly because I like OLGA :)) and I don’t want to let it die. So another time I decided to exploit resources that we have in our company: I asked my friend, Andrzej to help and he agreed to help me πŸ™‚
I could write this program quick and dirty, as some kind of prototype – but second thing that I like in this project is possibility of learning. Andrzej, as I said previously, is skillfull software engineer and I can take from him lot of valuable knowledge. Today, as a some kind of entertainment, I describe two meetings that we had lately.

First one

I had a problem with program structure – I couldn’t decide how to place classes to get best result. Repositories, Managers and other stuff were placed in rather dirty way and I wanted to do something with it. Unfortunately I didn’t know what I really want. Should BookRepository be placed inside DbManager, or maybe inside Db? RepositoryManager should be placed over DbManager or maybe next to it? These questions were simplest that I had, there were many more complex. So I took Andrzej to the conference room and tried to explain my doubts to him. Then Darek who was passing by spotted us πŸ™‚ When he realized that he could interrupt our meeting, he eagerly did it πŸ™‚ He sat down on the chair and asked me why I use IRepository interface, why even Repository Pattern, because he uses MS ADO technology (adapters, data sets, etc.) and this is the best option, blah, blah, blah. Hour and half went like a second, and we had to close our meeting with no real results, but Darek, as a real MS Evangelist was proud because he uses best technology on the world, and I’m an ignorant who doesn’t πŸ™‚

Second one

Next meeting was much more fruitful. I managed to explain my problems and Andrzej started to think. You should see how he looks like when he thinks:) He stood in the middle of the room with finger close to his chin and do nothing in few minutes πŸ™‚ (and when I write “nothing”, I really mean it πŸ™‚ – it’s something like trance :)) After long while he started to write on the table. Method names, block structure, things like that – this almost creeped me out πŸ™‚ When he finished, I asked him why he decided to place all these things that way, and he explained all the way that he thought – this was a very important and valuable lesson – I can’t even explain this in my poor English, but believe me – I could work on this project for these meetings only. I will try to put here photo of the table after he finished (I took a shot with my phone) and you will see why I like it so much. (HA – I made it – photos are available and you can see them below).

OK, at the end I will try to explain what Andrzej told me. Based on his advice I wrote some code and I will put it onto SVN ASAP (DONE).

In general, there is one class – DB, that is some kind of facade between program and database.
DB is semi-transparent and uses Repositories to do tasks delegated by user. And, for example, it exposes method like

  public List<Book> GetAllBooks(string repoName)
            return new BookRepository(this.dbPath, repoName).GetAll();            

As you can see, all what it does is create bookRepository and invoke its method GetAll, which returns all books in the repository. All CRUD methods in the BookRepository are invoked that way. Why is this so good? Right now we have some kind of wall, interface that user can use. When we will want to use XML files instead of SQLite, we will only change classes responsible for communication with database. DB object and interface that it exposes won’t be changed and this won’t affect whole program! That is beautiful and I like this idea much.

I changed other small things too, for example I added resources that contain strings used in program. But these are really minor and I think that they will be changed later, so I don’t write about it much today. In fact, I’m quite tired with this whole english post and I think that I have to end this right now πŸ˜‰ I will write ASAP.

Best regards,

PS. I’m very glad that people come here and read my posts (at last). This is very nice and my motivation grows when I see stats. 10 or 12 visits per day may seem meaningless, but to me it’s quite nice result. Thank you all.


Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: