Around 7 years ago, I was speaking at a conference, and in between sessions, my mind drifted to how can I teach people what I have learned being a software engineer for 20 years instead of the latest framework or new version of .NET. I set out to do just that since what I wanted to teach is what I wish someone taught me when I was a beginner. With that said, I was lucky enough to find jobs and teams where I learned good programming practices early on that I still use today. I know not everyone has this experience, so I wanted to improve that. Writing and speaking at conferences, user groups, and companies is how I wanted to disseminate this to others along with custom-produced DVDs and videos.
Also around this timeframe, I wanted to make my conference sessions more memorable by having a theme or what others have called a “brand”. This is when I added rock ‘n roll music and graphic arts/ photography to each session (two of my passions since I was a child) and I have done it with my books also (this photo was taken performing at a conference in the country of Mauritius). There is a purpose behind this that I will discuss later in this article. Also around this time, I came up with a new tag line that I use on my website “Improving Code Quality… One Developer at a Time” that I will also discuss later.
Turning My Experience into Sessions and Writings
During this period, I thought that just about anyone can give a session on a new framework or language but trying to teach “experience” has been a labor of love and it has turned out to be difficult to do. Therefore,
I am asking how I am doing? All my books, writing and conference sessions (except for my technical interview book and workshop) have been wrapped around this concept that specifically targets code quality and code/ application performance. Both topics I do not see done very well or at all at far too many companies in America.
Most teams usually run out and purchase my
coding standards book when they hire me. Now that I am currently looking for a new position, I should make that a requirement! That would be a great sign that the team cares about this and I only want to work for teams who do.
Real-World Examples & Solutions
In most conference sessions and even in what I read, I am usually left feeling “Okay, what you talked about is interesting, but how do I apply it in the real world?”. This is something I feel most forget to show or discuss. For example, showing how you used a framework to build a calculator, is not much help for me in the real world. For me, the “real world” focuses on writing solutions for businesses to sell or use internally. The original tag line that I still use in logos for my website is: “Real World Tips & Tricks” since my goal has always been to teach a software engineer something they can use today and how I did just that. I go to great lengths to make sure that I do this in everything I do, which does take a lot of thought and work.
I Do This Even When Teaching College-Level Classes
For example, when
Microsoft Ajax came out, I developed a brand-new class for it at the University of California San Diego. One of the things I noticed with engineers who took my classes in the past was that they never created a new project or solution from scratch. Due to this, I decided to move away from one-off lab projects to lab projects that would keep adding to themselves and would be the basis for their final project grade (60% of their grade). My goal with these labs and the final project would be to create an app that they could turn around and use at their workplace.
The ASP.NET website that I designed for them would monitor activity on a server. I am not sure if any of my students used their project at work, but before the second week of class, one of my students came up to me before class and she said to me “Man Dave, that first lab was really tough, since I have never created a website from scratch!”. And yes, if you never created a web project before, it was tough. Exactly why I did that. This was an advanced class and an elective they could choose to take to complete our certificate.
Some of my students might not agree with is that I never did anything in my classes to boost my ego to prove I am smarter than them. I just wanted them to become great engineers and I do hope they are smarter than me! For example, any tests they took, I made them write out code by hand. What?!?! Yes, I did that because it is proven that people learn better if they write something by hand. Another reason I am against blindly copying and pasting code from sites like Stack Overflow. Once when I was visiting Microsoft, I jokingly asked the Visual Studio team to disable paste! I am still waiting for that one! They should do that as an April Fool’s joke someday and see what happens.
Improving Code Quality… One Developer at a Time™
Around the time I came up with this new theme for my sessions and writing, I came up with a new slogan, “Improving Code Quality… One Developer at a Time”. What I mean by this is that if I can instill good coding practices when I teach, speak or write and change just one developer, then I call that a success! I’ve learned the hard way during my career is that you can’t please everyone, so I only go after engineers who want to change or be better.
Of course, I hope that everyone sees the light (especially for my books), then I can help them in their software engineering career. My road in this career has not been easy so I want to make other's journey easier so they can earn a good living for themselves and their family, have less stress, have fun and have a life outside of coding!
I’m An Angry Older Programmer?
Back in 2017 after doing a keynote at a conference in Denver, Colorado, when I came back, I wrote an article called “
Confessions of an Angry Programmer” (my most popular article on this site). The reason I did this was after my keynote, one of the attendees there tweeted that I’m an “angry old programmer”. Unfortunately, he mistook my passion for anger. But yes I am outraged about the lack of code quality that I see since it feels it’s not getting better but worse (something I will discuss more in an upcoming article).
When a solution that is in production has a code violation every 13 lines of code, is not acceptable to me and it should have never been released. In my experience, this is the norm, unless I have a say about it. So all I can do is to be passionate about code quality, not angry. I can’t make teams practice good coding standards and practices, I can only show them the way. It’s up to them to make that a priority for their team. If this is important to you and not your team, it’s time to find a new position. I have found management at many companies that have worked don’t care since it’s not a feature they can sell. I have yet to see in advertising,
Our software features 0 errors and 0 warnings!
I have said to engineers until I am blue in the face that everyone above you does not care about code quality. They just want to “ship it” and get their bonuses! They do not care about unit testing and more, so it is up to you to push it for your team. But you, being the developer, will be left holding the bag if something goes wrong, not management that could lead to you losing your job. Even worse, when major changes must be made that causes you to a lot of re-writing of the code, management will get upset that it is taking so long. Therefore, proper architecture standards are so important. Every app that goes into production must at a minimum have the following,
Architecture
If you just sit down and just start coding, STOP! There should be a lot of time allotted for architecture. All the most successful applications that I have done have had proper architecture. Heck, one even got patented. I remember for one of my successful projects I spent the better part of three months architecting just the data models that would make it easy to understand and be used by our partners since it was important to me and my boss to not expose the terrible design of the database (done years before I got there).
Coding standards
99% of every company I have started to work at does not have any standards, so it is like the wild, wild west when it comes to trying to understand the code and more. Using contractors compounds this issue. This is the main reason I released the first version of my coding standards book back in 2005. It is still the only 100% coding standards book for .NET. Sadly, only a few of those companies have purchased my book for all their engineers. Do not forget documentation of your types, very important!
Unit testing and more unit testing
Unit tests are a requirement for every solution. All solutions should strive for 100% code coverage for any class that is marked as public, 75% for the rest. Here is a rule you should live by every method should have a least the same number of unit tests as its cyclomatic complexity value JUST TO TEST ENCAPSULATION, the #1 pillar of object-oriented programming. For a recent
article that I wrote, I showed that the solution has a cyclomatic complexity of 20,675 but only 249 unit tests! I would never use this library due to this. A company I worked at in the past had over one million lines of source and not a single unit test. For one of the features I architected, I put in the time to create unit tests, but the manager removed them all since they did not meet the deadline. Therefore, that is why now my estimates are usually more than from other engineers since I take all of this into account. It is part of coding.
Continuous Integration
This must be set up for the solution, usually at the repository level using tools such as GitHub. How many times have you gotten the latest from the repository and it does not even build and causes a work stoppage? Therefore, CI is so important. Doing this will also uncover other issues your project might have. Never again will an engineer say, “It works on my machine!”.
Application testing
Depending on what type of the app is, it is imperative to do end-to-end application testing which includes regression testing. Testing apps like this has never been very easy! Your team should strive to take this time to set up automated tests as much as possible, and do not rely on humans, especially for large applications. Developers should never do this but should instead be done by the quality assurance team. In one team I worked in, we were able to hire someone who loved automated testing, and this made a world of difference. You should do the same in your team. I would love to work with this person again in the future.
Proper environments
All teams should be using at least three environments to work with (that match as much as possible) for their applications and services. They are:
- Development (DEV) for use by engineers only. If the application uses databases, these should, as much as possible, be duplicated from production either on a weekly or daily basis. My preference would be daily.
- User Acceptance (UAT) for use by the quality assurance team and the top users. Applications should never be deployed from DEV or an engineer’s computer!
- Production (PROD) for use by the users. Engineers should never have access to this environment, only by DevOps. The only caveat to this is that engineers should have access to production server status and any logs that are produced. The logs have been an issue in the past but using something like Azure Application Insights or Raygun makes this very easy. Engineers cannot rapidly respond to issues without this type of information.
Memory Profiling
So far, I have yet to work for a company that does this unless I am there. Sadly, at a contract I worked on, the company refused to let me do this. The ONLY way to find all issues with the code that includes memory issues, is to run a memory profiler on the application running on a near-to-production environment. These tools can be inexpensive.
The one I recommend is only $430/ € 350 and will pay for itself the very first time you use it! Also, not every developer needs a license, just the ones who know how to analyze the results who are usually the most senior engineers. I have spoken and written about memory profilers many, many times. Before the release of a product version or a new feature, I run a memory profiler unless the company will not pay me for that. I will warn you that tracking down issues from the report that the memory profiler produces can be very time-consuming, depending on who is reading it. So do not wait until the end to start on it!
There is more to this subject, but to me, these are the minimum for any released application. So yes, I do get upset when teams do not do this or will not. I hope that you will get upset in the future if you work on a team that misses any of these seven items. Since we all are users of software, we all should care about this… A LOT.
Accidentally Creating a Brand
Around 7 years ago is also when I decided to add a rock n’ roll theme to my sessions, I didn’t realize I was creating a brand (until someone told me so). I first just added music videos that I played before my sessions. The main reason I did this is that software engineering conference can be dull, and I wanted to get my attendees in a different pumped-up mood before they had to listen to me for an hour or more! What I did not realize in the beginning is that these videos got me amped up and got my endorphins going.
My main goal was to get them to pay attention for the entire length of the session. If they start checking their cell phones, I have lost them. Since I have been speaking for over 27 years, I have developed methods to get them to pay attention. Some of them are,
- I never sit in front of a computer; I always stand and walk (3 miles/ 5km per hour).
- My sessions are completely automated, including the demos (videos). I can do the entire presentation without ever touching my computer.
- Most of the time I look at the audience so I can gauge how I am doing by their expressions.
- I engage the audience by answering and asking questions.
- And much more.
I do plan to write about my methods of speaking in the future. Then I started throwing out custom guitar picks to the audience and more. I created rock n’ roll outfits for when I speak. In the beginning, I even wore boots like the members of the band KISS does (which I towered over everyone)! I know this method does not please everyone, but it has worked out great for me and is why I now have a brand that even an American conference tried to steal. Then I added playing guitar before or after my sessions if the conference allows it.
The most memorable experience of doing this is hands down the annual C# Corner Conference where they have me smash a guitar at the end and throw out the pieces to the audience. So much fun to act like a real rock start for about 15 minutes!
Looking Towards the Future
As I am writing this article, more and more Americans are getting their COVID shots so I cannot wait to get out there and speak more… I have been going through withdrawal for over 1.5 years! With that said, at this point, I do not have plans to change what I am speaking or writing about. Seven years ago, I thought that if I put a lot of effort into what I want to teach you, it would help improve code quality and performance, but I am not seeing it out there in the real world, so I will keep at it until I do!
This has been the point of this article; I want to hear from you! Should I keep with these subjects or others? Has what I spoke about or written about in the past seven years help you or your team? Since I do not get a lot of feedback, I directly asking…
What would help you and your team in the future?
There are a lot of things happening in our world, too many for me to cover all of them, nor am I an expert in everything! I know many of you are introverts (like me), do not like to ask questions or speak up (unlike me), but I promise that I will read all feedback I get and will put thought towards it to see if it will fit with what I am passionate about. This world is a lot more complex than when I started over 27 years ago.
Summary
Before I end this article, I want to bring up my weekly live show on C# Corner Live called Rockin’ the Code World with dotNetDave. I have been working hard at this show to bring you the experts in our industry, including VIPs from Microsoft to talk about anything related to software engineering. You can go here to view the
past episodes and register for the upcoming shows. I am averaging over 5K viewers for each episode, so I hope you check them out soon!
Now it is time for you to let me know
your thoughts so I can bring you the best sessions and writing possible! Please comment below or email me directly at
[email protected].