Tip : Code Structure C#
Feb03

Tip : Code Structure C#

Welcome to CodeSpread! As a developer, I always stress on developing a habit of following the best practices to structure the code. It helps me to easily navigate through the code and also saves a lot of effort in searching for some particular items. Below is the sample structure and example: using statements Constants / Read-only fields Private Members Enumerations Public members Protected members Constructors Properties Public methods Private methods //using statements Using System Using System.Web namespace Controllers { public class SampleController {   //Constants / Read-only fields public const int numofitems=10; //Private Members private string _samplestring = string.Empty; //Enumerations public enum months { January = 1, February, March, April, May, June, July, August, September, October, November, December };   //Public members public  int StartDate =string.Empty;   //Protected members protected int EndDate ==string.Empty; //Constructors public SampleController () { }   //Properties public string Date { get; set; } //Public methods public string GetStartDate() { } //Private methods private int numOfItems() { }     Related articles across the web C# Coding Standards CLS Compliance?...

Read More
Importance of Software Maintenance
Jan29

Importance of Software Maintenance

What is Software Maintenance? Software maintenance is an important phase of SDLC. It is defined as a set of activities to keep the software functional and behavioral as intended for as long as possible with few problems. These activities might involve any processes to modify software product after final release cycle. As a result, software maintenance will Improve performance Correct faults Adapt the product to a modified environment How software maintenance is different from software development? Software Development is kind of a new development where a new environment and system is created from the scratch and there are no sketchy boundaries, if not limited by requirements. But think of introducing a new feature in the developed product which is running in a specific environment. Then, the existing system setting and environment plays a major role as they are required to be considered and analyzed at the planning stage of new feature development. Consideration of limitations posed by existing system and environment is the key difference between software maintenance and software development. What is the purpose of software maintenance? The purpose is to preserve the value of software over the time. The value can be enhanced by expanding the customer base, enhancements of capabilities, deletion of obsolete capabilities,  more efficient and employing newer technology. What are the categories of Software Maintenance? Software maintenance is categorized mainly into 4 categories: Adaptive: As the name suggests, it is related to activities which ensures software remain functional during movement of software to a new system environment. For example: Up gradation of processor will require software to be adapted to the upgraded environment. Perfective: Here, more the requirements, more expansion of software is required. Requirements grow over a course of time so do software. Perfective is an approach to accommodate the enhancement of the initial product. Corrective: As the name suggests, Corrective approach tends to correct any errors or bugs. These errors or bugs might have introduced during design stage, coding stage. These issues might have been missed during development or later crop up under some new test scenarios which were not covered during testing. Preventive: Preventive approach is more a beforehand precaution approach where activities are lined up to avoid any corrective action. For example: Any maintenance activity might lead to code complexity so a series of code restructuring and code optimization activities are performed to avoid any successive issues. Thanks! Related articles across the web Software Maintenance is a...

Read More
Software Testing Life Cycle (STLC)
Jan20

Software Testing Life Cycle (STLC)

Software Testing Life Cycle (STLC) is a process which consists of a number of phases to improve the quality of the product. Each phase involves various testing activities like Requirement Analysis Test Planning Test Design Test Environment Setup Test Execution Test Reporting   Requirement Analysis: What are the types of tests to be performed? Identify Modules. Is there scope for automation testing? Prepare Requirement Traceability Matrix (RTM). Testing Scope. Test Environment Details. Test Planning: What needs to be tested? Identify Test tool. Effort estimation and resource allocation. Scope of testing. Risk Identification. Training Requirements.. Test Design: Create test cases & test scripts. Review test cases & test scripts. Identifying test data, If Test Environment is available. Test Environment Setup: Prepare hardware and software requirement list for the Test Environment Perform Smoke testing. Test Execution: Execute the test cases. Report and log bugs to developers. Track defects to closure. Prepare list of defect status. Test Reporting: Prepare Test closure report. Prepare Defect Metrics. Prepare KT documents. STLC phases depends on the organization and their needs but the basic understanding remains the same across. Please mail at admin@codespread.com for...

Read More
24/12/2013: 10 Best Practices of programming from CodeSpread(31-40)
Dec24

24/12/2013: 10 Best Practices of programming from CodeSpread(31-40)

