Monday, November 19, 2018

Removing duplicate file and folders - Cleaning up my hard disks

Ever since I started using a computer about 20 years ago, I carefully collect all the files thinking I would need in the future and quite frankly, I absolutely needed none of the file I created before 10 years. Those days I was hoping that in the Job interviewers might ask me to show the works I have done, but they never did. Having had the chance to see the HR processes from inside the organization in few of my previous jobs, I could tell, one should be lucky if an employer had the mindset to actually check whether an applicant has done something in the past and what they have done. All these new fancy HR processes make people too busy having to complete too many interviews for a position open, for reporting sack, they do not have the time to actually go an check an applicants past projects and the quality of the work.

My habit to collect and save all the files that I make for the projects has gotten to a point I need multiple high capacity hard disks and cloud space. I save my project files, important tutorials, camera raw files, picture/video edits, templates, songs I like, movies I like and many other files including automated back-up every three months. My digital hoarding disorder has gotten out of proportion to a level, I have a back-up of back-ups on Google clouds and important documents on one drive.

External HardDiskSo, now I have about 1 TB cloud-space, 8 TB local external storage options on multiple devices and a bunch of SD cards and pen drives could be up to a total of 500 gigs. Whoever would read this blog post five years or ten years from now would smirk at these numbers as we now laugh at the 20 gig HD on our old P4 computer (Millennium Super computers :p ) now, but for the present day specs, I think as an individual PC user trying to keep this much of data is crazy. At the place I worked for in 2005, the whole organization had about 2 TB space to manage the data.

Last few months, most of my weekends got wasted in my efforts to organize these files and eliminate duplicate files and folders. Within a few hours of starting this task I figured that it's not humanly possible to go through these thousands of folders and files one by one and delete the duplicate files. I was not ready to trust the exe HD clean-up utilities on the internet either. So, with few googlings, I wrote up a bat code that could loop through the file list and identify the duplicate files and print the details on the cmd screen. Again, It was difficult to go one by and delete, also dangerous to let the program automatically delete all at once. 

After few more attempts to modify the bat file code to selectively delete the files and folders by prompting the user, I found the code to be messy, complex and not very user-friendly for the user to go one by one again. By having the same bat logic as the core, I wrote a Java program with few classes achieving much better usability. Struggled a lot to fix the GUI freeze when thread is busy problem. When the java.io is busy in the current thread reading the files or in separate thread, the GUI becomes non-responsive and we can not see the progress of the process. After drilling Stack Overflow with all what I got, I found out that the SwingWorker is the answer to solve the problem. From there, it was easy peasy, within a few hours the "JJCleanFF" :) utility is ready and was able to delete a lot of duplicate folders and files.

For now, I share here the jar file and instructions to use the utility with you, after cleaning up the code a little bit and adding documentation, will post on GitHub and share the link in this post for source code.  So,

1. Download the executable jar file by clicking below icon or visiting http://www.jeyaramj.com/Content/Executable/JJCleanFF.jar
 Download JJ Clean FF
2. Open the downloaded jar file.
JJ Clean FF Main Window
3. In the main window, click on "Select a folder" to select the parent folder in which the folders and files be checked for duplicates
JJ Clean FF Browse Window
4. Once the folder is selected, there will be a message prompt for you to choose the file comparison method. I coded to compare the files in two ways. One is to generate a digital hash(SHA-512) of the files and check against other folders and files. If the file size is big this method would slow down your computer and better go with second method. First method is good for text files and files that are too important. If you want to choose the first method, click on "Yes". Second method is basically checking the file name and size only. If two different images with same file name and file size, but in two different folders, these two files will be identified as duplicate file with the second method. But second method is much faster for the utility to scan the folders and identify duplicates. So, if you have less important big movie files, choose second method by selecting "No".
JJ Clean FF UI
5. Now the utility will scan for duplicate files and folders and show you the percentage completed.
  
JJ Clean FF UI

6. Once the scanning process is completed, if there are duplicate files will be listed in a separate window for you to click on the check box and delete.
JJ Clean FF UI

7. Once you click on a check box, you will be prompted to confirm and once you choose "Yes", the file or folder will be permanently deleted from your HD.
JJ Clean FF UI

I tested few times in my machine by creating dummy folders and files and couldn't find any issues yet. I deleted many files on my local external disk using this utility. Please check and let me know, if there are any issues.

* - I do not accept any responsibility and will not be liable for any loss or damage suffered by you whatsoever arising out of the usage of this utility.

Sunday, April 29, 2018

Met an accident last year. My experience might be useful to you.

I got my driver's license in 2006 and now I’m driving about 10+ years. I’m in my early thirties and always take extra caution while driving.  I consider myself a safe driver. 

As I was working hard on the weekdays, preparing for my wedding and other things were going on in my life on the weekends, I rarely find time for myself. On May 1st 2017(Labour Day), which is a holiday, I woke up late and called my girlfriend and found that she was sick and suffering from severe gastric and headache. I went to meet her in the car to her apartment and after speaking to her, I went to buy the gastric medicines in the Arpico Pharmacy in Kiribathgoda.

After I bought the medicine and other groceries, I went towards Colombo side to come back to Kiribathgoda Junction, but as we can not take ‘U’ turn in junction next to Arpico, I took a right turn and went in the ‘Aluth Para’ to ‘Hunupitiya’ and stopped safely on the side of the road without blocking any vehicles. Stopped the vehicle and went to the other side of the road and bought a water bottle. Came back to my car and started the car and took the ‘U’ turn after looking all the sides. Since it was a holiday, there were no vehicles on the road and I took the car very slowly. Since I was so relaxed and wanted to have a peaceful holiday, I was driving very slow throughout. 
As I was completing more than two third of my ‘U’ turn, I heard a horn and I suddenly braked. Within a split second, I saw a young man hit a motorbike on my car and unable to control the speed, went and fell passing my car. I was so shocked. As I was in the car, the young man who fell(who was riding the motorbike) got up and come in front of my car and shouted at me using bad words in Sinhalese. The small shop lady from whom I bought the water, came out and I also got out and observed the situation. He was so upset and worried about the bike more than his wounds and telling me that it is not his bike and his elder brother’s bike and how could he tell this to his elder brother and was shouting at me standing. His hands and legs had some scratches and were shaking out of pain. I offered to take him to the hospital in my car. He refused and kept repeating that how could he repair his bike. The shop lady shouted saying "go to the hospital and treat the wounds, don’t know the inside wound". 

After a few minutes, many other people gathered and there was an old man who called the ambulance to take him to the hospital. He initially refused and then agrees as the old man insisted saying that he will talk to the brother. The shop lady told me that he came very fast and she saw me turning slowly. I asked her as to whether she would be ok to testify for me. She said she can’t. I asked her, "at least would you testify for me for turning very slowly?". She said yes first and then, when the police came, she didn’t want to. The old man asked my phone number and I gave my number to him. The old man(about 50 to 60 years old) called his brother and told that there had been an accident and that we were sending him to hospital, and there's nothing to worry. 

