Attitudes of a Great Software Developer !!!
Jul30

Attitudes of a Great Software Developer !!!

A post by guest author Rajaraman Raghuraman. This post was originally published in AgileDevTest Blog. Software development is an art, not just a science.  You can learn all the technicalities of software development, but you need to be absolutely passionate about coding and perceive it as an art to be extremely good at it.  If you are one such person, I will introduce you to the journey of becoming a “Great Developer”.  The objective of a Great Developer, as i name him/her is to make his/her art as beautiful as possible and make it the best. In my own thoughts, I will share some attitudes which a great developer should have apart from the general expectations of being technically and analytically sound, understanding requirements in detail, good design skills, etc. Attitude #1 –  A bug is a question of my ability to write good code Fixing bugs is part and parcel of a software developer’s activities.  A bug is obviously the worst enemy of a Developer.  But how many developers think in the following lines while fixing the defects What I could have done to avoid this bug in the first place? How did I allow this bug to escape my eyes? OK, something wrong has happened this time.  How do I avoid the same mistake next time? What steps do I need to take? Truth is very few developers think on those lines. A  person willing to be a great developer should consider a bug as a threat to his position, as a threat to his credibility, as a threat to his programming skills.  That is the attitude that will make him/her a great developer. Attitude #2 – Mr. Tester, I challenge you to find bugs in my code How many developers have this attitude?  Many developers think that the job of the testers is to find bugs.  Yes.  Obviously, but that doesn’t mean as developers, we can take bugs for granted. A great developer or a person willing to be a great developer should  always invite / challenge the tester to find bugs in his/her code.  He should have so much confidence in his code that he can challenge in such a way. Attitude #3 – No compromise on code quality Code quality should be of prime importance to a developer.  That will include following the right coding standards, making the code more maintainable using proper design and code refactoring, etc, etc.  But how many of us compromise code quality for many reasons best known to us? I can quote an instance in my project to explain this.  I was leading a team of developers and we were working on...

Read More

Asp.Net: More about Cookies

We have seen, how our cookies looks in our last article Cookies Part 1. In this article, we will talk about their properties,limitations and technical part. Properties and Limitations Cookies are associated with website and not single pages. Cookie is stored in our system as Text File. They are stored in plain text format i.e. no encryption. Their size on disk is limited to 4096 bytes. so only identifiers and ids are stored, big chunks of data are avoided. Browsers puts a limitation on the number of cookies stored. In case of more than the quota, old cookies are discarded. Nowadays, It is mandatory for websites to tell the user whether they will allow cookies to be stored so It depends on the user to allow or reject the cookie Even we can change our browser settings to allow or reject cookies. Go to your chrome settings->privacy->content settings Here, you can set your settings, if you want to see your cookies, click on ‘All cookies and site data’. We will move to technical part of cookies. We have two objects, HttpResponse and HttpRequest in our application life cycle which handles the use of cookies. For writing information to a cookie, we would require HttpRespone object. This object contains a collection of cookies where we just have to add our cookie. First of all, we will try to create a cookie and store some information. Write a Cookie As always, we require necessary classes to begin with and for that we require a Namespace.Here, we have System.Web, which will expose necessary classes. System.Web Now, We will use HttpCookie class to create our cookie HttpCookie ShoppingCart = new HttpCookie("ShoppingCart"); ShoppingCart.Value = ItemTextBox.Text; ShoppingCart.Expires = DateTime.Now.AddHours(1); Response.Cookies.Add(ShoppingCart); Earlier, we talked about HttpResponse but here we are using Response object. why? Both are same, HttpResponse is available to us in the form Response property of our Page so we are directly using Response object. Though we have other ways also to create cookies but this is the descriptive way to understand each step. As Response.Cookies is a collection, we can add more than one cookie to the collection by creating multiple cookies in similar fashion. Read a Cookie To read a cookie, we have HttpRequest object and this is also available in the form of Request property of our page. Lets use it and read the cookie. We just have to remember the name of our cookie and dig it out from the cookies collection of Request object. string shoppingcart=Request.Cookies[“ShoppingCart”].Value; OfCourse, Check for Null Value of shoppingcart before using it in your application else you might receive a beautiful error message. We have...

Read More

Asp.Net: Hidden Truth of Cookies