We love programming and having a knowledge of best practices always helps in writing beautiful code. We have shared first 20 random best practice in our previous articles 1-10, 11-20, 21-30. More best practices from CodeSpread. Best Practice #31, Naming Conventions are important, Use Pascal Casing for class, interface, constants and methods names. For example: interface INewClass { void NewMethod(); } public class NewClass : INewClass { public const int NewConstant=10; public void NewMethod() { } } Best Practice #32,Use camel casing for local variable and parameters. public class NewClass { public int countEmployee; public void NewMethod(int customerId) { } } Best Practice #33, Do not use abbreviated language. For ex: do not use single alphabets as it does not convey any useful meaning. int i=1; int j=2; Best Practice #34, Always use descriptive language for naming. int count=10; void GetEmployeeCount(); Best Practice #35, Use #region to summate the block of codes together and have a clean separation. #region Get Customer Details public class Customer { public int customerCount; public void GetCustomerDetails(int customerId) { } } #endregion Best Practice #36, Always maintain updated comments. Use // or ///. //Get Employee Details Public Employee GetDetails(int employeeId) { } Best Practice #37, Follow Solid principles. Best Practice #38, Instead of using hardcoded values, use constants or read only properties. Best Practice #39, Always trim the reference values used for comparison. Best Practice #40,Use string.Empty instead of “”. We would love to hear from our users about the best practices used by them. Please write to...

Read More
18/12/2013: 10 Best Practices of programming from CodeSpread(21-30)
Dec18

18/12/2013: 10 Best Practices of programming from CodeSpread(21-30)

We love programming and having a knowledge of best practices always helps in writing beautiful code. We have shared first 20 random best practice in our previous articles 1-10, 11-20. More best practices from CodeSpread. Best Practice #21, A single huge EDMX file may hit the performance. So split the EDMX into multiple EDMXs. Best Practice #22, Perform minimum operations possible within one sql transaction Best Practice #23, Use more than one DataContext where each one can represent a single unit of work. This can remove the database objects that are not used frequently. Best Practice #24, SQL Query plans should be reused whenever possible as this can avoid unnecessary query compilation costs. Best Practice #25, Prefer DateTime.TryParse method over try/catch blocks. if (DateTime.TryParse(text, out result)) { // code } else { // throw error } Best Practice #26, While using select LINQ Query, return IQueryable and not a ‘var’ object. Best Practice #27, Do not use the unnecessary demo code which is available by default, while creating a new application. Best Practice #28, Place all the Scripts to the end of webpage. This will get downloaded once browser has downloaded all the other content and will help in progressive rendering of the page. Best Practice #29, ORDER BY,DISTINCT, TOP etc. operations may degrade query performance as they are performed only after the resultset is retrieved, so use them only when there is clear requirement. Best Practice #30, Use namespaces while defining contracts in WCF service. This will help with versioning and interaction of the application with other services. We would love to hear from our users about the best practices used by them. Please write to...

Read More
17/12/2013: 10 Best Practices of programming from CodeSpread(11-20)
Dec17

17/12/2013: 10 Best Practices of programming from CodeSpread(11-20)

We love programming and having a knowledge of best practices always helps in writing beautiful code. We have shared first 10 random best practice in our previous article here, now we are sharing few more best practices. Best Practice #11, Use StringBuilder instead of String, as any concat operation on String will create unnecessary successive string objects. In case of StringBuilder, any append operation will mutate the same object and will not create any successive objects. Best Practice #12, Use Integrated Mode in IIS 7.0 and above. This will avoid two separate application pipelines to handle native and managed components Best Practice #13, Use app_Offline.htm file, it is a user friendly way of keeping the application offline while doing some modification to the application. It also forces an application restart. Best Practice #14, Indexed views can increase performance of certain common queries without having to make temporary tables. Best Practice #15, Create a Custom Error page to show user friendly page while handling exceptions. The redirection logic can be written at the Page_Error event or the Application_Error event in Global.asax. Or use the below logic of web.config. Best Practice #16, Catch specific Exceptions in a try catch block. Create multiple catch block in a try-catch, and each catch block can be used to handle a specific exception type.  Last Catch should be base Exception. Best Practice #17, Use Try Catch Block in SQL Server to catch exceptions. Refer the screenshot. Best Practice #18, Use Regex class, if validation is required for controls other than server controls. Best Practice #19, While using Linq queries to retrieve a single item from a data collection, go with SingleOrDefault() instead of Single() to provide a fail-safe option. Best Practice #20, Avoid ‘using’ block in WCF and replace it with try/catch block. ‘using’ block can mask the faulted state of Service. In catch block, use close() or abort(). Although , all points above are debatable and it should be like this way, as only discussion can help to evolve best practices every time. One of our friend and fellow writer Rajaraman R have shared one of the best practice used by them, “I would also go for using capitalized letters in SQL Statements. That is a good practice.” Please refer comment section of our last...

Read More
Page 1 of 7123456...Last »