General Development Standards :
1). Promote Code Reusability & Eliminate Code Redundancy
As a Dotnet Developer the first thing We should not forget about the basic advantage of the .Net is “Reusability”.
Whenever possible if the work you’re doing can be made generic to the application or the company, it should be developed into a user control or server control so that it doesn’t have to be developed twice.
An example of this would be a date picker for a web application, a control like this should be made reusable for everyone at CAT. Repetitive parts of an application can be turned into a user control and reused throughout the application so that it doesn’t have to be redeveloped and maintenance and changes are easier to make. If you find yourself needing to do the same thing as an existing block of code, just with a slight variation, do not copy and paste the old code and then just change a few lines. Instead, try to think how you can modify the existing code to make it more general. Or factor out the common code into a “helper” that both your new module and the other module can use.
Note: We are planning to have a mutual place on Web where we all can post the reusable code ( Datetime Pickers, Mailing components, Gridcontrolworks, any third party controls, user controls…etc where each person can login & upload the code over there) into that & each and every person use it for further references…
I feel instead of taking code from somewhere else in the Google, hop this can help us in reusing more fastly , since we are not sure that downloaded code from different sites can may or may not work.. So better to go with our local copy..
..Any suggestions on above can be appreciated
2).Write easy-to-understand code (and comment it.. if necessary)
This is very basic experience we face. We use x , y , z etc.. as variables & we use them in throw out the project.. no one other than the coder know what stands for that ‘x’…. Some times lot of searching might be required to search for what is this “x”.. & sometimes the coder itself’s forgets what that x stands for… This was my personal Experience… I observe & some time I do follow in coding for urgency things.. it is wrong.
What you write once will need to be read many times by many people so please use a clear and consistent style. Document all of your code classes, methods, and properties using Comments so that others can have documentation to follow in your foot steps and so that we can read these comments. Make sure your code formatting follows our documented formatting and that you have inline comments explaining assumptions, unobvious things, or work around.
3).Please give a meaning full name to the Variables so that it can easily recognised where ever it is Required to Call., never mention x, y, z, i..etc
Always choose meaningful and specific name whgich resembles the variable.
1) Try to prefix Boolean variables and properties with “Can”, “Is” or “Has”.
2). Avoid using abbreviations unless the full name is excessive.
3). Avoid abbreviations longer than 5 characters.
4). Do not use single character names such as i or j. Use index or counter instead.
.NET Naming Conventions
4) Hungarian Notation
Do not use Hungarian notation in naming variables. Hungarian notation uses different prefixes to embed the variable “type” into the variable name.
Examples: strName, intValue (it is Wrong)
An exception to this is control names. We use Hungarian Notation for these:
Button – btn Label – lbl
CheckBox – chk LinkLabel – lnk
CheckedListBox – chkl Listbox – lst
ComboBox – cbo ProgressBar – pba
Control – ctrl RadioButton – rad
Menus – mnu RichTextBox – rtb
Panel – pnl Splitter – spl
PictureBox – pic StatusBar – sba
Datagrid – dgr TextBox – txt
DatagridColumn – dgrc ToolBar – tba
Dialog Controls – dlg ToolTip – tip
Form – frm
GroupBox – gbx
Camel Case
“Camel case” is the practice of writing identifiers in which no underscores are used to separate words, the first letter is lowercase, and the first letter of each subsequent word is capitalized. Examples: filename, voterAddress. Use camel case to name private and protected fields, parameters, and local variables.
Pascal Case
In “Pascal case”, no underscores are used to separate words, and the first letter of each word is capitalized. Examples: GetFileName, MainForm. Use Pascal case for public fields and properties, class names (including enumerated types and structures), and namespaces.
Naming Constants
All constants should be named in uppercase with underscores to separate words.
Examples: ROW_COUNT, COLUMN_NAME, URL
.NET Coding Standards
USE of USING Keyword of C# :
While reviewing some C# code written by one of my friend, I noticed a lack of calling Dispose() on SqlConnection and SqlCommand objects. And in all cases, the database code was not placed in try / finally blocks. This is typical newbie style of development that everyone, including myself, attempted in the very beginning.
SqlConnection cn = new SqlConnection(connectionString);
SqlCommand cm = new SqlCommand(commandString, cn);
cn.Open();
cm.ExecuteNonQuery();
cn.Close();
It sure is easy to follow :)
The problem is that SqlConnection and SqlCommand implement IDisposable, which means they could have unmanaged resources to cleanup and it is our job, the developers, to make sure Dispose() gets called on these classes after we are finished with them. And, because an exception could be raised if the database is unavailable ( a very real possibility on WebHost4Life :) ), we need to make sure Dispose() gets called even in the case of an exception.
Personally, I like the “using” keyword in C#. Internally, this bad boy generates a try / finally around the object being allocated and calls Dispose() for you. It saves you the hassle of manually creating the try / finally block and calling Dispose().
The new code would looking something like this:
using (SqlConnection cn = new SqlConnection(connectionString))
{
using (SqlCommand cm = new SqlCommand(commandString, cn))
{
cn.Open();
cm.ExecuteNonQuery();
}
}
This is essentially equivalent to the following, although my guess is that C# will internally generate two try / finally blocks (one for the SqlConnection and one for the SqlCommand), but you get the idea:
SqlConnection cn = null;
SqlCommand cm = null;
try
{
cn = new SqlConnection(connectionString);
cm = new SqlCommand(commandString, cn);
cn.Open();
cm.ExecuteNonQuery();
}
finally
{
if (null != cm);
cm.Dispose();
if (null != cn)
cn.Dispose();
}
You may notice the lack of calling Close() on the SqlConnection class, cn. Internally, Dispose() checks the status of the connection and closes it for you. Therefore, technically you don't need to call Close() on the connection (cn) as Dispose() will do it for you. However, I don't think there is any penalty for calling Close() directly and then Dispose(), but I don't know for sure. I doubt it.
In addition, Dispose() destroys the connection string of the SqlConnection class. Therefore, if you want to re-open the connection after calling Dispose() on cn, you will have to re-establish the connection string. Not doing so will throw an exception.
Let me know any questions if you have any in the above usage of USING Scenario…
Comparing Values
Favor a Select Case block instead of an If statement when testing the same variable against four or more values.
For Loops
Do not declare variables outside of a For loop when their only purpose is to iterate through the loop.
Wrong:
VB.NET
Dim currIdx as integer
For currIdx = 0 to 100
‘do something
Next
C#
int i;
for(i = 0; i <= 100; i++;) { Value += “A”; } Correct: VB.NET For currIdx as integer = 0 to 100 ‘do something Next C# for(int i = 0; i <= 100; i++;) { //do something } Magic Values Avoid the use of “magic values.” Use constants instead: Wrong: VB.NET If Parishes.Count > 64 then
MessageBox.Show(“Invalid number of parishes.”)
End if
C#
If(Parishes.Count > 64)
{
MessageBox.Show(“Invalid number of parishes.”);
}
Correct:
VB.NET
Private Const MaxNumberOfParishes As Integer = 64
Private Const InvalidNumberOfParishesMessage As String = “Invalid number of
parishes.”
‘ In your function or subroutine:
If Parishes.Count > MaxNumberOfParishes Then
MessageBox.Show(InvalidNumberOfParishesMessage)
End if
C#
private const int MaxNumberOfParishes = 64;
private const string InvalidNumberOfParishesMessage = “Invalid number of
parishes.”
If(Parishes.Count > MaxNumberOfParishes)
{
MessageBox.Show(InvalidNumberOfParishesMessage);
}
Use Enum’s or constants file if required
Prefix interfaces with the letter I and use the interface keyword.
Use a noun (e.g. IComponent), noun phrase (e.g. ICustomerAttributeProvider), or an adjective (e.g. IPersistable)to name an interface.
Ex:
public interface IScanner {}
Building Strings
Building large strings in memory should use the System.Text.StringBuilder class as opposed to manually appending string parts into a string variable. This is necessary for the speed of the application. Building a string on your own instead of using the StringBuilder class is much slower.
Wrong:
VB.NET
Dim value as String = “”
For i as integer = 0 to 100
value += “A”
next
C#
int i;
for(i = 0; i <= 100; i++;) { Value += “A”; } Correct: VB.NET Dim sb as new System.Text.StringBuilder Dim value as String = “” For i as integer = 0 to 100 sb.Append(“A”) Next value = sb.ToString() C# StringBuilder sb = New StringBuilder(); for(int i = 0; i <= 100; i++;) { sb.Append(“A”); } string Value = sb.ToString(); Accessing the database through your .NET code
Do not create or execute SQL queries in the code behind of forms or within the same project as the user interface. All queries should be inside of the data access layer (DAL). If a dynamic query must be used, it should not be susceptible to SQL injection attacks.
Technorati Profile
Saturday, May 31, 2008
Thursday, May 29, 2008
Smart TIPS to a Programmer For a Better Performance
Here are some of Smart TIPS (Related to System) which you can follow before you start any new projects..
I know most of the people know each & every point I am going to write below, but we never follow (some times including me). I feel I could have share these things with you people to use this tips for better performance.
1). Check your system configuration & Performance. Format it If it is Required (I prefer a formatted System Help’s in Better Performance) & Install the new Softwares which are required for that Particular New Project.
2). Uninstall All the unnecessary Softwares in the System..(Do this for sure)… These unnecessary Softwares takes so much of unnecessary space in the RAM..
3). Remove the Temporary Files from System at least twice a Week. These temporary files eat the performance of the system. Take help from Network team if necessary. (you can type “%temp%” in RUN Window.. it will roots you to temporary Files folder & remove the Temporary files from the folder).
4).From “DAY 1” Keep a Folder Structure for the Project’s & Maintain all the Corresponding Documents in the corresponding Folders. Never forget you are paving a easy road to you for easy reference of the documents.
Keep a Dedicated Folder in any Drive With Name “Projects” (Other than C:\ , Since The OS will be Installed on this drive, so if any Problem in the OS it will Crash’s C:\.. So never keep any documents in the OS installed Drive) .
it not only help’s you , it will helps other people in searching the documents easily to help you in some Urgency situations where you may not available in the Office”
So Follow A structure..
EX:
E:\ Projects -->ProjectName1 -->Chats
------------------------------------->Documents
------------------------------------->Status Reports
------------------------------------->SourceCode
------------------------------------->Backup
------------------------------------->Softwares
------------------------------------->CodeSnippets (R&D)
------------------------------------->References & Gatherings ..etc
---------------->ProjectName2 -->Chats
------------------------------------->Documents
------------------------------------->Status Reports
------------------------------------->SourceCode
------------------------------------->Backup
------------------------------------->Softwares
------------------------------------->CodeSnippets (R&D)
------------------------------------->References & Gatherings ..etc
Feel Free in creating your own creativity in creating the folder structure which could help you in managing things very easily. Above mentioned are some of the samples.. (tell you one thing some times it takes hours & hours to search for a Simple Document to show it to client immediately)
Maintain the good Folder structure where ever it is Problem in all DRIVES. Don’t Keep any fuzzy folder Structures in Main Drives. (Believe it or not In one of my friends System I have seen almost 200 or above unnecessary folder in the Main drive like C: , D:.. Very Confusing folder structures)
5). if you are facing problem with system or Software Post the issue immediately , or intimate it to the corresponding person to get it Fixed soon.
6). Check & Keep on track the Performance of the System on a weekly basis… Never forget your new project Might Requires you to run HIGHEND Softwares in it. So Check your system. Take help from Network people for improving the system performance.
7). Check is your Email is Configured in OutLook & also IM Configured with Corresponding ID or not. If not inform immediately this to Network team & Get it done.
8). Check all the Necessary Softwares for the New Project are installed or not. Check the corresponding Version too. (Say the client say’s Sqlserver2000, unfortunately we installed Sqlserver2005.. That will be a Mistake for sure).. So check whether the Exact version is installed what Client is Expecting.
9). Keep your Past work with you for Future references. (If you Maintain Folder structure you will be having your Past work with you, which might be use full in some of the concepts). Not only Handwork is Important sometimes Smart work is very important.
10). If you find time keep your research works in a folder like “CodeSnippets (R&D)”, which might be helpful in future references..
11). Keep your Desktop Clean. (I heard some where saying “Your Desktop resembles your Current Mental Strategy”)
Don’t forget following these things also makes your everyday work easier & light weighted :).
After all Our Final Weapon in this Software Industry is Our System… So keep your system Clean & Be successful in all the works you are going to Start.. I wish you All the Best…
( I feel Smart People follow Smart steps to Finish thing's Successful in Style...
like me .. Just Kidding...)
please Provide your comments & suggestions ….
Saturday, May 24, 2008
Project Management Tips
Hi Friends,
When I was trying to find some new thing's related to Project Management in Google, I find some cool step's & to keep the things cool.. I hope this can help ful us in sometimes...
Let me put those points over here::
10 things you should do near the end of a project ::: :)
Depending on the size of your organization, you may treat project management as a casual practice or you may have an involved PMO. In either case, you probably go through the typical inception, elaboration, and construction phases of a project. But when it comes to the end of a project, many project managers come up just short of the finish line. Failure to handle the final steps can add confusion to an initiative and may lead to customer dissatisfaction, unhappy staff, and a project dragging on longer than necessary.Here are a few things you should be thinking about when you get to the end of your next project. Some of these items are purely administrative, but many of them will help get you one step closer to ensuring that your project is successful.Note: This information is also available as a
#1: Finalize testing ::
Testing can be a drain on people, and many of us don't like to do it — especially when it takes a few rounds. I have seen complex projects that were four to six months long have a day or two scheduled for testing. Not scheduling an adequate amount of testing usually ends up with problems occurring during the first few weeks of an implementation. Don't take a shortcut here and minimize the importance of testing; otherwise, you'll take on the additional risk of having a painful rollout.
#2: Finalize training Users? Who cares about users?
Well, many projects are done for their benefit, so make sure you have all your testing materials completed and delivered. Failure to do so will most likely manifest itself in the form of angry phone calls from irate users in the middle of the night.
#3: Validate deliverables
You've checked all your boxes and cleaned out your inbox, and you really think you're done. But what does your customer think? Schedule time with customers to review all the deliverables and ensure they have been met. In some cases, there may be a few outstanding issues still unresolved when you get to your scheduled end date. Early on in your project, you should have made an agreement that determines how this will affect your end date if this situation occurs.
#4: Get project signoff
After you've agreed that all the deliverables have been met, request a formal signoff on the project documentation. Doing so helps ensure that everybody is in agreement on the state of the project. Since this signoff usually signals the formal end of the project, be careful not to make your customers feel pressured into signing. If they do this without understanding what it means, you will likely end up with an unsatisfied customer if an issue arises at a later date.
#5: Release the team
Now that the project is done, where is your team going? Depending on the organization, they may be sent back to a development pool or into the business. Or maybe they need to go drum up some work for themselves within the company. No matter what it is, make sure you spend time with them and set a clear end date for when you no longer need their services. Also don't forget that you probably need to complete any performance review documents that need to be added to their file.
#6: Analyze actual vs. planned Resources.
Did you really get away with only one developer/tester for 10 weeks or did you need to scramble and get more people? What about the amount of time you scheduled for your business partners? Understanding how well you hit these targets will help you better allocate resources for your next project and set more realistic expectations when it comes to a project's duration.Budget. How much was the project going to cost? Did you come in on budget, under budget, over budget? Sitting down to understand the answers to these basic questions should give you some insight into a critical area of any project
7: Archive documentation :
During any project, we seem to create huge amounts of documentation. It can range from scope documents and project plans to contracts and meeting minutes. Whatever it is, when you are done you should have someplace to keep it based on the retention policy of your company. You'll be glad you did when your phone rings two years from now and somebody asks you to explain the rationale behind a choice you made during the course of the project.
#8: Ensure contract closure :
It's not unusual for a project to have its own budget. You also may have contracts for hardware, software, or professional services. When you're done, make sure that you verify that all the terms of your contracts have been met, request final invoices from vendors and submit them to AP, and close out any associated financial accounts, if necessary.
#9: Conduct a postmortem :
meetingWhat types of risks did you identify and mitigate? What went really well that you want to ensure you do again next time? Have a meeting with all the project stakeholders and relevant participants to provide them with a forum to express any lessons learned.
#10: Perform a self assessment :
So it's finally over. After all the hard work has been completed, you've made sure that all the i's have been dotted and all the t's crossed. Now what do you do? It's important to get some feedback on your performance from the people you interacted with during the project. If you have the opportunity to send out a 360-degree feedback survey to as many individuals as possible, I would recommend it. It will help you assess how you're progressing and will give you some great direction in deciding which personal growth opportunities you should focus on.
This list won't be the same for everybody and will depend on your organization and how it implements projects. But if you can do them, it will always make the transition to the next project smoother.
When I was trying to find some new thing's related to Project Management in Google, I find some cool step's & to keep the things cool.. I hope this can help ful us in sometimes...
Let me put those points over here::
10 things you should do near the end of a project ::: :)
Depending on the size of your organization, you may treat project management as a casual practice or you may have an involved PMO. In either case, you probably go through the typical inception, elaboration, and construction phases of a project. But when it comes to the end of a project, many project managers come up just short of the finish line. Failure to handle the final steps can add confusion to an initiative and may lead to customer dissatisfaction, unhappy staff, and a project dragging on longer than necessary.Here are a few things you should be thinking about when you get to the end of your next project. Some of these items are purely administrative, but many of them will help get you one step closer to ensuring that your project is successful.Note: This information is also available as a
#1: Finalize testing ::
Testing can be a drain on people, and many of us don't like to do it — especially when it takes a few rounds. I have seen complex projects that were four to six months long have a day or two scheduled for testing. Not scheduling an adequate amount of testing usually ends up with problems occurring during the first few weeks of an implementation. Don't take a shortcut here and minimize the importance of testing; otherwise, you'll take on the additional risk of having a painful rollout.
#2: Finalize training Users? Who cares about users?
Well, many projects are done for their benefit, so make sure you have all your testing materials completed and delivered. Failure to do so will most likely manifest itself in the form of angry phone calls from irate users in the middle of the night.
#3: Validate deliverables
You've checked all your boxes and cleaned out your inbox, and you really think you're done. But what does your customer think? Schedule time with customers to review all the deliverables and ensure they have been met. In some cases, there may be a few outstanding issues still unresolved when you get to your scheduled end date. Early on in your project, you should have made an agreement that determines how this will affect your end date if this situation occurs.
#4: Get project signoff
After you've agreed that all the deliverables have been met, request a formal signoff on the project documentation. Doing so helps ensure that everybody is in agreement on the state of the project. Since this signoff usually signals the formal end of the project, be careful not to make your customers feel pressured into signing. If they do this without understanding what it means, you will likely end up with an unsatisfied customer if an issue arises at a later date.
#5: Release the team
Now that the project is done, where is your team going? Depending on the organization, they may be sent back to a development pool or into the business. Or maybe they need to go drum up some work for themselves within the company. No matter what it is, make sure you spend time with them and set a clear end date for when you no longer need their services. Also don't forget that you probably need to complete any performance review documents that need to be added to their file.
#6: Analyze actual vs. planned Resources.
Did you really get away with only one developer/tester for 10 weeks or did you need to scramble and get more people? What about the amount of time you scheduled for your business partners? Understanding how well you hit these targets will help you better allocate resources for your next project and set more realistic expectations when it comes to a project's duration.Budget. How much was the project going to cost? Did you come in on budget, under budget, over budget? Sitting down to understand the answers to these basic questions should give you some insight into a critical area of any project
7: Archive documentation :
During any project, we seem to create huge amounts of documentation. It can range from scope documents and project plans to contracts and meeting minutes. Whatever it is, when you are done you should have someplace to keep it based on the retention policy of your company. You'll be glad you did when your phone rings two years from now and somebody asks you to explain the rationale behind a choice you made during the course of the project.
#8: Ensure contract closure :
It's not unusual for a project to have its own budget. You also may have contracts for hardware, software, or professional services. When you're done, make sure that you verify that all the terms of your contracts have been met, request final invoices from vendors and submit them to AP, and close out any associated financial accounts, if necessary.
#9: Conduct a postmortem :
meetingWhat types of risks did you identify and mitigate? What went really well that you want to ensure you do again next time? Have a meeting with all the project stakeholders and relevant participants to provide them with a forum to express any lessons learned.
#10: Perform a self assessment :
So it's finally over. After all the hard work has been completed, you've made sure that all the i's have been dotted and all the t's crossed. Now what do you do? It's important to get some feedback on your performance from the people you interacted with during the project. If you have the opportunity to send out a 360-degree feedback survey to as many individuals as possible, I would recommend it. It will help you assess how you're progressing and will give you some great direction in deciding which personal growth opportunities you should focus on.
This list won't be the same for everybody and will depend on your organization and how it implements projects. But if you can do them, it will always make the transition to the next project smoother.
Subscribe to:
Posts (Atom)