Testing is essential but it’s secondary.
But I would argue, that more often than not, as developers, we believe we are making a justifiable decision. In over 20 years as a software developer I don’t recall ever having a discussion saying “let’s be lazy and irresponsible and get this finished as quickly as possible”. Instead, there is a quite reasonable sounding rationalization every time we choose the quick way.
This is a cynical, clinical collection of things I learnt in 30 years working with software development. Again, some things are really cynical, others are long observations on different jobs.
These software engineering rules and testing best practices might help save you time and headaches.
Spoiler: Answer is NO!
Current implementation C# Enum is very primitive; it can only return integer value for the selected enumerator option. If your project requirement needs something like returning a string for Enum, you have to come up with your own solution.
You cannot declare
enum like this:
One solution usually popular is to declare
Description attribute to each enumerators (for example,
[Description("WT003")] for Contractor) and use it to store a respective string value. This is more of a hack work to as intend of
Description attribute is to provide description for enumerators for documentation purpose only. With that, you then also require to use reflection to pull the string from
Description attribute. This is not a clean solution.
I think the best way to implement the solution is through creating a dedicated class instead and provide all implementation underneath to make it behave like an
We set the Constructor of the class as
private which will keeping this class initiated anywhere in the project. All this class is exposing is defined members and
Value property in which are interested in.
We can then further extend this class by overriding
Equals and implementing
!= operators. Complete implementation will look like this:
Once we establish the pattern using the above implementation, it’s just a matter of replicating this pattern for other complex enums which has this string return value requirements. I hope this help!
These tips and techniques by James Turnbull will help you to avoid potential source control pitfalls and make your development workflow bit smoother.
Tip # 6: I am bisect and so can you
git bisectis one of the most powerful, seemingly magical, code-based debugging tools available to you. It can be used when you discover a bug you can’t trace to a specific piece of code. A
git bisectruns a binary search between two commits: a good commit where the bug wasn’t present and a bad commit where the bug appears.
$ git bisect start $ git bisect bad # Current version is bad $ git bisect good v2.6.13-rc2 # v2.6.13-rc2 is known to be good
Nikita Sobolev explains how to write better user stories:
Use consistent language
Remove technical details
I am so happy to see my first Chrome extension published on the Chrome Web Store. The whole intension of this releasing the extension was to understand Chrome extension development workflow and extension publishing process. The whole process to upload my extension was simple and straight forward even for beginners like me.
Now about the DIV Glance Chrome extension itself. This extension will give you a visual glance of the DIV tags in the page. Just hover your mouse pointer over the page and extension will highlight DIV under the pointer with the Red background color. The intensity of Red background color signifies the depth of highlighted DIV related with regards to its parent DIV layers. You no more have to dig through Chrome DevTools to inspect DIV layout in the page.
DIV Glance Extension Page: DIV Glance
As I mentioned above, I created this extension just for the sake of learning Chrome extension development. As I saw the practical usage of this extension later, I tried to polish it a bit to make it more presentable. At the core of this extension, it simply injects following CSS style to the page — nothing fancy.