I know there are several articles on cookies as what are they? and how can they be created? but i always wanted to know more about them. My questions were where they are stored? how to track their expiry? If they contain user centric information then Can they be encrypted? Lets explore each of my question then we will go more into coding part of cookies. I remember the first definition of cookie that i learned “Cookie is a text file which is stored at the user’s hard disk and contains user’s session information” This definition is very much synonymous to Google definition: “A small sweet cake, typically round, flat, and crisp.” Good.Right? Our Cookie is a small file like small cake and provided sweet feeling by streamlining our session information. But when i really started working on cookies, I had my share of queries and resolutions like I came to know that as ‘http’ is a stateless protocol so we always have to attach our session information. What is this session information and why it is required every time? Well, the best answer is user expectations, we always want our web to be extra smart.Don’t we? if i say, you don’t have to sign in to your Gmail account on each request or you don’t have to add the items on your shopping basket every time or you just want your website to tell you,when you visited the site last time. This is the smart decisions we expect from our website but as HTTP protocol is stateless and can’t retain our information then what it did, it provided a Cookie mechanism to store the information at user’s side and send it to server on each request where it gets modified as per the request and sent back to the user to store it again. Here, I’ll sweetify the definition a bit: “Cookie is a piece of client’s information kept at client’s side in the form of a text file and , on each request and response, this information travels between the server and client” No files travels between server and client, only information travels in between server and client. At client side, information is read by the ‘HTTP’ request from this text file and while the response is received, this file is written with the updated information again. So where this file is located, It depends on the browser so let’s believe what we see now. In FireFox Run this: %AppData%\Mozilla\Firefox\Profiles\%FirefoxProfile%\cookies.sqlite To read the data you need to connect to that database and query the DB In Internet Explorer Run this : %AppData%\Microsoft\Windows\Cookies In Chrome Run this: %AppData%\\Google\Chrome\User Data\Default\Cookies Now, we...

Read More
C#: My experience with const keyword
Nov30

C#: My experience with const keyword

There are numerous post on internet about ‘what is const keyword in .net’ or ‘what is the difference between const keyword and read only’ and I must say many might have already mugged it up like me I can bet, many of us might not have tried some exercise to learn the real implementation or did not get caught in a situation where the learning would have come on the doorsteps by itself. I was lucky as the learning came in a disguise to me but unlucky because we have to bang our head for sometime as a crucial deliverable deadline was approaching. Lets begin with the scene of a ODC where team is working during the UAT week. As per the changes received, DDLs containing helper classes needs to be changed and updated in the environment. Our main website project contains only the reference to the helper classes so there was no need to build the website project. It’s a normal procedure and we have carried it out several times so we were sure everything will work. But, we were about to learn something and there it was, all the changes that were asked were available on the website but one const field which was changed in the DLL is showing the old value only. We checked the helper class and find that it is updated correctly then why our website is showing old value. On banging our head for quite sometime, we build our website project also and to our surprise, we got the updated value. Great! We realized that website will certainly keep the references to DLLs and update its IL-intermediate language code, but if we look at the IL for a const field then we will find the actual value and not the const variable name like : For const a=5, IL will not contain variable name,it will only contain the actual value 5. In our case, our website IL contained the actual value so on building the DLLs, references got updated but not the actual value. To update it, Website was also required to be build. Real time experiences can teach us insightful lessons and provide meaning to our learning. Please share...

Read More

Nullable .Net types

We declare .net types in our project daily but still we do not recollect default values for each .net type so we end up doing null check for each data type. Its a basic mistake of a developer but .net makes us intelligent with one of their operator, ‘?’ Nullable is represented by a ‘?’. Prior to that, uninitialized variables in C# is not allowed so we should know default values of .net datatypes. For value types, mostly it is 0. For ex: int id=0; I have specified only the basic value types which we use in our daily development work. For detailed list for value type, click here. Value type Default value bool false byte 0 char ” int 0 long 0L struct The value produced by setting all value-type fields to their default values and all reference-type fields to null. For reference type, default value is null. Now, the condition we normally see is to have default value as ‘Null’ for value type. To achieve this we have nullable operator ‘?’ which we mentioned earlier. How to use it? Just put it in front of your value type variable. For ex: int? id=null; This will make int variable accept ‘Null’. Please note this one more important information, if we have one int variable and other nullable int variable then they are not equivalent and cannot be assigned to each other. For ex: int x=1; int? y=2; x=y; — It is not possible and will throw compile time error. To correct it, Both the variables should be nullable. Nullable has two more properties. ‘HasValue’ for a null condition check and ‘Value’ to get the actual value. We sometimes fail to differentiate between the uses of ‘?’ as it can be used in many ways.To avoid the confusion regarding ‘?’. One of the use is a conditional operator. For ex: int id = x > y ? x : y; it is same as – int id; if( x > y ) { id= x; } else { id= y; } Same kind of operation can be written with ‘??’ but only for null check. int? x=1; int? y= x?? 1; This exercise requires some real time practice and will be much more clear so I request you all to try it and send your feedback....

Read More
Page 1 of 212