Clean Coder ch.4:Coding

This chapter was full of excellent tips and many hard truths. I would love to believe I work better by listening to music, but it is not the case. Recently, I have stopped listening to music while doing work and I get things done much faster. The writer of Clean Coder knows that it is usually distracting as well, and advises others not to multi task as it either leads to distraction or what he calls “entering the zone”. He makes the point that entering the zone is not a good thing because while you may get more done when you are extremely concentrated, you may make bad decisions that will later cause you to go over that code again to make changes. This is a valid point, but for me personally, I seem to always be in either one of two states: concentrated or distracted. If I am focusing on something, every thing else is a blur. If you talk to me in this state, I probably will not hear you. And if I stop and go do something else, it takes a bit for me to concentrate again.

Some of the other points he made was the distractions of worrying, interruptions, and writers block. These are all real life situations that get in the way of our thinking, and we need to find our own ways of combating these inhibitors. Worrying causes us to always be thinking of our situation than what we need to work on right now. Interruptions can cause us to snap at others for breaking our concentration. And writers block is the inevitable situation we find our selves in from time to time that stunts our productivity. His solution was pair programming, and while this is a good thing to keep in mind, we can’t always work with someone else. Sometimes we do not have access to another person for insights.

Lastly, he also goes through the debugging process in detail, explaining why debugging is so important. Debugging is not a waste of time or something that just has to be done, it is a part of programming and is just as costly as the program itself. Debugging is what tells you the quality of your code. Without it, you are basically taking a test without finding out how you did on it. Lastly, he mentions how time allotment and scheduling is important as well, and how bad pacing can cause late submissions. Being late is what we strive not to do, but when it does happen, we need to alert others as soon as we realize our blunder.

From the blog shatos by shatos and used with permission of the author. All other rights reserved by the author.

Radiology Project part 1

For the openMRS radiology module, so far I have installed Vagrant and a virtual machine and am currently in the process of fixing errors that have arisen, as well as dealing with authorization issues. Here are the steps I have done so far:

  1. Download Vagrant – Vagrant Download Here
    1. Download the software for your computer version, run the .msi file, and follow the default options unless you want to change something.
    2. What is it? – A quote from the developers of Vagrant, here is their mission statement so to speak: “If you are a developer, Vagrant will isolate dependencies and their configuration within a single disposable, consistent environment, without sacrificing any of the tools you are used to working with (editors, browsers, debuggers, etc.).”
    3. Do I need it? Yes, the radiology module is currently setup to utilize Vagrant, and even though it takes a few minutes to install, it will automate the VM setup and meld it with openmrs for you.
  2. Download Virtual Box – Download Here
    1. Download the version you need, preferably the most recent Stable version.
    2. Run through the setup, and choose what settings you feel comfortable with. However, keep in mind that it can only use what memory you let it use, so if you will not be using any other heavy hitting programs simultaneously, give Virtual Box a good chunk of your RAM (preferably 6gb or more) so that it can run efficiently.
    3. You do not have to create any vm machine instances, just install the program right now. Vagrant will create a vm for you automatically.
  3. Clone the directory:  https://github.com/teleivo/puppet-openmrs-radiologydcm4chee.git
    1. You will need a git account if you do not have one, but if you are a programmer you should consider using a git account as it not only works as a version control software, but also as a portfolio of sorts.
    2. Make sure you remember where you cloned this folder. You will need to refer back to this source folder so keep it somewhere easily accessible.
    3. What is this? – This will help you by running a server which will contain both openMRS and dcm4chee (An open source medical application/utility).
  4. Let Vagrant do your work! – Just use any console to navigate inside the git folder you just cloned, and type “vagrant up” and hit enter.
    1. Now you wait, a while. Walk away and get some coffee while vagrant sets up your vm and server fuctions. It takes about 30 minutes on a standard internet connection, and it will bring up a new line in the command prompt when it is finished.
    2. Taken from the programmer’s page who setup this project here: “This will download a virtualbox VM with Ubuntu 14.04 64bit, install all necessary puppet modules via r10k and run the manifest/site.pp which:”
      1. Installs mysql server
      2. Installs dcm4chee and deploys DICOM viewer weasis
      3. Installs tomcat 7 and deploys OpenMRS version 1.11.4
  5. Access openMRS – you can now open a localhost window in your internet browser (firefox not confirmed to work yet).
    1. To do this, just type “localhost:8080/openmrs/” into the url.
    2. This is an exact word for word step guide on what settings to choose which is also obtained from teleivo’s gitHUb page:
    3. In the wizard select/enter the following:
      • Which type of installation do you want? => Advanced
      • Step 1 of 5, Do you currently have an OpenMRS database installed that you would like to connect to? => No
        • If no, what would you like to name this database? Database name => openmrs
        • A user that has “CREATE DATABASE” privileges must be specified here…
          • Username => openmrs
          • Password => openmrs
      • Step 2 of 5, Do you currently have a database user other than root that has read/write access to the openmrs database? => Yes
        • If yes, specify the login user name and password for that database user
          • Username => openmrs
          • Password => openmrs
      • Complete the remaining steps of the wizard
  6. At this point, you should have a working environment, but I ran into a few issues.
    1. First, even though I created a user account, I am unable to login when booting up the server instance. I have tried every account I have setup as well as default accounts or leaving the fields empty. I know someone else had this issue, so once I figure out what it is I will edit this post with the solution.
    2. For a while, when I was running the program, every other program running in the background of my pc was terminated abruptly. I did not lose anything, but I could not have any other windows open. This might be my specific pc, but be careful to save any work you have before running this.
    3. When running the ‘vagrant up’ command, it failed twice on me before running properly. Could be a connection issue, but try running it a few more times before searching for fixes.