I had real problem communicating to them in Sinhalese. The old man noticed and asked me in English ‘Did you call your insurance?’ I said 'yes'. Then there was a policeman near to the area came and assessed the situation. The police officer asked me some questions. I answered in Sinhalese to my ability. I was able to feel that everyone is angry at me even without looking at the accident. I thought that this must have been due to the fact that I had no injury and the motorbike rider got injured. Due to my limited language skill, I couldn’t explain myself to anyone. I kept quiet. I did not tell anything to the rider as he got wounded and I did not want to tell anything in my broken Sinhalese. Then the ambulance came and they asked them to go in the ambulance and he was refusing to go as he was upset about the fact that this happened and didn’t know how to answer his brother. Others were insisting him to go in the ambulance.  Then in about 5-10 mins his brother came and talked to him and asked about the bike. The others said that it is in the service station. He came to me and asked my phone number. I gave him my phone number. His brother talked to the police and went while the motorbike rider who got wounded went in the ambulance. By looking at the wounds, which I noted while he was standing and shouting at me immediately after the accident, I thought he will be fine after treating the wounds(scratches). 

Everybody went and I was waiting in the same spot for the insurance to come. The Police took my license and told me to come to the Police Station and left. Only the shop lady was around and she was saying that these young motorbike riders are too fast. Again I asked her whether she would be willing to tell the police what she saw, but she was not ready to do that. I called my girlfriend and told what happened. She was already sick and now got really upset, but she said not to worry. At the police station, a police asked me to come to the hospital with him in my car to see the motorcyclist condition. I went with the police to the hospital. The police came back and told me that he is not in the Kiribathgoda hospital.

I came back to the police station and waited there till about 8.30 PM. The accident happened around 5 PM. The Police Officer took my statement. I was worried as to whether he understood my Sinhalese and I couldn’t read what he’s writing as it was written in Sinhalese. He told me that I will have to stay in the Police Station that night as the police is unable to contact the Motorcycle rider or his brother to find out what happened to him. I was shocked and got very scared. I called my girl friend immediately and she took a three wheeler and come to police station and talked to the police officer. After some time there was another police officer in a higher ranking who called us and told to leave the car and the car key and to go home and come back tomorrow morning. It was a big relief. I went to drop her in her apartment and came home with absolute sadness and tired.

Next day morning I went to the police station at about 8.30 AM. The brother of the motorcycle rider came and spoke to the police. I had spoken to the policeman who inspected the accident and found out that I might have to pay about four or five thousand to the rider to make a deal. The brother came and told me that this is an accident and he knows that these things happen and asking me whether I can pay him. I asked him how much he wants. He told me to tell a fair amount. After a few times asking him to tell the amount, I said to him, I’ll give him 3,000 expecting to settle around 5,000. He got offended and told me that he wants 30,000 rupees. I was shocked. In my mind, I still couldn't see why all of them were treating me as someone who's guilty. I was so upset and tired. I understood that the fact that I’m not talking much to the police was making the situation worse. Though there were many people, I found the courage to talk to the policeman in my broken Sinhalese and told that it was not my fault as he was very fast and that I didn’t know how I could have avoided what happened. The road was not a straight one so I couldn’t see him in the beginning. He came very fast and unable to control his bike tried to overtake my car in a dangerous way and his motorbike guard bar hit my car and got out of balance and fell and got the scratches. The police officer told me that they do not know that at what speed the motorbike came. I was so upset by the police officer's comment and felt hopeless and came back and sit in the chair. I called my reporting manger at work and requested for a day off. After passing 12, the police officer told me to come with them and told my girl friend to take some money and come to the Mahara court. 

I was angry towards the unfair legal system, irresponsible responses from the police and the circumstances in my personal life at the time. I wanted to fight in the court believing that I could tell my side of the story and ask how I could have avoided the accident or how it's fair to frame me guilty without evidence.

I was a fool and naive to think that. After about 11 months of fighting in the court, I've come to a better understanding of the inner workings of the system, practices, lawyers' part, police's part and how all that were just feeding my ego nothing else. 

I was never allowed to speak freely in the court; most lawyers were too busy to hear me out; a lawyer didn't come on time to the court and got me an arrest warrant but still blamed me and charged me for his time; couldn't find a lawyer who would tell to the court that the other lawyer was late and that was why I was not present when my case was called; and, there were a million things that made me just angry and were interfering with my day to day life. I was just wasting my time and money while costing my family & friend's happiness just to prove my idiocy. This was all just to console my anger that I was feeling towards more than just one thing.

This post is just to share my experience and help you out should you come to face this kind of situation. I purposely left out many other things that made my blood boil and had to go though last 11 months.

If I were to list out some of my leanings through this accident.

  1. When it comes to accidents, it's not about what happened, it's about what happened that you can prove.
  2. When you are met with an accident, try to quickly get over the shock that you might feel at that moment and start acting quickly to understand the situation and collect evidence.
  3. If you were like me, anger will silence you at the most important time you need to speak. So, try controlling your anger and speak loud and clear with everyone at the spot, especially with the police.
  4. Confronting and arguing never helps, I think. 
  5. Coming to a settlement clammily discussing, before the police arrives, would be the best idea, but when one is injured and out of control, it might be tough.
  6. Collect evidence and take photos of the accident.(Name of Driver, Address of Driver, Phone number or other contact information )
  7. Collect information about the Other Driver's Insurance Company (insurance company name, insurance company policy number)
  8. Collect information about the Other Car (Vehicle Description, Make, Model and Year - Consider taking photos for your own record if it is possible.Vehicle registration information, License plate number)
  9. Other information to collect
    1. Date and Time of the Accident
    2. Address of the accident, or approximate address
    3. Road you are on and the nearest cross street
    4. The direction you were traveling in
    5. The direction the other car was traveling in  
    6. Take photos from a few angles or sketch a diagram of the crash scene
    7. What happened 
    8. Any notes regarding the driving conditions(try to figure out whether the other person is under the influence of alcohol), the weather, visibility
    9. Any witnesses names and contact information
    10. The name, badge number, and contact information of any police officer who comes to the accident spot
  10. Don’t talk to other driver’s insurance company – Do not give a recorded statement to the other driver’s insurance company without counsel being advised and present.
  11. Don’t sign anything – After the accident, you may be asked to sign releases from the other driver’s insurance company. Do not sign any documents before your lawyer has had a chance to review them.  (Thanks reynoldsinjurylaw.com/8-things-to-consider-if-you-are-in-a-car-accident/)
  12. Have a dash cam fixed to your car.
  13. If it has to go to the court, come up with everything that you need to tell to the police that would be included in the police statement.
  14. Always have your friends or family members by your side to help you at the police station or at the court.
  15. Seek help from your friends or from me to find you a good lawyer from the start.( I made a big mistake on this.)
  16. Try your best to keep the police on your side.
  17. Do your research and get the insurance from a friendly insurance company.
  18. Disappointments and circumstances might make you feel tired and lethargic, Don't be. Take enough fluids keep yourself energetic at all times.
  19. Always prepare for the worst and act as if everything is in your favor. 
  20.  Drive very safe not expecting others to do the right thing on the road. But, don't be scared or agitated when driving.
  21. Have some emergency contacts(Family member or friend to call, lawyer, insurance contact, service station number for quick quotation etc..) with your tax, insurance and driver's license. 

If you got into any kind of accidents, don't worry too much immediately and panic. That would make things worse and remember Time Changes Everything.

Thank you for checking this post and wish you well.

Tuesday, August 18, 2015

Parliamentary Election - 2015 & Post Viral Fatigue Syndrome (PVFS) in Dengue Infection

Election results are coming in and I'm at home trying to find houses to rent. I have not been feeling well lately. Don't have motivation to do anything and mostly I feel tired and lazy nowadays. It's been a while since I posted anything to my blog and I have been avoiding to go to gym or to do any physical exercises. I thought that the fact that I had dengue fever last year might have do something with how I feel recently and was googling this morning to find about the aftereffects of dengue.

Photo credits : gettyimages, Buddihika Weerasinghe

