When “OK” means “Cancel”…and “Cancel” means “OK”

Looks like it's Opposite day every day at tvlinksdb.com

Looks like it's opposite day at TVLinksDB.com

When a user is trying to cancel an application installed through a pop up window, they are faced with this  dialog box prompting the user to click “Okay to cancel the installation”,  or “Cancel to continue the installation.” Wouldn’t a simple Yes/No answers be easier to understand?

30 seconds to make your code more understandable, organized, and easily debugged

So we spend days, weeks, months, maybe even years thinking of names for children…However this is not always the case for variable, method, or class names when programming.   But naming is still a powerful tool which gets overlooked in programming. Taking the extra 30 seconds (or as sometimes for me 20 minutes…) to think of a good name can save not only you time but also other developers time in the future for understanding your code.

Representation

So lets say you are coding and working with variables “x” or “asd”. What do these represent? They could be anything. But let’s say instead we chose a more descriptive name like numOfCustomers or getBackground(), which now we know *exactly* what the variable represents and also what the functions does.  This makes reasoning about your code easier not only for other programmers in the future (or you looking back in a few months), but also for you right now as you are reasoning about your code.   This of course extends to your methods, classes etc…

Variable Case

Also, when naming your variables, case can be helpful as well. First of all, choosing a good way to pick upper and lower case variables for your methods can make your code a lot more readable.  For each language there are specific conventions thare are used.  For example, when looking at someone’s Java code, if you notice a variable in all capital letters, it usually means that it’s a constant. That also means that  other developers might be expecting a variable you have in all capital letters to also be a constant.  This helps with debugging so that another developer can scan your code and tell immediately that it is a constant without reading anything else. So make sure you adhere to these standard naming conventions when choosing a name.

Here is a quick overview of naming conventions in java:
http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html

and a waaayy more in depth java naming standards can be found here:
http://geosoft.no/development/javastyle.html

In conclusion, spending the extra bit of time naming will not only help you reason about your code dynamically, but drastically reduce the time needed for other developers to understand your code.

How to Ask Questions

One of the things developers struggle with is how to formulate and ask questions.  Why is this so important to you? Asking questions is often one of the best things you can do when you are in a state where you’re stuck and can no longer move forward.  Here are a couple questions to think about before you ask a question. :)

  • What am you asking? Composing a simple clear question can often be a challenge.  Sometimes in creating the question, you gain an understanding of what you already know and sometimes can answer the question yourself.
  • How are you going to ask the question? One way to think about this, is how is the simplest and easiest way to present this problem.  Just as simple, clear, concise,  and elegant code is what we strive towards, so is an elegant question.
  • What am you trying to learn? Is the question part of a bigger problem you are trying to solve? Or should you take the question a level up and try to find the answer to a bigger problem?
  • Who should you ask the question to? Finding the right person to ask the question to is also important. Knowing who you are asking and trusting that person will allow you to trust their answer.
  • Has this done before? Have you spent time investigating the cause? Do you know enough about the background? Have you spent enough time trying to see this question and problem from several different angles?
  • Do you have the skills/understanding to understand an answer? If you receive an answer, will you be able to implement it? What do you need to learn to understand the answer?

Learning through Personal Projects

One of the best ways to either pick up a new technical skill or to refine your programming skills is by taking on a personal project. Find a problem and solve it! Look at something and make it better! Work on an open source project!

Here’s some reasons why:

  • Many times you have to solve a problem or work in an unfamiliar or new domain. Its easy to become an expert in the projects and specific areas at work where you feel comfortable. However, one very important skill is the ability to learn how to learn. To be able to pick up a project you know nothing about and know how to begin or how to find out where to look for what you don’t know.
  • You gain experience not only programming, but looking at the project as a whole. Thinking about the user (you, your parents, your friends, a community), thinking about the end use case. Looking at current designs, redesigning or rethinking a solution to a problem, analyzing what is wrong with the current solution if there is one
  • Challenges in programming /computer science often repeat themselves. Many times if you are struggling with a problem, chances are someone else has already faced that problem before – and maybe even has found an elegant way of solving it! By exposing yourself to problems you are broadening your skills and many times those solutions can be applied to future problems
  • you are able to work at your own pace, focus on areas you want to,  with often no deadlines
  • you are learning by doing something you’re actually interested in

Developer Development

While there are many different methodologies about how to develop software,  one aspect often gets lost is the development of developers, or how you can become a better developer.

How are developers reviewed? How are developers growing and refining their skills? Most of the skills that senior level software developers have is based on experience. How are these lessons being retained and passed onto a younger generation? How are developers work being reviewed and improved upon?

One concept in computer science is the idea of code reuse.  How can we reuse the knowledge of the senior level engineers and apply that to entry level software engineers ?

  • One on one code reviews?  – Do you review all of the developers code? At a high design level? At a low line by line level?  This may take a huge amount of time aquainting a senior developer with this code…unless the senior developer is already working on the code. Should this happen at the end of the project or as the project is going along? Should there be a formal process for this?
  • Have a set or collection of standards,” lessons” , that developers can access – Developers would have to take the initiative to seek this out
  • Ideas?