Posts

Showing posts from April, 2018

Code Design - Choosing Abstract or Interface - Level 100

More often we wont get a chance to work on these aspects in early stage of your career. Even at the time of mid career getting a work related to API designing/Development is bit difficult. Unless you have a very good mentor in your initial career you will never get to know the real time. And you will end up in theoretical knowledge if you are computers academics. Others need to witness nightmares :-) Always try to implement good design in your day to day work. Never try to concentrate on these concepts for the matter of career growth. Only the passion to write a good code lets you to remember things. Design patterns are not meant for only senior programmers. You need to have a little bit knowledge on nitty-gritty of OOP/OOD concepts. And I need to say that continuous practice only lets you to excel further in OOP/OOD concepts irrespective of your experience levels. Here are some basic recommendations to help you to decide whether to use an interface or an abstract class to provid

C# - Finding connection string - Easy way

Most of the times we used to face difficulty while creating connection strings in our C# applications and especially when you are working in data intensive apps. I used to do lots of permutations and combinations (due to drivers installed) to find out the proper connection string in my initial career. Here I would like to explain easiest way and proper manner to test the connection ahead to actual usage. For database connections in C# apps you often need to supply an ADO Connection String. Here is a tip how to generate such string very easily. (Windows only) Go to your desktop  Right click and choose NEW/Microsoft Data Link - if you don't have this option on your menu, just choose NEW/Text Document  If you have make a new text file - change the file extension from .txt to .udl  Double click on the new file - you will see now the Microsoft Connection wizard (Data Link Properties)  Choose your database driver and connection properties  Test the connection  Choose OK to

Generics in C# - Straight

In programming, generics are also known as parametrized types or parametric polymorphism . Generics have been added to the .Net framework since version 2.0. They introduce the type parameter T to methods, classes (or types) and interfaces. There is a documented conversation about Generics in C#, Java and C++ with Anders Hejlsberg (The original author of Turbo Pascal , the chief architect of Delphi and the current lead architect of C#). With using generics, your code will become reusable, type safe (and strongly-typed) and will have a better performance at run-time since, when used properly, there will be zero cost for type casting or boxing/unboxing which in result will not introduce type conversion errors at runtime. The compiler of C# will be able to detect any problems of invalid casting at compile time. Reusability with generics means that you will be able to create a method or a class that can be reused with different types in several places. Now with generics you will be writin