It's been well over an year since I got dengue fever and you might remember me crying about it on my earlier post "Everything is a miracle". In the state of my mind I was, just after having experienced dengue fever, I might have felt as if everything is a miracle, but certainly I don't feel that way now. I want to feel as if everything is a miracle and be happy about the things to be happy about, yet I find myself in a position where it's very difficult to feel that way and which brings me to the 'thing' I would like to share and enrich our knowledge. Or, maybe just trying to reflect upon my observations and responses to the after effects of dengue as I experience it. In this post I intent to document the effects dengue have on me now.

PVFS, this is obviously a self-diagnosis after having read a lot on the internet and the symptoms ain't to such a degree that they limit my ability to carry out ordinary daily activities, however, it is affecting me to a level I'm unable to function to my optimum capacity or at least to a level how I was performing before suffering from dengue; physically, mentally and socially. Symptoms I identify include not having refreshing sleep, sore throat, headaches of a type not previously experienced, malaise after exertion, cognitive difficulties (specially memory and attention), widespread muscle and joint pain, mental and physical exhaustion and stress or depression(mild).

As this has been so far very manageable and does not severely affect my day-to-day functioning, I like to identify this as Post Viral Depression instead of CFS(chronic fatigue syndrome). From what I read, exactly what causes this is unknown, but there are several studies and in one of them the experts think a viral infection such as dengue fever can trigger the condition. Certain bacteria have also been suggested as a cause. According to the NHS UK site, it's unclear as to why symptoms persist or get worse over time or as to why sometimes develop gradually. And other suggested causes are 1) Problems with the immune system 2) a hormone imbalance 3) psychiatric problems – some cases have been linked to mental exhaustion, stress, depression and emotional trauma 4) genes – some people may have an inherited tendency to develop. it's more common in some families 5) traumatic events – some cases have been linked to events such as surgery or a serious accident. And the site notes that it's possible that cause can be a combination of factors. The suggestion is that if you experience similar symptoms, it's best to consult a doctor as there are some other medical help sites indicate that diabetes, kidney or liver dysfunction can also be the case.

From my experience the worse part is that, it's a circle and one triggers other - a chain reaction sort of thing. The anxiety and mood disorders associated makes me sick and the sickness makes me stressed. Few of my colleagues also have had infected with Dengue Virus, yet they don't think they have any significant fatigue symptoms beyond the acute phase of infection and hospitalization.

Department of Medicine, Yong Loo Lin School of Medicine, National University Singapore has done a study on Post-infectious fatigue syndrome in dengue infection in February 2008 and they prospectively studied the incidence and factors associated with fatigue in a cohort of patients following dengue infection. They included patients with serologically confirmed dengue infection admitted to the Hospital during a dengue outbreak from Oct-Nov 2005. Their follow-ups with the patients for two months following hospital discharge, where a Fatigue Questionnaire was administrated, reveled that the significance was assessed at P < 0.05 when presence of significant fatigue was considered as the main outcome measure. Their site published the following results and concluded that the first systematic evidence that dengue can result in clinical disease beyond the acute phases of infection.

One hundred twenty-seven patients, 71 (55.9%) males and 56 (44.1%) females, of mean age 36.06 years (range, 16–70; S.D., 13.722), participated in this study. Twenty-five (19.7%) patients had dengue haemorrhagic fever and the remaining 102 (80.3%) had dengue fever. In multivariate analysis, increased age, female sex, the presence of chills, and the absence of rashes were significantly associated with the development of fatigue post-dengue infection. There was no significant association between fatigue and dengue severity. 

www.epid.gov.lk published a post stating that during the last 8 month of the year 2015, 18830 suspected dengue cases have been reported to the Epidemiology Unit from all over Sri Lanka. Approximately 49.63% of dengue cases were reported from the Western province. The highest numbers of dengue cases were reported during the fourth week of 2015. This was the time I had dengue fever and most of my colleagues from Gampaha district seem to have had Dengue fever at some point in their lives. If you like to check out the statistics, visit http://www.epid.gov.lk/web/index.php?option=com_casesanddeaths&Itemid=448&lang=en

Photo Credit : ipsnews.net

Despite of the efforts made by the Health Ministry of Sri Lanka to prevent dengue and provide information to general public (http://www.dengue.lk & http://www.dengue.health.gov.lk ) and the funding of Seventh Framework Programme of the European Community (http://www.denguetools.net), we don't seem to have the awareness required. The prevention methods used in Sri Lanka seems very ineffective and iffy. I don't really think the street posters and handouts given in the hospitals are enough to prevent dengue.

The government should at least try to strictly impose policies on Housing and Maintenance of properties in polluted areas and highly-populated cities. The drainage system is an essential part of living in a city or urban area, as it reduces flood damage by carrying water away, and in Sri Lanka, we seem to use a system almost a century old without proper maintenance. Local businesses should manage the local drainage network, including street gutters and drains. Individual property owners should be responsible for drainage systems on their property such as roof gutters, downpipes and pipelines, which generally connect to council drainage systems.

 If we don't look for a government which strictly imposes these and instead just talking about price deduction on goods and play race/ethnic card to win elections, I don't know.. this will be a country full of fools.

References

Bennett, A., Fagioli, L., Komaroff, A., & Raoult, D. (1994). Persistent Infection with Bartonella (Rochalimaea) henselae or Afipia felis Is Unlikely to Be a Cause of Chronic Fatigue Syndrome.Clinical Infectious Diseases19(4), 804-805. doi:10.1093/clinids/19.4.804
Epid.gov.lk,. (2015). Dengue update. Retrieved 18 August 2015, from http://www.epid.gov.lk/web/index.php?option=com_content&view=article&id=171:dengue-update&catid=51:message-for-public&Itemid=487&lang=en
Forums.prohealth.com,. (2015). Postinfectious fatigue syndrome in dengue infection | ProHealth Fibromyalgia, ME/CFS and Lyme Disease Forums. Retrieved 18 August 2015, from http://forums.prohealth.com/forums/index.php?threads/postinfectious-fatigue-syndrome-in-dengue-infection.193179/
ME Association,. (2008). Post-infectious fatigue syndrome in dengue infection (revised 21/03/08). Retrieved 18 August 2015, from http://www.meassociation.org.uk/2008/03/post-infectious-fatigue-syndrome-in-dengue-infection/
MedicineNet,. (2015). Patient Comments: Dengue Fever - Describe Your Experience - Viewers Share Their Medical Experiences - MedicineNet. Retrieved 18 August 2015, from http://www.medicinenet.com/dengue_fever/patient-comments-159.htm
Mørch, K., Hanevik, K., Rivenes, A., Bødtker, J., Næss, H., & Stubhaug, B. et al. (2013). Chronic fatigue syndrome 5 years after giardiasis: differential diagnoses, characteristics and natural course.BMC Gastroenterol13(1), 28. doi:10.1186/1471-230x-13-28
Seet, R., Quek, A., & Lim, E. (2007). Post-infectious fatigue syndrome in dengue infection. Journal Of Clinical Virology38(1), 1-6. doi:10.1016/j.jcv.2006.10.011

Wednesday, October 8, 2014

Individualism and Collectivism and Metryingtolearnthemism

I had no siblings till the age of 9. There were no many people in my village. At least about 200 meters distance to the next nearest house from mine. Most of them in my village were farmers. There were no political parties or much influence from politics.  People didn't have much social interactions. Religious/civil ceremonies such as weddings, Hindu religious celebrations, Cultural celebrations and Friday prayers at temples were the main source of social interactions. Most of them knew most of them by name in my village. Brought up as a single child till my age of 9 with ample nurturing from my parents, aunties, uncle and the isolated environment I spent my childhood shaped my character  and somewhat make me a person who likes exclusivity and solitude.

The nineteen nineties was the peak time of civil war; my village was under the control of LTTE. People didn't have the luxury to watch TV nor had telephones, therefore no influence from the world outside.  School, home and sometimes playing cricket or football were the only things in life. On the positive side, no much people to influence my thoughts. I spend most of my times at home - claiming in the trees and picking mangos:),  disassembling and assembling my bicycle, decorating my bicycle with LED lights,  playing with electrical gadgets,  riding my motorbike, changing the carburettor settings and trying new things on my motorbike, doing mechanic works on my custom made 'water pump + generator' thing and playing in the tractor.  I didn't need a license or Helmet to ride my bike in my village when LTTE ruled the area.

I feel very fortunate to have had the independence of a sort and the ample time I had, to sit alone most of the time and wonder about things on my own. This freedom and the isolation had a profound effort on my character.  At the time, I didn't understand or develop any ideas on how to live and work with other people in harmony, how groups work, tolerance,  the expectations of society, sacrifices to be made for others for a greater good for everyone, how my actions affect other people  and what is expected from me by the society.
Individualism or perceived separation from society is as absurd as a suicide.
― Leo Tolstoy
I wanted to wear what is comfortable not what is convention, whether to a wedding or funeral or to temple. I didn't see any point in wearing something not comfortable to a wedding just because it's what accepted by society. I had no clue as to how my choices affect other people because I did not grow up interacting with many people in the society nor exposed to social issues.
Individualism and Collectivism and Me trying to learn them
Harmony - Photograph @ Watford, UK. 2009 © JEYARAMJ.COM

When my family move to Colombo, I was forced to deal with many issues I had no knowledge of handling.  Mainly because I didn't understand why people do what they do. The expectation in our collectivist society is that when everyone says yes, you say yes. Initially, the issue of having to say yes when the group say yes tormented me. I could remember many situations I couldn't stand being a part of a group; in the school; in tuitions. Frustration, angry, disappointment and sadness were the emotions as a result of not being able to adapt to a place where collectivism runs. Sri Lanka is mostly a collectivist country, not much of an individualist country. This struggle continued about half a decade. To learn the realities and familiarize myself with social and cultural practices, and to make some friends, only I know how much I had to suffer and sacrifice.

On the bright side, pursuing to know new things and trying understand social stigmas gave me difference experience about things and people. In this regard, there is a range of metaphysical (the branch of philosophy that talks about the principles of things, including abstract concepts such as being, knowing, identity, time, and space.) subjects caught my attention.  I started finding information on anything relating to the issues I found difficult to deal with; starting with interpersonal skill development to psychology and social norms. Only in my early twenties, I started to understand that how other people think of me affects me a great deal, positively or negatively.

From a range of interesting topics in metaphysics, I thought of typing (not writing:) ) post on individualism and collectivism from the tiny bit l learnt and from the book I read nowadays. Baboon Metaphysics by Dorothy L. Cheney & Robert M. Seyfarth is one of the most interesting books I could suggest you read which talks about Human life and how it is conducted within a network of social relations, social groups, and societies.

