Often there are errors when a new application is programmed. As a result
of this it does not run as per expectations. Though Microsoft keeps adding new
features to ease the developers’ work and make things interactive but the
errors keep occurring. Some are minor mistakes while others are major – both
can impact the performance in a negative way. Thus it is important that every
.Net developer keeps in mind some of the common mistakes so as to avoid them in
the beginning and not regret later. The 7 mistakes that can be avoided are:
2.
Not
adhering to Complier Warnings - Developers tend to ignore warnings from the
compiler during the coding stage. This creates major problems later on and so
should not be ignored. Apart from this, the programmer is supposed to test the
application unit wise so as to identify where the error lies and also fix the
minor problems early in the process.
3.
Not
documenting for upgrade and reuse – Often developers skip the code documentation
part. As a part of the development team, documentation of code is important so
others can upgrade it later as per need. This can be done by adding comments
that make accessing the codes an easier job. Also, most users reuse code to
save their time and efforts. While coding, separating the user-control and
creating a separation between different elements will make the code reusable.
In bigger applications, the property definitions need to be repeated several
times. Mapping tools like Automapper etc can be used in such cases for more
efficiency and accuracy.
4.
Not
preserving the stack - MSDN
guidelines call for the developers to preserve the stack trace for the original
exception. .NET programmers often break the stack while throwing exceptions.
This is a simple but common mistake with grave repercussions. This can be
avoided if the developers review the code to fix the problem, and avoid losing
the stack trace. Preservation of stack is useful as it eases out the process of
debugging an application. It also helps to locate the exact error details in
the error log.
5.
Not
Disposing the IDisposable Object Properly - According to MSDN guidelines, the developers need
to declare and instantiate each IDisposable object. For this they need to use
the using statement. This is an effective method which makes the object go out
of scope immediately. However, when developers forget to use the using
statement, the object does not get disposed properly and creates errors later
on.
6.
Not
verifying the data adequately – The data that is used in the application can be
processed and manipulated in a number of different ways in the application
code. This calls for verification of each type of data both for validity as
well as integrity. Amongst many things, the data should not return a null
character. Therefore a thorough check of the data before execution is
mandatory. Applications that require inputs from users need more attention for
data verification aspect to ensure smooth functioning. Developers will be able
to handle situations better once they have identified the data that returns
null values.
7.
Not using
the right web services in the application - Web services are assumed to be an integral part of
each of .Net project. Developers do not analyze the web services’
pros and cons and use many different web services in their applications.
Choosing the right web service is the key to boosting performance and
efficiency while an incompatible one can do just the opposite. Therefore
evaluation of relevance and necessity of service for a particular application
is essential. Here the developer has a lot of choice and with the technology available
can even use remote services to their advantage.
It is essential for a developer to understand .Net development to the
fullest in order to incorporate the best practices in the same which will
result in an efficient build. Apart
from the common mistakes listed above, there are some of the tips and tricks
used by other Dotnet developers that can also help. Building an
application without committing coding errors might not seem to be humanly
possible. However developers can aim to reduce the errors and provide an
efficient solution.
No comments:
Post a Comment