And hopefully that is all you should need. There is a Slack group for people working on this project, so if you need help you can ask there or directly on the openmrs talk page. Feel free to fiddle around with the features as you are on a local host you will not ruin any data.

What I learned:

  1. That an installation and setup process can be made to be automated
  2. What dcm4chee is and how it is relevant to this module
  3. How openmrs functions/runs
  4. When something says it is needed, it is NEEDED (should be obvious).

How would I proceed differently:

  1. I would make sure I had all requirements before starting
  2. I would make sure I had the correct version of Virtual Box
  3. I would be more attentive to other people’s errors in case I encountered them as well

Applications:

  1. This whole process will come in handy when creating programs in the future. This process makes installing things much easier, especially if I had to install this on multiple computers throughout a hospital.
  2. I will be able to apply some of this knowledge on any local server project I work on.

Credits to:

  1. teleivo on gitHub
  2. Vagrant software by HashiCorp
  3. Virtual Machine
  4. dcm4chee

From the blog shatos by shatos and used with permission of the author. All other rights reserved by the author.

Radiology Project part 1

For the openMRS radiology module, so far I have installed Vagrant and a virtual machine and am currently in the process of fixing errors that have arisen, as well as dealing with authorization issues. Here are the steps I have done so far:

  1. Download Vagrant – Vagrant Download Here
    1. Download the software for your computer version, run the .msi file, and follow the default options unless you want to change something.
    2. What is it? – A quote from the developers of Vagrant, here is their mission statement so to speak: “If you are a developer, Vagrant will isolate dependencies and their configuration within a single disposable, consistent environment, without sacrificing any of the tools you are used to working with (editors, browsers, debuggers, etc.).”
    3. Do I need it? Yes, the radiology module is currently setup to utilize Vagrant, and even though it takes a few minutes to install, it will automate the VM setup and meld it with openmrs for you.
  2. Download Virtual Box – Download Here
    1. Download the version you need, preferably the most recent Stable version.
    2. Run through the setup, and choose what settings you feel comfortable with. However, keep in mind that it can only use what memory you let it use, so if you will not be using any other heavy hitting programs simultaneously, give Virtual Box a good chunk of your RAM (preferably 6gb or more) so that it can run efficiently.
    3. You do not have to create any vm machine instances, just install the program right now. Vagrant will create a vm for you automatically.
  3. Clone the directory:  https://github.com/teleivo/puppet-openmrs-radiologydcm4chee.git
    1. You will need a git account if you do not have one, but if you are a programmer you should consider using a git account as it not only works as a version control software, but also as a portfolio of sorts.
    2. Make sure you remember where you cloned this folder. You will need to refer back to this source folder so keep it somewhere easily accessible.
    3. What is this? – This will help you by running a server which will contain both openMRS and dcm4chee (An open source medical application/utility).
  4. Let Vagrant do your work! – Just use any console to navigate inside the git folder you just cloned, and type “vagrant up” and hit enter.
    1. Now you wait, a while. Walk away and get some coffee while vagrant sets up your vm and server fuctions. It takes about 30 minutes on a standard internet connection, and it will bring up a new line in the command prompt when it is finished.
    2. Taken from the programmer’s page who setup this project here: “This will download a virtualbox VM with Ubuntu 14.04 64bit, install all necessary puppet modules via r10k and run the manifest/site.pp which:”
      1. Installs mysql server
      2. Installs dcm4chee and deploys DICOM viewer weasis
      3. Installs tomcat 7 and deploys OpenMRS version 1.11.4
  5. Access openMRS – you can now open a localhost window in your internet browser (firefox not confirmed to work yet).
    1. To do this, just type “localhost:8080/openmrs/” into the url.
    2. This is an exact word for word step guide on what settings to choose which is also obtained from teleivo’s gitHUb page:
    3. In the wizard select/enter the following:
      • Which type of installation do you want? => Advanced
      • Step 1 of 5, Do you currently have an OpenMRS database installed that you would like to connect to? => No
        • If no, what would you like to name this database? Database name => openmrs
        • A user that has “CREATE DATABASE” privileges must be specified here…
          • Username => openmrs
          • Password => openmrs
      • Step 2 of 5, Do you currently have a database user other than root that has read/write access to the openmrs database? => Yes
        • If yes, specify the login user name and password for that database user
          • Username => openmrs
          • Password => openmrs
      • Complete the remaining steps of the wizard
  6. At this point, you should have a working environment, but I ran into a few issues.
    1. First, even though I created a user account, I am unable to login when booting up the server instance. I have tried every account I have setup as well as default accounts or leaving the fields empty. I know someone else had this issue, so once I figure out what it is I will edit this post with the solution.
    2. For a while, when I was running the program, every other program running in the background of my pc was terminated abruptly. I did not lose anything, but I could not have any other windows open. This might be my specific pc, but be careful to save any work you have before running this.
    3. When running the ‘vagrant up’ command, it failed twice on me before running properly. Could be a connection issue, but try running it a few more times before searching for fixes.