Now.,  Individualism is the idea that the individual’s life belongs to him and that he has an inalienable right to live it as he sees fit, to act on his own judgement, to keep and use the product of his effort, and to pursue the values of his choosing. Collectivism is the idea that the individual’s life belongs not to him but to the group or society of which he is merely a part, that he has no rights, and that he must sacrifice his values and goals for the group’s “greater good.” According to collectivism, the group or society is the basic unit of moral concern, and the individual is of value only insofar as he serves the group.  (https://www.theobjectivestandard.com/issues/2012-spring/individualism-collectivism/ , Accessed 4th Oct 2014)

Yet there are still people who confuse individualism and selfishness.
― Albert Camus

In our society, in Sri Lanka, or in the world, I have no rights except those which society permits me to enjoy. From the day we were born till the day we die the society permits us to enjoy certain things so-called rights and deprives the others. We don't have a choice but to obey these as we all have to live sharing this one earth. I do not have a problem with the fact that there are rules or we can't do certain things for a greater good of the community. I could very well understand that it's almost impossible to live without rules. But the conceptual deference between individualism and collectivism is not about whether to have rules or not, it's about how well we could act on our own or question authorities.
Individualism and Collectivism and Me trying to learn them
Harmony - Photograph @ Gampaha, LK. 2012 © JEYARAMJ.COM

Every single day we are controlled, monitored, judged, manipulated and punished or awarded by authorities, leaders, governments and corporations.  From the day we are born, we are brain washed to act in a certain way. This type of conditioning allow many of us to limit ourselves and kept in dark that we have to go through very negative things that otherwise we wouldn't go through. What am I talking about now? Let me try to list some of the things I find irritating because of the group pressure or because there is a tiny bit of collectivist social behaviours or some other social conventions.

  1. In one of the projects I was working for we had a new manager. On the first day, he had a meeting with us and told "I want to talk to those engineers who say I can't test reasoning that it's QA job. I want to talk to those who say I can't do managerial work because it's managers Job. I don't like to keep people in my project those who are not willing to work with others and share the workload… ". Most of our team members who were refusing to do any managerial jobs or testing jobs were quite and ever since we had the meeting we had to do few managerial things.  If he had told me this in person, I would have definitely given him an explanation saying why it's not a good idea. None of us told anything objecting our new manager because, I believe, it's the bystander apathy psychologist talk about.  Sometime I have had wished that I had told the manager that we can't,  when I had urgent development works to do and also had to do some of the managerial tasks we willingly undertook. This might not be an ideal example, yet the point is that sometime we willingly respect the authority and allow them to control us as a group we wouldn't do that as an individual.  Collectivist cultural background contributes to this kind of group behaviours, I believe. Collectivists believe that prioritizing group benefit over individual benefit creates harmony and betterment. Individualists believe that they are responsible for their own actions not the group, so prioritizing own benefit over group benefit is more appropriate.
  2. One of my school friends got married last April and our class mates were invited. I noted on my phone the date and location and forgot about the wedding till the notification pop-up on my phone. I requested a short leave from work, bought a gift and went to the wedding with the clothing I normally wear to work. I didn’t think even a little about what other people would dress or how I would be looked-at in the wedding. Every one of my class mates were wearing suits and were in one place as a group. They looked at me weird and asked me “what are you wearing?”. One of my friends told me that he called the others and found out that they will all wear suit. It was crazy for me to understand they had called everyone to know what they are going to wear for the wedding. The fact that they all were in the suit and I was in a denim and shirt made them feel uncomfortable to keep me in the group. It’s really surprising for me to understand how clothing could make people feel connected and how one person could become a stranger wearing different dress.  In this there is a dissonance between those who feel majority wearing the same and the one or two don't wear what the majority wears. I believe this is also might be because of the expectation from a member of a group should adhere to the group's values and practices.
  3. At work, whenever we have a meeting or any announcement from the management, most of our team members will be invited and at the end the discussion the person who holds the meeting or make an announcement will ask from us as to whether we have any questions.  Only a few of them ask some questions and others don't ask even if they had any question. It's definitely a cultural/racial thing I find among Sri Lankans, at least in the people I work with. Whenever I ask questions in the meetings or forums, I have my team mates coming and trying to comment negatively condemning that I ask the question or how stupid the question was or they knew how the management would answer backing the company. The fact that one person ask questions differentiate the person form the rest of them don't ask any questions.  There might be different reasons why this behaviour among our team members, but for a small degree that they don't like to ask question because the group doesn't encourage asking questions.
People in the collectivist countries tend to prioritize the group goals over individual ones. While this increases the harmony and connections between people, it is failing to question authorities and failing to look at the alternative views. This leads to a situation where fewer opportunities for constructive criticism and alternative ideas. This could be one of the reasons why we see fewer innovations in collectivist Asian countries than in the individualist western countries. This collectivist culture essentially ends up diminishing creativity and innovation, in my opinion. People should be allowed to question authorities, criticize, act on their own judgments, enjoy the fruits of their own labour without sacrificing the whole for the group and go outside the boundaries to invent new things. 


“The word "We" is as lime poured over men, which sets and hardens to stone, and crushes all beneath it, and that which is white and that which is black are lost equally in the grey of it. It is the word by which the depraved steal the virtue of the good, by which the weak steal the might of the strong, by which the fools steal the wisdom of the sages.
What is my joy if all hands, even the unclean, can reach into it? What is my wisdom, if even the fools can dictate to me? What is my freedom, if all creatures, even the botched and impotent, are my masters? What is my life, if I am but to bow, to agree and to obey?
But I am done with this creed of corruption.
I am done with the monster of "We," the word of serfdom, of plunder, of misery, falsehood and shame.
And now I see the face of god, and I raise this god over the earth, this god whom men have sought since men came into being, this god who will grant them joy and peace and pride.
This god, this one word:
"I.”
― Ayn Rand, Anthem




Farewell.

Sunday, April 20, 2014

Everything is a miracle

Last Wednesday morning, I wanted to go to work early, complete my tasks doing a fine job and wanted come home early to start organizing my things in our new rented house. The house move made everything out of order lately. So, it was a must that I had to do something about my slightly changed new life. I was able to realize that I was physically running out of energy and started feeling lazy and had no motivation to correct things. I was thinking that the recent rainy climate or the wounds I had in my knee for sometime now might have something to do with my laziness. As I start my day at work that morning, I was able to feel an extreme pain in my body and felt really cold, way too much than usually caused by the air conditioning system.
How illness makes me see the world
How illness makes me see the world

Immediately informed my colleagues, completed my morning tasks partially, had my breakfast at office and with a million things in my head decided to go home applying sick leave. Usually I'm not a person who prefer to go to doctor. I don't even remember the last time I went to see a doctor. I thought as most of my friends had virus fever in the recent past, I must have got the same. The virus fever I'm talking about stays for a week whether you like it or not; whether you take medicine or not and then disappears itself. A little rest would do the trick. All I was able to think was, how could I quickly let the week pass and get back to normal. I couldn't think very clearly due to the heavy fever and the agony caused by the fever. Just took my bike and got out of the office with the intention of just going home and sleeping.

Now that I come to think of it, about two weeks after, almost got through this dengue fever fiesta, it's an absolute miracle that I'm alive today. What are the odds that I'm alive today, really.. if we think of the places we should have been already dead, it's crazy. Let's me just try to only layout the possibility of me being alive surviving dengue.

  1. Deciding to go home without continuing to stay at office - 50 %.
  2. Deciding to go and take medicine without going home and sleeping - 50 %
  3. Deciding to go to doctor without just going to pharmacy and taking some medicines - 50 %
  4. The doctor I found being competent enough to figure out that this could be dengue and asking me to do a blood test for dengue and full blood count - 50 %
  5. Me actually going to take a blood test after two days - being a person never took a blood test and didn't think for a second that I might have dengue - Should actually be 1 %, but let's just say 50 %.
  6. Going back to the doctor with the believe that I don't have dengue and finding that I have dengue and low platelet count and getting admitted to the hospital - Again, should actually be less than 1 %, but let's just say 50 %.
  7. Having had enough platelet count that the hospital was able to saline my blood with NaCl (0.9% ) water and manage to get the platelet count increased. - 50 %
so, that makes 50% * 50% * 50% * 50% * 50% * 50% * 50% = 1/2 * 1/2 * 1/2 * 1/2 * 1/2 * 1/2 * 1/2 = 1/128. It's less than one percent.


Even if we leave the part "Go home without staying at office" which doesn't make much sense, I get roughly about 1/64 chance of not dying; 1/64 chance of being alive. :) 

Just for a second, if we really sit and think the situations we should have been dead, it would really freak us out and to let us start wonder that what it is keeps us safe from all those harms could have happened to us. Escaping from war, chikungunya, chickenpox, street accidents, natural disasters and etc.. Is there any internal brain functionality works and makes us choose the right things to keep us safe. I couldn't really understand. I like quotes a lot and specially Albert Einstein's quotes makes more sense to me in most cases. 
“There are only two ways to live your life. One is as though nothing is a miracle. The other is as though everything is a miracle.” 
― Albert Einstein
 The only thing I was allowed to do past couple of weeks is sleep(taking rest). The only thing I can do when I lay on the bed and find myself not able to sleep, think about things and get my brain tired to go sleep. There were some useful chain of thoughts and found myself few useful lessons to be learnt from dengue disaster. Please do not ignore the following, if you like to be happy.
  1. Kill every mosquito you see then and there. Buy a mosquito bat/spay or whatever it can kill mosquitoes.
  2. Kill everyone who ignore mosquitoes and doesn't want to do anything to get rid of them.
  3. Drink at least about 100 ml water or liquid every hour.
  4. Eat a lot of fruits and have a healthy diet.
  5. Take plenty of rest. Sleep enough.
    ( I sometimes try to run really fast without knowing where am I running. Now I have to remind myself to slow down and take rest. Stop, if needed. )
  6. Focused 6 hours of solid smart work is more productive than 10 hours of hard work with distractions.
  7. Exercise and meditate regularly.
  8. Remind all the good things we learnt in life all the time.
  9. Spend some time alone to think about the mysteries in life and see whether you can solve any.
“There is more to life than simply increasing its speed.” 
― Mahatma Gandhi
 Hope this post, my effort to kill some time writing something on my cool new tablet, might be useful/interesting to you. My sincere thanks to you for reading my posts. Farewell.

Saturday, March 8, 2014

Leadership, Communication & Motivation

I usually prefer to not write anything on leadership, management, motivation and the other similar topics as I wanted to keep myself as a person who absolutely has nothing to do with these things, however, the time has come to tell you:) what I think about these overrated L-word and the other cooperate holy words. I don’t know whether it's my friends; or the fact that ever since I started "ACTIV" with my friends, I’m on a constant look-out for successful organizations, leaders and many other related things; or the fact that we are being bombarded with the L-word by the corporate culture we all are voluntarily subscribed to; or the recent extreme attention to American MBAs and its managerial teachings in Sri Lanka; or the fact that most political, religious and corporate people use too often these cool words to make people actually believe that there is a hell of a lot they know... I just don’t know why I think about these things :). I have heard enough of these words, influenced enough by the people/education that talk about these worlds, watched videos on it and read enough LinkedIn articles on these things, now I actually want to develop these skills and quickly let you know what I think about Leadership, Communication & Motivation in this post.

