NeoIntelligence IT Solutions

company development web blog

Modelling an Application with Visual Studio 2010 – FYP Blogging Series

I’ve been always eager to design a software architecture and do all the modeling and planning before starting the coding phase of my application development. I usually do these stuff on papers, notebooks or flip charts and hang them on my walls. As you might imagine, it looks quite pretty and one can see if I’m dealing hard with a project in that moment when he comes to my house.

My final year project is a software project, a line of business application for health care industry and I’ve been dealing with the project report. But I must admit that I’m pretty sure 90% of what I’ve been writing, will not  be very clear for the readers (the juries). The screen-shots will not be enough so I should add some flow charts and activity diagrams to my report in order to give the image of the prototype well.

OK, I’m cutting it short. I found too many tools online, maybe I could give a shot for a “best 10 uml tools” blog entry later on. For now, this blog entry will be about modeling with Visual Studio 2010 and the modeling project I’ve just learned and made in 15 minutes.

Besides, I must say that this is my first Modeling Project in Visual Studio 2010 and there might be some better ways to implement the work flow. (This is not a professional reference.)

I’m going to visualize the “TreatmentAdvise” function of my project. I have a WPF user control for Treatment Records in my application that is

  1. Start the Program
  2. Initialize Business Objects
  3. Populate Patient List via Data Tier
  4. Let user to select a patient
  5. Let user to navigate to the treatment control
  6. If there is no patient selected yet, GOTO to 1 (Do Nothing, Do Not Allow Navigation p.s. I LOVE GOTO p.s. I Love Commodore)
  7. If a patient was selected
    1. Populate the required controls with patient’s information via Business Tier
  8. Let user to Insert the treatment details into Treatment Control
  9. Let user to right-click and ask for advice according to his treatment details
  10. If he asked for advices
    1. Initialize Business Tier and get Treatment Collection
    2. Define a new Treatment Details window and Data Bind details window with treatment collection
  11. BINGO ! Go To 4 !

I have an n-tiered architecture for my project and Data Tier means Repository classes to do the CRUD operations and Business Tier for this case is meaning Service classes to process the business object collections. To implement this pseudo code, I’ve created a new Modeling Project and named it as Treatment Adviser. Next to that I’ve added other items to help me clarify the algorithm better.

1. Adding PatientsTreatment.usecasediagram

To add an activity diagram, right click on your solution from solution explorer and select add new item from the menu. Choose Usecase Diagram and add it into your solution. Once you have the usecase diagram file in the solution, right click and add a new actor and name it as The User (Caretaker) or whatever you want.

I have 2 WPF User Controls for this scenario first of which is the PatientList Control for the Crud operations of Patient object and second one is the Treatment Record Control where the treatment advice process runs. I’ve inserted 2 subsystems and add use cases as in the screenshot below. To bind associates to the User Actor, right click on the actor and choose Associate and bind it to use cases. There are 3 “include” arrows. Updating Patient needs a Select Patient use case, Setting Treatment Details may need Get Treatment Advice use case as well as Inserting Treatment Record use case.

2. TreatmentAdvisor.activitydiagram

To add an activity diagram, right click on the solution and select add new item. Choose Activity Diagram and name it accordingly. Once you have the activity diagram file in the solution, right click on the file and add new initial node. After adding the initial node, you may add the actions and other nodes if you need. I created an activity diagram for my application as you are seeing below for my solution.

3. Adding  The TreatmentAdvisor.ClassDiagram

For this scenario, I have a IRepository interface and there are 3 repository classes inherited from IRepository interface in my class diagram. Similarly, the TreatmentService object is inheriting from the IService interface as you see in the class diagram. It’s really simple to design modeling applications in visual studio. Just right click and add any item you want from the list and associate with other related items around.

Now, I am ready to design my sequence diagram for the algorithm developed for treatment adviser process.

4. Treatment Advise.sequencediagram

Firstly, I’ve added the User (Caretaker) actor as a Lifeline. The user selects patient from the main window to populate other controls. I named the main window as NeoMobile Healthcare Application Suite. When the user selects a patient from the control in the main window (NMHAS), the treatment repository gets all the Treatment Items for the patient and populates the treatment list box control in the Treatment Adviser window. When the user clicks to insert a treatment record, the program navigates to the treatment adviser window. The user sets details of the treatment and if he wonders about the similar treatments in the database, he will be able to get the similar treatment records from the treatment service pattern and see them in a new list box in a new window with TreatmentCollectionContainer control. These processes are all added by again right click and add a new Synchronous Message. You can associate your objects from your class diagram with the Lifeline objects in the sequence diagram. (+GetItemById(id) comes from the TreatmentRepository class)

Just think about the user enters a Complain into the system and he wants to see all the Treatment Records with the same complaint and with a good result, with a bad result. This way he will be able to get the insight from the system.

Before closing the topic, I want to show some code lines from the real application. There should be some ways to convert this information from logical layer to physical layer.I will be searching and blogging about this modeling in the next possible time.

Here my real time codes from my little framework I developed for my applications,

Source Code for showing up the similar treatments

            Dictionary<string, string> param = new Dictionary<string, string>();

            IService<Treatment> _treatmentService = ObjectFactory<Treatment>.GetServiceInstance<Treatment, TreatmentService>();

            if(cbSikayetler.SelectedIndex != -1)
                param.Add("ComplainsCode", cbSikayetler.SelectedIndex.ToString());

            if(cbMuayeneler.SelectedIndex != -1)
                param.Add("ExaminationCode", cbMuayeneler.SelectedIndex.ToString());

            if(cbIzlenimler.SelectedIndex != -1)
                param.Add("GeneralImpressionsCode", cbIzlenimler.SelectedIndex.ToString());

            if (cbTedaviler.SelectedIndex != -1)
                param.Add("TreatmentCode", cbTedaviler.SelectedIndex.ToString());

            if (cbReceteler.SelectedIndex != -1)
                param.Add("PrescriptionCode", cbReceteler.SelectedIndex.ToString());

            if(cbSonuclar.SelectedIndex != -1)
                param.Add("ResultCode", cbSonuclar.SelectedIndex.ToString());

            if (cbTanilar.SelectedIndex != -1)
                param.Add("DiagnosisCode", cbTanilar.SelectedIndex.ToString());

            IList<Treatment> treatments = _treatmentService.GetItemsByCriteria(param);
            if (treatments.Count == 0)
            {
                MessageBox.Show("Hiç bir kayıt bulunamadı");
                return;
            }

            Muayeneler m = new Muayeneler(_treatmentService.GetItemsByCriteria(param));
            m.Show();

4 responses to “Modelling an Application with Visual Studio 2010 – FYP Blogging Series

  1. Pingback: NeoMobile Healthcare Suite – My FYP Blogging Series « NeoIntelligence IT Solutions

  2. Barkın Kızılkaya January 14, 2011 at 5:37 pm

    hııım nice article 🙂 kubi Blogging has been started. Why engilish ?

  3. Pingback: NeoMobile Healthcare Suite – My FYP Blogging Series « notes from underground

Leave a comment