And hopefully that is all you should need. There is a Slack group for people working on this project, so if you need help you can ask there or directly on the openmrs talk page. Feel free to fiddle around with the features as you are on a local host you will not ruin any data.

What I learned:

  1. That an installation and setup process can be made to be automated
  2. What dcm4chee is and how it is relevant to this module
  3. How openmrs functions/runs
  4. When something says it is needed, it is NEEDED (should be obvious).

How would I proceed differently:

  1. I would make sure I had all requirements before starting
  2. I would make sure I had the correct version of Virtual Box
  3. I would be more attentive to other people’s errors in case I encountered them as well

Applications:

  1. This whole process will come in handy when creating programs in the future. This process makes installing things much easier, especially if I had to install this on multiple computers throughout a hospital.
  2. I will be able to apply some of this knowledge on any local server project I work on.

Credits to:

  1. teleivo on gitHub
  2. Vagrant software by HashiCorp
  3. Virtual Machine
  4. dcm4chee

From the blog shatos by shatos and used with permission of the author. All other rights reserved by the author.

Clean Coder ch.3:Saying Yes

Chapter 3 in this book contrasted the last chapter, because the subject this time was saying Yes. We cant always push things off till later and tell our boss, “I need time”. Sometimes it just needs to get done, or at least made progress on. If you can’t commit to doing the whole thing, make a commitment to doing parts of it. Also on that topic, if you can’t do something, do not say you will try, or that you will see what you can do, just tell it like it is. Say only what you intend to fulfill.

From the blog shatos by shatos and used with permission of the author. All other rights reserved by the author.

Clean Coder ch.3:Saying Yes

Chapter 3 in this book contrasted the last chapter, because the subject this time was saying Yes. We cant always push things off till later and tell our boss, “I need time”. Sometimes it just needs to get done, or at least made progress on. If you can’t commit to doing the whole thing, make a commitment to doing parts of it. Also on that topic, if you can’t do something, do not say you will try, or that you will see what you can do, just tell it like it is. Say only what you intend to fulfill.

From the blog shatos by shatos and used with permission of the author. All other rights reserved by the author.

The Clean Coder Chapter 4 & 5

Chapter 4 of The Clean Coder starts to explain some practices when it comes to coding.  Many do’s and don’t’s, some myths busted, and general good practices are told.  It tries to explain that coding is hard and that it shouldn’t be done when one is tired.  Not only that but it shouldn’t be done when you can’t focus at all.  Not being able to focus on your coding is a route to disaster and prone for mistakes.  It even claims that when you are in “the Zone”, a time where you are coding quickly and nothing is stopping you, it’s a mistake waiting to happen.  Although coding quickly can yield some results, it’s never perfect.  I’ve experienced this myself even.  When coding quickly to try and make a due date for assignments, there are usually always errors whereas work that is done over time and at reasonable times, it’s almost always better.  The book then goes on to explain about how music and other distractions can also causes errors as well.  Although music might help some, the book claims is puts coders into “the Zone” which is where you don’t want to be.  You want to be in complete and total control over your coding, not someone else in your head.