Leadership 
A leader needs the guts to stand alone and look ridiculous. The key is he/she must be easy to follow! Leader needs followers. Following is more difficult than leading when the leader is not very capable of leading.  They publicly shows everyone how to follow. Notice the leader embraces him/her as an equal, so it's not about the leader anymore - it's about being a follower first. All the good leaders I had the pleasure working with use friendship as a tool to bridge the gap between leading and following and add real value to leadership. Notice he's calling to his friends to join in. It takes guts to be a first follower! You stand out and brave ridicule, yourself. Being a first follower is an under-appreciated form of leadership. The first follower transforms a lone nut into a leader. I read somewhere - If the leader is the flint, the first follower is the spark that makes the fire. You might be a person who's not so comfortable with the word follower, it's because people don't like to use the word follower(s) in the cooperate world. We like to use the word team, almost in every-places we want to use followers and we managed to make the word cooler. As I must have mentioned earlier, Leadership is over-glorified; so is team. So, leadership happens when you find a lone nut doing something great about something the nut really cares about(vision), have the guts to be the first person to stand up and join in. 1) have the vision 2) be public 3) be easy to follow 4) make some sense and be compact (Communication) 5) Have passion - make impossible possible ( Motivation ).


Communication 
It's really a border subject and way over my head to talk about, yet I'm going to continue. I had issues clearly telling my ideas to my friends at ACTIV. I can vividly remember telling my friend "It's clear in my head, but I don't know how I'm going to make you understand as exactly as is in my mind." I must have offended him saying so as his response was not very polite. Also, when the HR has nothing to avoid promoting you, they often magically make the word appear out of thin air and say "You need to develop your communication skills to get the promotion in the next cycle" - it wouldn't be a breach of the confidentially clause I signed, if I say that it really happened to me by an HR individual who had no knowledge what so ever of what I was doing in the company nor had the capacity to measure my skill sets. Most often, ideas has context, dependencies and a million related things you should know about to understand. When we try to communicate someone, it's really hard to assume that the person whom you're trying to communicate understand the context and he has the dependency knowledge. It's even harder, if we try to communicate to a person whom we don't know or we have to communicate to a group instead of one person. Some of the ideas take months even years to unconsciously build up and make sense. There will be a million small nuances that matter associated with our idea and when we try to tell others, it's almost always impossible and stressful. The purpose of communication is to get your message across to others clearly and unambiguously. Doing this involves effort from both the sender of the message and the receiver. And it's a process that can be fraught with error, with messages often misinterpreted by the recipient. When this isn't detected, it can cause tremendous confusion, wasted effort and missed opportunity. In fact, communication is only successful when both the sender and the receiver understand the same exact information as a result of the communication. By successfully getting your message across, you convey your thoughts and ideas effectively. When not successful, the thoughts and ideas that you convey do not necessarily reflect your own, causing a communications breakdown and creating roadblocks that stand in the way of your goals – both personally and professionally. Create and environment where everyone feel save to express ideas, opinion,  and feelings, or plan or problem solving in creative ways.

