Archive for October 2011

Developing in a developing country   Leave a comment

IMG_0212This October was a month I have seen a lot of amazing things.As I said last time, two of the great minds in computer passed. I heard a third one, the person who started artificial Intelligence passed. He also invented LISP programming language, RIP. I also had a lot of busy moments that I had to work late in the night to cover assignments or just wait my ‘Cyber boss’. I had the chance to work in one of the known IT companies as a remote staff, for many reasons I will call it X. According to my contract I can work anytime of the day and complete my task. Today I am going to share it with you what it looks like developing a software in a developing country, just my experience.

The company X that I work for told me that I will be working on project Y and I was trying to cover up and see all the materials I get to understand the things in it. When the time comes and I start the work, I am informed that I will not be working on Y but another project Z. Z is managed by another person in another country with a time difference of almost half a day. The first day at work…. we had a meeting and the person was presenting how he is going to divide the job among us. One thing I have to tell you at this point is, the project was already began and there are two other guys who have seen it grow. I am the new guy. Unfortunately, the first day, the internet was not good enough for me to attend the online meeting and see the presentation. I tried to listen the audio and come up with my own way of managing things. The presenter and the project manager told me I am going to be briefed the next day at the same time for two hours. I bought an EVDO to get a connection during the night time to talk to the guy.

The next day I set up things and I was ready, but the guy didn’t show up. The third day, I was given an assignment to complete a task. I had to see my way out of the mess and did what I am supposed to do, and honestly a little more. The next day, I was expecting the guy to tell me what is right and what is wrong and give me my next assignment. Unfortunately he didn’t show up. One more day, he is not online. On the third day he came online and told me that he is in a hurry and he told me he’ll do the presentation on the following day. He also told me that one of his family members had a car accident so he’ll be in a hospital for days. The other day he came and told me to read something, I covered that up and done a little sample application to my confidence. Things went like this for a week and half, and the month is almost done.The next day he came, he told me that the other guys are working on it and I am going to be working on something else. I am feeling like I am not doing what I am supposed to do, or I was expecting to do. I guess you have an idea of what it looks like the situation. I’ll expect your ideas. I know one thing for sure, I got something even out of this.

Posted October 26, 2011 by Behailu S. in Uncategorized

The No-SQL thing I met   Leave a comment

seteveDennisI didn’t post on my blog in this month, I just got the time. This month is the one we lost two of the special* people in the tech industry. I know the term special is not enough to talk about them; Steve Jobs and Dennis Ritche. I am not going to talk about them. As SJ said, death is something universal and we are the ones to follow them. I just want to say Rest in peace. The last weeks, I had the chance to work on two things that made me feel good. The first one is the class I am taking online, Database class, at Stanford University. I like it. I just finished watching the first unit of the course. The final part is about Relational database design techniques. It has been almost six years since read my first book on database design; all the normalization and others. Since then, I was working all in a relation database. Microsoft SQL server, Oracle, MySQL and others. My mind is set in a relational database. Whenever one tell me about a problem domain, I start thinking … ‘Oh this will be a one to many relation, this goes to this table and will have this primary key and … ‘. The other part of the challenge continues, how to map the relational model to the objects in the code; Entity framework, NHibernate, LINQ to SQL, and so on.

The other thing that I was working on the past weeks is RavenDb. I have heard the term NoSQL long time ago though I didn’t get the chance to work on any one of them. If you have never tried one, I guess it is time for you to get your hands ready. If you have already experienced one of the many document databases or NoSQL data stores, this is not for you. There are lots of document databases like MongoDb, CouchDb and others. RavenDb caught my attention because it is designed for the dot net platform. Raven is an open source (with commercial option) document database. So, I will just go to the sample application I did for learning to work with it, which you can find it here. It is a simple order management system, where a user comes and orders some product and the system takes the order information, stores it in raven and send an email to the customer. You can get the latest build of Raven from here.

If I was going to do the same application using a relation database, I have to have at least five tables; one for the product, one for the customer, one for the customer category, one for the order items and one for the order itself. The Customer will have a reference to a category and then the the order item will have a reference to the product and the order will have reference to the order items. However, this is how it looks when stored in Raven:

{
“OrderNumber”: “HR-00015”,
“Customer”: {
“FullName”: “Name of Customer 14”,
“Email”: “customer@gmail.com”,
“Category”: {
“Description”: “Category 14”,
“DiscountPercent”: 14.0
}
},
“OrderItems”: [
{
“Product”: {
“ProductName”: “Product Name 14”,
“ProductCode”: “Code”,
“UnitPrice”: 14.0
},
“Quantity”: 14.0,
“Confirmed”: true,
“Acknowledged”: false
},
{
“Product”: {
“ProductName”: “Product Name 14”,
“ProductCode”: “Code”,
“UnitPrice”: 14.0
},
“Quantity”: 14.0,
“Confirmed”: true,
“Acknowledged”: true
},
{
“Product”: {
“ProductName”: “Product Name 14”,
“ProductCode”: “Code”,
“UnitPrice”: 14.0
},
“Quantity”: 14.0,
“Confirmed”: false,
“Acknowledged”: false
}
],
“DateOrdered”: “2011-10-04T01:07:39.8246527+03:00”
}

As you can see, there is no pre defined schema that is used to store the Order object. It is a complete object with all it’s references in it; the order items along with the products and customers in it. The order management system is a simple MVC application. Assuming that there is another view which is used to fill the order information, validating all the things, the Order object will be forwarded to this order controller. This is not a recommended way of doing it, but I put the code to store the object in to Raven inside the controller. I didn’t finish the view that will post the order information.

using (var session = DocumentStoreHolder.DocumentStore.OpenSession())

            {

                session.Store(order);

                session.SaveChanges();

                foreach (var orderItem in order.OrderItems)

                {

                    orderItem.Acknowledged = true;

                }

                session.SaveChanges();

                ViewData["Message"] =

                    "Your licences will be sent to the email address provided. We thank you.";

                CommandExecuter.ExcuteLater(new SendEmailCommand(order));

            }

 It creates a session variable just like entity framework context object and it’s this session object that does all the magic. In the above code the Store method takes the object and stores it in memory, when the SaveChanges method is called it will be written to the database. One of the selling points of No SQL databases is the fast read and write capability. The session object is also used to Load a single record with id, to update or delete. The Load method is used in the ‘Confirmation’ Action of the Order controller. The other part of the sample application is just a fancy way of sending the email, so that the user enjoys while we process the sendingof the email in another task. You can see the full sample of working a long running task in another process on a sample application, similar to stack overflow site, Raven Overflow and Racoon Blog which are both on git hub. I will have another post on this issue soon, with details and may be a better sample application. If you want to try the sample application, you will need to get the Client API for for dot net framework 4.0 either using NuGet or from the Client folder of the latest build from github.

Posted October 19, 2011 by Behailu S. in Dot net