Chapter 5 on the other hand talks about something I’ve been told many many times before, and it’s still something I have yet to fully experience or see the point to, and that’s Test Driven Development.  I understand the concepts behind it and how it can help, but I just don’t understand why you want to write the tests before you have actual code to test.  I want to start with a plan of what I want to write first, figure out what I want to code, and then attempt to start it and THEN test it.  Once I have something worthy of testing, I test it.  Why would I want to write a test on something that I haven’t even created yet? When creating the program for the test I created, I might even change how it works, which means I have to change how the test works anyways!   It just seems silly to me, but to each their own I suppose.

The only thing that I agree with with TDD is that you want to write your tests alongside your code.  You wrote something that needs a test? Write a test for it now.  That makes perfect and reasonable sense to me.  Don’t save writing all the tests for last.  By writing your tests as you go, and even testing them, you can see any problems on what small problems you are currently working on, and can fix it now before it can lead to greater errors later on.

Anyway, in regards to what was actually in the book, it just lists some practices on how to conduct TDD.  It explains the three laws and how the three laws can lead someone to better structured code rather than a mess of code.  However, one needs to practice at it because following the three laws won’t yield perfect results.

From the blog CS@Worcester – Nick Richard by Nick Richard and used with permission of the author. All other rights reserved by the author.

The Clean Coder Chapter 2 & 3

The next couple of chapters in Clean Coder deal with communication in terms of saying yes and no.  Obviously in a work environment, one is prone to say yes to their boss all the time; but that is not what a professional does.  A professional needs to learn how to communicate effectively with their boss and peers and explain how long something will take.  Saying that you’ll try is not good enough, your boss might expect a 100% working product and you might only give a 50% working product, resulting in disappointment and anger.

However this doesn’t mean that you should say no to everything, you have to do something while at work, it’s your job! And this is what chapter 3 goes more in depth about, saying yes.  When you say yes you need to be definitive about what you are saying yes you.  Say yes to something that you know for a fact that you’ll get done, something that you know will be 100% working by the date you defined.  There should be no lack of commitment when saying yes.  Saying yes as a professional means that you are taking full responsibility of the task and making sure that it is functioning to the standards that it needs to be at, and possible even higher.

Overall, when it comes to taking on tasks in a work environment, you shouldn’t take on every single task that is asked of you, you will be overbooked, and I agree with this.  If I kept saying yes I would more likely than not know what is the most important task that needs to get done.  But not only that, I probably would’t get some of the tasks done at the right time.  However I do need to do work.  When choosing tasks to do, I should be confident in what I’m working on and know roughly when it will be done.  I could let my team members know how long it would take to get something done and when I would have a complete product working.  As in the previous chapters, being professional is about taking responsibility in your work.

From the blog CS@Worcester – Nick Richard by Nick Richard and used with permission of the author. All other rights reserved by the author.

Chapter 5 Reading

This was a short chapter about TDD. TDD is where you write your tests before the code that is tested. You develop the tests alongside your code instead of after it. This forces you to write code with more structure and to write better code overall. It is not fool-proof, but it does help. It helps you change your code because you know there are tests for all of your code already, so you know when you break your code. The tests will make sure that you know what you want your code to do and will help third parties follow your code. I think TDD works well but I know I need more practice with it. I plan on using it throughout my career.

From the blog chanson2016 by chanson2016 and used with permission of the author. All other rights reserved by the author.

Chapter 4 Reading

Chapter four starts off by telling you to never code when you are tired. Coding is difficult and if you are not focused, your best work will not be done. It then tells you to find a way not to think about personal things that are worrying you. This comes back to the same principle: if you are distracted, you can’t code well. The chapter then talks about “the zone.” I have coded in the zone and it does put out code faster but the chapter says that while you may be coding faster, you may not be coding better. It then talks about music and how it can help some people but it hinders most. I do like to listen to music when I code because it helps me shut out the world. However, as the chapter states, this may just be putting me in the zone, which is where I don’t want to be. The chapter talks bout working in pairs to solve most of the issues one may have with coding. You won’t enter the zone, if you are stuck they can help, and they can stay on task while you help someone else. You need to prepare your mind and body to write code. You need to be well rested and disengaged from your problems. You also need to know when to take a break from your code and re-energize. Following these steps will help you write better code while also giving you better estimates on how fast you can write code.

From the blog chanson2016 by chanson2016 and used with permission of the author. All other rights reserved by the author.

Chapter 2 + 3 Reading

These chapters together are about communication. Chapter two wants the professional coder to say no when there is no other option. A professional needs to say no when they can’t get something done. However, in chapter three, it talks about the importance of saying yes if it is within your abilities to do so. Either way you must be definitive with your answer. An “I’ll try” is not acceptable. If you can’t do something say you can’t do it, and if you can do something, make a commitment to get it done.

From the blog chanson2016 by chanson2016 and used with permission of the author. All other rights reserved by the author.