Its very true that most of what we communicate is not through by talking. Body language and our facial expressions carry a lot more than we think we do. There was a presentation given a us at the British Council Colombo and they had professionals to show us the ways an idea could be expressed differently. In my blog, I prefer to write my personal experience and my own view about the things I write rather than a general idea, so It would only be fair, if I tell you what makes me challenged/makes it difficult when it comes to communication. My experience is that when I work on codes(technical things/logical) too long and suddenly want to speak to somebody or speak about the code I was working on, I often struggle to talk. Even the most frequently spoken words will slip away from my mind for a while. May be it's just that my left brain was constantly getting the resources allocated and suddenly when I try to wake my right brain, it crashes or something.. :) I have no scientific facts to back me up on this, yet I have convinced myself with my theory on this.

Motivation - Motivation is literally the desire to do things. More than half of the morning emails I read on this and Google plus posts should make me an expert on this subject. When I have a clear reason to do something or inner desire to want something, I'm so motivated - It's just that simple. To motivate myself, I just need to convince myself with some reasoning or I need a prove of; if I do this, I'll get this. Of cause, that the common reasoning process of a human mind consciously. And there is more..

Motivation is defined as the process that initiates, guides and maintains goal-oriented behaviors. Motivation is what causes us to act, whether it is getting a glass of water to reduce thirst or reading a book to gain knowledge. It involves the biological, emotional, social and cognitive forces that activate behavior. 

The above is the extract of the first five links for a Google search. Further the articles read that a number of different theories of motivation, including drive theory, instinct theory and humanistic theory. There are three major components to motivation: activation, persistence and intensity. Different types of motivation are frequently described as being either extrinsic or intrinsic. Extrinsic motivations are those that arise from outside of the individual and often involve rewards such as trophies, money, social recognition or praise. Intrinsic motivations are those that arise from within the individual, such as doing a complicated cross-word puzzle purely for the personal gratification of solving a problem.

Who needs forced motivation? Someone who does something he/she doesn't like. I'm talking about the motivational trainings motivational speaks do. I can speak for myself here as I, myself have attended few trainings, that they actually do work/help us get motivated. They help us find the reasons and help us figure out why we do what we do.  Research shows you can influence your own levels of motivation and self-control. So figure out what you want, power through the pain period, and start being who you want to be. Goal Setting is extremely important to motivation and success.  Certainly, we need some intelligence, knowledge base, study skills, and time management skills, but if we don't have motivation, I don't think we will go get far.

Motivation is the force that initiates, guides and maintains goal-oriented behaviors. It is what causes us to take action, whether to grab a snack to reduce hunger or enroll in college to earn a degree. The forces that lie beneath motivation can be biological, social, emotional or cognitive in nature.

I find the blow very useful and is from about.com/od/motivation.

William James has created a list of human instincts that included such things as attachment, play, shame, anger, fear, shyness, modesty and love. The main problem with this theory is that it did not really explain behavior, it just described it. By the 1920s, instinct theories were pushed aside in favor of other motivational theories, but contemporary evolutionary psychologists still study the influence of genetics and heredity on human behavior.
Incentive Theory of Motivation
The incentive theory suggests that people are motivated to do things because of external rewards. For example, you might be motivated to go to work each day for the monetary reward of being paid. Behavioral learning concepts such as association and reinforcement play an important role in this theory of motivation.
Drive Theory of Motivation
According to the drive theory of motivation, people are motivated to take certain actions in order to reduce the internal tension that is caused by unmet needs. For example, you might be motivated to drink a glass of water in order to reduce the internal state of thirst. This theory is useful in explaining behaviors that have a strong biological component, such as hunger or thirst. The problem with the drive theory of motivation is that these behaviors are not always motivated purely by physiological needs. For example, people often eat even when they are not really hungry.
Arousal Theory of Motivation
The arousal theory of motivation suggests that people take certain actions to either decrease or increase levels of arousal. When arousal levels get too low, for example, a person might watch and exciting movie or go for a jog. When arousal levels get too high, on the other hand, a person would probably look for ways to relax such as meditating or reading a book. According to this theory, we are motivated to maintain an optimal level of arousal, although this level can vary based on the individual or the situation.
Humanistic Theory of Motivation
Humanistic theories of motivation are based on the idea that people also have strong cognitive reasons to perform various actions. This is famously illustrated in Abraham Maslow's hierarchy of needs, which presents different motivations at different levels. First, people are motivated to fulfill basic biological needs for food and shelter, as well as those of safety, love and esteem. Once the lower level needs have been met, the primary motivator becomes the need for self-actualization, or the desire to fulfill one's individual potential.

Also, personal preferences and circumstances have a huge impact on motivational levels. I believe prioritizing and having a plan is as important as being motivated to do something to succeed. A fun example, I want to go to gym badly and I'm motivated, yet I couldn't go as there are other important things I had to take care time-to-time (I can hear u say: poooh, like what? :p anyways) there are days I really do have things stopping me to go to the gym and that irregularity demotivates me to go to gym.

----

