Creating big applications is a long and difficult process. It is also very vague and non-linear. Design documents change as per the fluctuating needs of the client, limitations of the development environment and programming language, paucity of time and funding, and of course, developer competence. Before one sits down to start writing code, one must have a conceptual overview of the application. This is the architecture phase. Once this conceptual overview has been fleshed out, one starts thinking about the patterns, data types and algorithms to be used. Note that by patterns I mean application patterns and by data types, I mean abstract data types and not data structures. A queue or a stack is an abstract data type and NOT a data structure, queues and stacks can be implemented using either arrays, linked lists or heaps. These are data structures. Data types provide intent, while data structures provide the means. A pattern I want to discuss is the Producer/Consumer queue.
This pattern is useful if you have jobs that are generated which need to be executed in a sequential manner. So we have a queue of tasks and a worker thread that executes those tasks on-the-fly as they are enqueued in the queue. So how is it implemented? Very straightforward. We have a queue, a locking object, pool of threads and a thread monitor. To enqueue, first lock the locking object and call pulse in the monitor. To consume, simply lock the queue, dequeue, and pass on the task to a waiting thread. To dispose simply enqueue NULL in the queue and wait for the threads to terminate.
Sunday, March 28, 2010
Friday, March 26, 2010
Lamer and lamer
Obsession is not a good thing. Well, most of the time it is, but becoming too obsessed with something will make you a very lonely person. Obsession is also a sign of greatness; no man who was a master of his craft was a sociable person (exceptions are always there though). Perhaps loneliness is the price one pays for everlasting glory? Anyway my "plan" is coming around quite nicely. If I am lucky I could get 3 maybe 4 slots. If that happens I can rest easy....for some time ;)
So for some news; placed 4th in Eastern Groups, 4th in powerlifting :( , completed Dragon Age: The Awakening, and cramming my head with a lot of code.
Presently I am working on a on-the-fly analysis of code. Lets see how this will turn out.
So for some news; placed 4th in Eastern Groups, 4th in powerlifting :( , completed Dragon Age: The Awakening, and cramming my head with a lot of code.
Presently I am working on a on-the-fly analysis of code. Lets see how this will turn out.
Wednesday, March 17, 2010
Code Metrics Addin update (beta version available)
I have been working quite a bit on the metrics addin. In the process I also learned quite a bit about the idiosyncrasies of the C# language as well as gained familiarity with NRefactory and the MonoDevelop Dom model. The next logical step would be to implement CQL which should be quite straightforward as I will just need to map CQL to LINQ queries and query the context data structure that I already have.
Here is a screenshot for you to enjoy. A very weird thing is that NRefactory refuses to parse lines in between # regions. So a namespace defined as
#if_something
namespace name1#else_something_else
namespace name2
{....
will not be parsed. Somehow the Dom model recognizes it though.
Saturday, March 6, 2010
Diligence and discipline
Two words that are definitely missing from my life right now. On the academic front I have lost all interest. Seriously, at this point of time in my life, I am sick and tired of never ending exams. They are totally pointless and a complete waste of time. I have no interest in suggesting alternatives because that will be an exercise in futility. Speaking of which I have a powerlifting event I have to participate in tomorrow. I did a 80 kg benchpress some time back. Hope I am in good form tomorrow!
My code metrics project is going on pretty well. Have a lot to learn though, especially the .NET threading model and GTK# as well. I also need to get started with all the pending work of SMS Invite :)
My code metrics project is going on pretty well. Have a lot to learn though, especially the .NET threading model and GTK# as well. I also need to get started with all the pending work of SMS Invite :)
Subscribe to:
Posts (Atom)