How to get self confidence on source code you write?


Coding is primary task of every developer and we all know very well about it. But why may developers are not much confident about source code they wrote?

I do study few developers and fond following reasons.

They really don’t know/care what they wrote

They don’t like to go into further details of what they wrote. many do copy code form internet and feel they solve the issue.

They don’t try to think about every possible case

Many time they know there is potential bug but they are waiting for some one to generate  case and raise the issue. if it is found by someone they will fix it, But If no one able to identify they feel it’s ok or they wait till someone identify it.

They lack basic programming skills or believe in It’s not important

I asked may developers about basic questions of programming language they work on more then 3-5 years. for example I asked one PHP developer what are data types in PHP? and he replied “There is no need to define data type in PHP” Does it mean you no need to know about variable data types? one more example I asked on developer “what is difference between  Pass by reference and  Pass by value” and he replied “I don’t know”

So what is solution?

As per my best knowledge and experience I would like to share one of my tricks. whenever I write code I do ensure I know what  is impact of that line of code. If I don’t know about a single symbol, keyword or best practice I stop writing code and first clear my understanding and get enough knowledge. I know it is time consuming initially but It will save lots of time in future.

Advertisements

SOFTWARE VERSION SYSTEM


Every software we use daily has software version and we should also give version number to software we develop everyday.

The simplest one is Semantic Versioning.(http://semver.org/)

Give software version no in form of MAJOR.MINOR.PATCH

  1. MAJOR: Increment it on every major  release
  2. MINOR: increment it on every new feature introduction
  3. PATCH: increment it in every bug fixes or small changes

Here is one example :

  • When you start developing any software give it 0.0.1
  • when you introduce any new feature/module  change number to 0.1.0
  • when you add another module change number ot 0.2.0
  • When you made some changes/bug fixes change version to 0.2.1
  • Once software is ready for publish give it number 1.0.0

Query: When should I change software version number?
Answer: Every time you commit the code you should increment it.(obviously you should use source control systems)

Query: Where can I store it?
Answer: Put it anywhere in project. as Constant in code or version.txt or version.xml or version.json as you like