There are many more similar things I would like to write and share with you - like, what is the deference between going to a five star hotel wearing a suit to spend a hundred rupees and going with a dirty t-shirt and spending a few grands; the psychology behind it and my experience on that. But, I just ran out of motivation to write more, so let me power-up my motivational level and write on the next post. FAREWELL 'TIL NEXT TIME.

Wednesday, January 15, 2014

Clean Coding Techniques and Best Programming Practices

One of my favourite things to do when I'm free is open a code file from one of the best known open source projects and look at the code. Some of them programmers are truly amazing in writing codes applying the best coding practices and use OOP concepts. There are many good ways to architect and design a system depending on the size of the project. Those days, I was working on many small projects and now have the opportunity to work in fairly big scale projects and when I see the deferences and techniques used comparing to the small projects, I understand how clever some of these software engineering human beings are. Some of my colleagues could explain me, a complex concept I wouldn't understand reading books, in few minutes. Learning and understanding some fascinating facts form superiors while working's very valuable.  Sometime a line could explain you whole lot than a whole page ever could explain. Example ha?..
“ Java is to JavaScript what Car is to Carpet. ” - Chris Heilmann
If you look at the code someone new written in your project, you will understand when I explain you the feeling of trying to swallow your food for lunch after looking at the code. On the other hand, some people just know how to make a bouquet out of a few code files. What I'm trying to get you to agree is that some projects are really a joy to work on just because of the way it's been designed, coded, managed and some projects are pain to work on.

As a programmer, it's very important for me to understand the basic concepts well and to use best practices out there. Ever since I sat for a lecture in Dr Even's class, I'm keen on learning these best practices and want to code like a pro. He teaches while writing codes like writing emails. The way he structures code, put them into different files with meaningful file names and getting it working; it's truly mesmerizing experience. He's able to show us examples of simple code to carry complex functionality. To be able write simple code to do complex things would be one the thing I really wanted to be good. So, whenever I come across articles about coding best practices and code samples, I add to my pocket and this post is a sum-up of the collection.

Clean Coding Techniques and Best Programming Practices
“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - Martin Golding
COUPLING & COHESION

I really started to understand the importance of Coupling and Cohesion only after I started working for big projects and started seeing the deference. For this post sake, let's look at a little on this. Also, for my learning too, I'm going to browse my  pocket links on this topic and many other relevant topics and copy them here. I'll try to put all the links I referred for this post. I usually doesn't like to copy other people's work here, yet I don't think I have to re-write something is been already written nicely in books or in websites. I wanted to remind some of these things, so, I'm going to go through and whatever I find useful in these area, I'm going to copy here. Simple - ha?:)

Coupling is an indication of the strength of interconnections between program units. Highly coupled have program units dependent on each other. Loosely coupled are made up of units that are independent or almost independent. When I start writing code in the beginning, most the function or components I write will call other functions and they're interconnected. When I try to modify something, it's really a headache. After a while, if we look at the code, It's really a challenge to understand the code and modify and these changes are pron to many code breaks.

“ Before software can be reusable it first has to be usable. ” - Ralph Johnson

Obviously, it very hard to keep functions totally independent and in many cases, it's almost impossible to have modules completely independent of each other. The more connections between functions, the more dependency and more issues later. It wouldn't make much of a deference if it's a small project and absolutely no requirement to upgrade it in the future.

According to Clarlson, there are three factors: number of interfaces, complexity of interfaces, type of info flow along interfaces.

Want to minimize number of interfaces between modules, minimize the complexity of each interface, and control the type of info flow. An interface of a module is used to pass information to and from other modules. In general, modules tightly coupled if they use shared variables or if they exchange control info. Loose coupling if info held within a unit and interface with other units via parameter lists. Tight coupling if shared global data. If need only one field of a record, don't pass entire record. Keep interface as simple and small as possible.

Two types of info flow: data or control.

Passing or receiving back control info means that the action of the module will depend on this control info, which makes it difficult to understand the module. Interfaces with only data communication result in lowest degree of coupling, followed by interfaces that only transfer control data. Highest if data is hybrid. 

Ranked highest to lowest: 
Content coupling:
If one directly references the contents of the other. When one module modifies local data values or instructions in another module. (can happen in assembly language) if one refers to local data in another module. if one branches into a local label of another.
Common coupling:
Access to global data. modules bound together by global data structures.
Control coupling:
Passing control flags (as parameters or globals) so that one module controls the sequence of processing steps in another module. 
Stamp coupling:
Similar to common coupling except that global variables are shared selectively among routines that require the data. E.g., packages in Ada. More desirable than common coupling because fewer modules will have to be modified if a shared data structure is modified. Pass entire data structure but need only parts of it.
Data coupling:
Use of parameter lists to pass data items between routines.

Cohesion

Cohesion is the measure of how well module fits together. A component should implement a single logical function or single logical entity. All the parts should contribute to the implementation.

Many levels of cohesion: 

Coincidental cohesion: 
The parts of a component are not related but simply bundled into a single component. harder to understand and not reusable.
Logical association: 
Similar functions such as input, error handling, etc. put together. Functions fall in same logical class. May pass a flag to determine which ones executed.
interface difficult to understand. Code for more than one function may be intertwined, leading to severe maintenance problems. Difficult to reuse
Temporal cohesion:
All of statements activated at a single time, such as start up or shut down, are brought together. Initialization, clean up.
Functions weakly related to one another, but more strongly related to functions in other modules so may need to change lots of modules when do maintenance.
Procedural cohesion: 
A single control sequence, e.g., a loop or sequence of decision statements. Often cuts across functional lines. May contain only part of a complete function or parts of several functions.
Functions still weakly connected, and again unlikely to be reusable in another product.
Communicational cohesion:
Operate on same input data or produce same output data. May be performing more than one function. Generally acceptable if alternate structures with higher cohesion cannot be easily identified.
still problems with reusability.
Sequential cohesion:
Output from one part serves as input for another part. May contain several functions or parts of different functions.
Informational cohesion:
Performs a number of functions, each with its own entry point, with independent code for each function, all performed on same data structure. Different than logical cohesion because functions not intertwined.
Functional cohesion: each part necessary for execution of a single function. e.g., compute square root or sort the array. Usually reusable in other contexts. Maintenance easier.
Type cohesion: 
Modules that support a data abstraction.
Not strictly a linear scale. Functional much stronger than rest while first two much weaker than others. Often many levels may be applicable when considering two elements of a module. Cohesion of module considered as highest level of cohesion that is applicable to all elements in the module.

Ref: http://courses.cs.washington.edu/courses/cse403/96sp/coupling-cohesion.html - Thanks: Adam Carlson


Coding Standards and Code Reviews

Using good programming practices to create high quality code is important to produce quality software with high performance. A comprehensive coding standard encompasses all aspects of code construction and, while developers should exercise prudence in its implementation, it should be closely followed. Completed source code should reflect a harmonized style, as if a single developer wrote the code in one session. Adherence to a coding standard can only be feasible when followed throughout the software project from inception to completion. It is not practical, nor is it prudent, to impose a coding standard after the fact. Coding techniques incorporate many facets of software development and, although they usually have no impact on the functionality of the application, they contribute to an improved comprehension of source code. For the purpose of this document, all forms of source code are considered, including programming, scripting, markup, and query languages.

“Measuring programming progress by lines of code is like measuring aircraft building progress by weight.”
- Bill Gates  (co-founder of Microsoft)

When you write code, consider the following to improve performance, keep the coding clean and to reduce run time exceptions.

  • Declare All Variables - In some programming languages, like in JavaScript or in C#. A variable that is not declared will be created with a default type. Normally it will be implicitly created as a Variant. 
  • Avoid elusive names that are open to subjective interpretation, such as Analyze() for a routine, or jjK4 for a variable. Such names contribute to ambiguity more than abstraction.
  • In object-oriented languages, it is redundant to include class names in the name of class properties, such as Book.BookTitle. Instead, use Book.Title.
  • Use the verb-noun method for naming routines that perform some operation on a given object, such as CalculateInvoiceTotal().
  • In languages that permit function overloading, all overloads should perform a similar function. For those languages that do not permit function overloading, establish a naming standard that relates similar functions.
  • Use Strongly Typed Object Variables - Object variables represent pointers to COM objects. They can be declared in two ways, as follows: 
    • When you defect a variable As Object in Java or C# that variable can be used to represent any kind of object; this is a weakly typed object variable
    • Use the As keyword with the specific type of the object; this is a strongly typed object variable.
  • Names - Perhaps one of the most influential aids to understanding the logical flow of an application is how the various elements of the application are named. A name should tell "what" rather than "how." By avoiding names that expose the underlying implementation, which can change, you preserve a layer of abstraction that simplifies the complexity. For example, you could use GetNextStudent() instead of GetNextArrayElement().
  • Append computation qualifiers (Avg, Sum, Min, Max, Index) to the end of a variable name where appropriate.
  • Use customary opposite pairs in variable names, such as min/max, begin/end, and open/close.
  • Since most names are constructed by concatenating several words together, use mixed-case formatting to simplify reading them. In addition, to help distinguish between variables and routines/functions, use Pascal casing (CalculateInvoiceTotal) for routine/functions names where the first letter of each word is capitalized. For variable names, use camel casing (documentFormatType) where the first letter of each word except the first is capitalized.
  • Boolean variable names should contain Is which implies Yes/No or True/False values, such as fileIsFound.
  • Avoid using terms such as Flag when naming status variables, which differ from Boolean variables in that they may have more than two possible values. Instead of documentFlag, use a more descriptive name such as documentFormatType.
  • Even for a short-lived variable that may appear in only a few lines of code, still use a meaningful name. Use single-letter variable names, such as i, or j, for short-loop indexes only.
  • If using Charles Simonyi's Hungarian Naming Convention, or some derivative thereof, develop a list of standard prefixes for the project to help developers consistently name variables. For more information, see "Hungarian Notation."
  • For variable names, it is sometimes useful to include notation that indicates the scope of the variable, such as prefixing a g_ for global variables and m_ for module-level variables in Microsoft Visual Basic®.
  • Constants should be all uppercase with underscores between words, such as NUM_DAYS_IN_WEEK. Also, begin groups of enumerated types with a common prefix, such as FONT_ARIAL and FONT_ROMAN.
  • A tenet of naming is that difficulty in selecting a proper name may indicate that you need to further analyze or define the purpose of an item. Make names long enough to be meaningful but short enough to avoid being wordy. Programmatically, a unique name serves only to differentiate one item from another. Expressive names function as an aid to the human reader; therefore, it makes sense to provide a name that the human reader can comprehend. However, be certain that the names chosen are in compliance with the applicable language's rules and standards.
  • When naming tables, express the name in the singular form. For example, use Employee instead of Employees.
  • When naming columns of tables, do not repeat the table name; for example, avoid having a field called EmployeeLastName in a table called Employee.
  • Do not incorporate the data type in the name of a column. This will reduce the amount of work needed should it become necessary to change the data type later.
  • In Microsoft SQL Server, do not prefix stored procedures with sp_, because this prefix is reserved for identifying system-stored procedures.
  • In Transact-SQL, do not prefix variables with @@, which should be reserved for truly global variables such as @@IDENTITY.
  • Minimize the use of abbreviations. If abbreviations are used, be consistent in their use. An abbreviation should have only one meaning and likewise, each abbreviated word should have only one abbreviation. For example, if using min to abbreviate minimum, do so everywhere and do not later use it to abbreviate minute.
  • When naming functions, include a description of the value being returned, such as GetCurrentWindowName().
  • File and folder names, like procedure names, should accurately describe what purpose they serve.
  • Avoid reusing names for different elements, such as a routine called ProcessSales() and a variable called iProcessSales.
  • Avoid homonyms when naming elements to prevent confusion during code reviews, such as write and right.
  • When naming elements, avoid using commonly misspelled words. Also, be aware of differences that exist between American and British English, such as color/colour and check/cheque.
  • Avoid using typographical marks to identify data types, such as $ for strings or % for integers.
  • When it come to Comments, Software documentation exists in two forms, external and internal. External documentation is maintained outside of the source code, such as specifications, help files, and design documents. Internal documentation is composed of comments that developers write within the source code at development time.
  • One of the challenges of software documentation is ensuring that the comments are maintained and updated in parallel with the source code. Although properly commenting source code serves no purpose at run time, it is invaluable to a developer who must maintain a particularly intricate or cumbersome piece of software.
  • Following are recommended commenting techniques:
  • When modifying code, always keep the commenting around it up to date.
  • At the beginning of every routine, it is helpful to provide standard, boilerplate comments, indicating the routine's purpose, assumptions, and limitations. A boilerplate comment should be a brief introduction to understand why the routine exists and what it can do.
  • Avoid adding comments at the end of a line of code; end-line comments make code more difficult to read. However, end-line comments are appropriate when annotating variable declarations. In this case, align all end-line comments at a common tab stop.
  • Avoid using clutter comments, such as an entire line of asterisks. Instead, use white space to separate comments from code.
  • Avoid surrounding a block comment with a typographical frame. It may look attractive, but it is difficult to maintain.
  • Prior to deployment, remove all temporary or extraneous comments to avoid confusion during future maintenance work.
  • If you need comments to explain a complex section of code, examine the code to determine if you should rewrite it. If at all possible, do not document bad code—rewrite it. Although performance should not typically be sacrificed to make the code simpler for human consumption, a balance must be maintained between performance and maintainability.
  • Use complete sentences when writing comments. Comments should clarify the code, not add ambiguity.
  • Comment as you code, because most likely there won't be time to do it later. Also, should you get a chance to revisit code you've written, that which is obvious today probably won't be obvious six weeks from now.
  • Avoid the use of superfluous or inappropriate comments, such as humorous sidebar remarks.
  • Use comments to explain the intent of the code. They should not serve as inline translations of the code.
  • Comment anything that is not readily obvious in the code.
  • To prevent recurring problems, always use comments on bug fixes and work-around code, especially in a team environment.
  • Use comments on code that consists of loops and logic branches. These are key areas that will assist the reader when reading source code.
  • Separate comments from comment delimiters with white space. Doing so will make comments stand out and easier to locate when viewed without color clues.
  • Throughout the application, construct comments using a uniform style, with consistent punctuation and structure.
  • Despite the availability of external documentation, source code listings should be able to stand on their own because hard-copy documentation can be misplaced.
  • External documentation should consist of specifications, design documents, change requests, bug history, and the coding standard that was used.
  • Formatting makes the logical organization of the code stand out. Taking the time to ensure that the source code is formatted in a consistent, logical manner is helpful to yourself and to other developers who must decipher the source code.
Ref: http://msdn.microsoft.com/en-us/library/aa260844(v=vs.60).aspx Thanks: Rob Caron - Microsoft Corporation

Hope I shared something useful to you today and I'm going to end this post giving a tip from my experience to those who want to freelance work by quoting Edward V Berard  -
”Walking on water and developing software from a specification are easy if both are frozen.”