SlideShare a Scribd company logo
1. Process Documentation
     2. Code Commenting

Code Commenting – First thing we learnt incorrectly as a Programmer

“Commenting your code is like cleaning your bathroom—you never want to do it, but it really
does create a more pleasant experience for you and your guests.”

What Microsoft Says:

1.    The purpose of adding comments to code is to provide an understandable description of what your
      code is doing.
2.    Comments should provide information that is not otherwise available from reading the code itself.
3.    Good comments are written at a higher level of abstraction than the code itself.
4.    Comments that only restate what is already obvious add nothing to the code and should be avoided.


What I think:
•     First and foremost, comments help you, the programmer, remember what you've done. This is
      especially important when debugging your code.
•     Well-placed comments can be very helpful in determining whether the code actually does what you
      think it does.
•     Comments that provide an “outline” of the algorithm can remind you what is happening at each stage
      of the program and also show us, the instructors, that you do know what's going on, even if it doesn't
      work correctly.
•   Comments will also be useful when others are trying to determine what your code does. Specifically, if you
    come to office hours with a question, comments can help us help you better. Also, if anyone (including you)
    sees your code at a much later date, the comments will provide insight into design decisions that you may not
    remember or that you may not be available to explain.


In addition, if your comments speak to how the code works, instead of to what it does, you have created
an additional code-maintenance problem, because comments that describe how code works must be
revised whenever you change the code. Failing to maintain these comments along with the code creates a
risk that the comments will no longer describe the code.


Summary:
1. Makes your understanding better.
2. Helps you as well as others in future and saves time.
3. Your logic becomes clearer when you comment along with code.
4. They should not state what code does.




Okay, so we agree that commenting code is a Good and Useful Practice. Now, why must we have a standard? In
    terms of this course, a standard gives us a way to evaluate your comments as part of the grading for each lab.
    Also, we know that standards are used extensively in industry, and we want you to gain experience working
    within prescribed parameters. In practice, you will likely be required to follow much more stringent coding
    standards than those given in this course.
Types of Comments

1.   Code Commenting
2.   Inline Commenting
3.   Function Commenting
4.   Class / Page Commenting

Code Commenting:
This refers to writing descriptive variable names that are self explanatory. This is a minimalist form of
     commenting, and looks like this:

      function AddUserToDatabase(string userName, int userAge)
Without any additional information, you can tell that the function will add a user’s name and age to a database


Inline Commenting:

Specifically, these types of comments come at the end of a line of code, but we can also use this term to refer
    to comments inside of a function as well. This is the most basic form of commenting.

     function AddUserToDatabase(string userName, string userAge)
     {
               if(userAge > 20)   // Under 20 users will go into Primary level
                         SaveUser(userName, userAge)
     }
Function Commenting :
This type of commenting is found on the lines above a function, and reveals all of the necessary details about that
function. This includes parameters, return values, and any logic quirks or decisions that were made:



        /*
                    Summary :               This function is used to save all secondary level
                                            users into existing database.
                    Parameters:             It takes 2 parameters. First one as user name
                                            and other one for user age.
                    Return:                 It returns true or false after the completion of
                                            process.
                    Author:                 Deepak Tripathi – 10-Dec-2011
                    Modifier:               1. Rohit On 11-Dec-2011(Changed User Age
                                               Condition from 20 to 25)
                                            2. Ajay On 1-Jan-2012 (Changed User Age
                                               Condition from 25 to 20)
        */
        function bool AddUserToDatabase(string userName, string userAge)
        {
                  if(userAge > 20)   // Under 20 users will go into Primary level
                            SaveUser(userName, userAge)
        }
Class / Page Commenting :
Comments that refer to an entire page or top level object fall into this category. Usually these comments include a
broad overview, last edit date, associated files, author, and contact information. Additionally, this may include a
general footer at the bottom of every page.


           /*
                       Summary : This function is used to save all secondary level
                                 users into existing database.
                       Author:   Deepak Tripathi – 10-Dec-2011
                       Modifier: 1. Rohit On 11-Dec-2011(Changed function
                                    AddUserToDatabas)
                                 2. Ajay On 1-Jan-2012 (Changed function
                                    AddUserToDatabas)
           */
           Namespace CarWale.CRM
           {
                     Public Class AddUsers : Page
                     {
                                  protected string from , to;
                                  void Page_Load(object Sender, EventArgs e)
                                  {
                                               AddUserToDatabase(“Deepak”, 27)
                                  }//Page Load
                                   function bool AddUserToDatabase(string userName, string userAge)
                                  {
                                               if(userAge > 20)// Under 20 users will go into Primary level
                                                            SaveUser(userName, userAge)
                                  } //AddUserToDatabase
                     }//Class
           }//NameSpace
Do’s and Don'ts:

Do’s:

1. Focus on readability of code
assume that you don't have comments to explain the code. Give your method, variables and class
meaningful name.

2. Precede comments by a blank line: Doing this creates a distinct separation between your code and
comments. Plus, it’s visually pleasing. Make sure comments are tabbed out to the line they are referencing.
Additionally, make sure similar comment types align when tabbed. Here’s an example:

           int maxUsers = 2                  //all players
           int maxPoints = 100000            //needed to win game

3. Comment each level with a consistent style
Comment each code block, using a uniform approach for each level. For example:
   • For each class, include a brief description, author and date of last modification
   • For each method, include a description of its purpose, functions, parameters and results

     There are many beliefs on the proper way to comment code. Some feel comments should be so
     detailed that a non programmer could follow the logic, while others believe you use comments for
     support. What matters most, I think, is that you are consistent in your commenting style. This helps
     your reader know what to expect when going through several different projects.

4. Use paragraph comments
Break code blocks into multiple “paragraphs” that each perform a single task, then add a comment at the
beginning of each block to instruct the reader on what is about to happen.
// Check that all data records are correct
           foreach (Record record in records)
           {
                      if (rec.checkStatus()==Status.OK)
                      {
                                   ...
                      }
           }
           // Now we begin to perform transactions
           Context ctx = new ApplicationContext();
           ctx.BeginTransaction();
           ...

5. Be polite
Avoid rude comments like, “Notice the stupid user has entered a negative number,” or “This fixes the side
effect produced by the pathetically inept implementation of the initial developer.” Such comments do not
reflect well upon their author, and you never know who may read these comments in the future: your
boss, a customer, or the pathetically inept developer you just insulted.

6. Use special tags for internal use
When working on code as a team, adopt a consistent set of tags to communicate among programmers. For
example, many teams use a “TODO:” tag to indicate a section of code that requires additional work:
     int Estimate(int x, int y)
     {
        // TODO: implement the calculations
        return 0;
     }
Tag comments don’t explain code; rather they seek attention or deliver a message. But if you use this
technique, remember to follow up and actually do what the message is asking.

7. Comment code while writing it
Add comments while you write code and it’s fresh in your memory. If you leave comments until the end, it
will take you twice as long, if you do it at all. “I have no time to comment,” “I’m in a hurry,” and “The project
is delayed” are all simply excuses to avoid documenting your code. Some developers believe you should
write comments before code as a way to plan out your ultimate solution. For example:

public void ProcessOrder()
{
  // Make sure the products are available
  // Check that the customer is valid
  // Send the order to the store
  // Generate bill
}

Commenting while you code forces you to make sure your logic “sounds right.” Plus, your comments are
going to be more accurate when the understanding of what’s going on behind-the-scenes is fresh in your
mind.

8. Write comments as if they were for you (in fact, they are)
When it comes to commenting code, think not only about the developers who will maintain your code in the
future, but also think about yourself.
“As soon as a line of code is laid on the screen, you’re in maintenance mode on that piece of code.”
As a result, we ourselves will be the first beneficiaries (or victims) of our good (or bad) comments.
9. Update comments when you update the code
There is no point in commenting correctly on code if the comments are not changed with the code. Both
code and comments must move in parallel, otherwise the comments will actually make life more difficult for
developers who maintain your code. Pay special attention to refactoring tools that automatically update
code but leave comments unchanged and hence obsolete in the same instant.

10. The golden rule of comments: readable code
One of the basic principles for many developers: Let your code speak for itself. Although one suspects this
movement is led by programmers who do not like to write comments, it is true that self-explanatory code
can go a long way toward making code that’s easier to understand and can even render comments
unnecessary. For example, the code in my Fluid Interfaces article shows how clear self-explanatory code can
be:

Calculator calc = new Calculator();
calc.Set(0);
calc.Add(10);
calc.Multiply(2);
calc.Subtract(4);
Console.WriteLine( "Result: {0}", calc.Get() );

In this example, comments are not needed. To facilitate readable code, you might consider using proper
names,ensure correct indentation, and adopt coding style guides. Failure to comply with this tip may result
in comments that seem to apologize for bad code.
11. Always try to finish your comment in as few words as possible, one liner comment is best until its
explaining "Why" part and can't be replaced by code itself. No body likes or has enough time to read longer
comment.

Closing brackets :
1        } // ... if see evil
2     } // ... while monkey do.
3 } // ... if monkey see.
4 } // ... class monkey
5} // ... namespace primate



Last but not the least give your code to fellow developer to understand as part of code review and ask him
how much he understands it.




Don’ts:
1. Don't write what code is doing: this should be left for the code to explain and can be easily done by giving
class, variable and method meaningful name. For example:
//calculates square root of given number
//using Newton-Raphson method

public void abc(int a)
{
             r = a / 2;
            while ( abs( r - (a/r)) > t )
            {
                        r = 0.5 * ( r + (a/r) );
            }
            System.out.println( "r = " + r );
}

Above code is calculating squate root using Newton-Raphson method and instead of writing comment you
can just rename your method and variable as follows:

public void squareRoot(int num)
{
            root = num/ 2;
            while ( abs(root - (num/ root) ) > t )
            {
                        r = 0.5 * (root + (num/ root));
            }
            System.out.println( " root = " + root );
}
2. Don't write story in comment as your name, employee id, your department etc because those
information can be obtained from cvs commit data in case someone wants to know who has make this
change.

3. It’s not design I see a lot of people use crazy characters all over the place and it’s really not necessary.
More often than not, it distracts from the business at hand. Keep it simple, keep it sweet.

4. Don’t insult the reader’s intelligence
Avoid obvious comments such as:

if (a == 5) // if a equals 5
    counter = 0; // set the counter to zero

This wastes your time writing needless comments and distracts the reader with details that can be easily
deduced from the code.
From - Deepak Tripathi

More Related Content

What's hot

Technical Interview
Technical InterviewTechnical Interview
Technical Interview
prashant patel
 
Java interview-questions-and-answers
Java interview-questions-and-answersJava interview-questions-and-answers
Java interview-questions-and-answers
bestonlinetrainers
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
Kuntal Bhowmick
 
Jdbc 1
Jdbc 1Jdbc 1
The Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.NetThe Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.Net
Anand Kumar Rajana
 
Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...
Akhil Mittal
 
Programmatic login with servlet 3.0
Programmatic login with servlet 3.0Programmatic login with servlet 3.0
Programmatic login with servlet 3.0
Abani Behera
 
C# interview-questions
C# interview-questionsC# interview-questions
C# interview-questions
nicolbiden
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questions
SynergisticMedia
 
Core java
Core javaCore java
Core java
Mallikarjuna G D
 
Best interview questions
Best interview questionsBest interview questions
Best interview questions
Thesis Scientist Private Limited
 
Murach : How to develop a single-page MVC web
Murach : How to develop a single-page MVC web Murach : How to develop a single-page MVC web
Murach : How to develop a single-page MVC web
MahmoudOHassouna
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questions
Soba Arjun
 
Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++
Blue Elephant Consulting
 
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic Concepts
Aashish Jain
 
Java j2ee interview_questions
Java j2ee interview_questionsJava j2ee interview_questions
Java j2ee interview_questions
ppratik86
 
9 crucial Java Design Principles you cannot miss
9 crucial Java Design Principles you cannot miss9 crucial Java Design Principles you cannot miss
9 crucial Java Design Principles you cannot miss
Mark Papis
 
Accelerate your Lotus Domino Web Applications with Dojo and XPages
Accelerate your Lotus Domino Web Applications with Dojo and XPagesAccelerate your Lotus Domino Web Applications with Dojo and XPages
Accelerate your Lotus Domino Web Applications with Dojo and XPages
Davalen LLC
 
Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questions
Rohit Singh
 

What's hot (19)

Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Java interview-questions-and-answers
Java interview-questions-and-answersJava interview-questions-and-answers
Java interview-questions-and-answers
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
 
Jdbc 1
Jdbc 1Jdbc 1
Jdbc 1
 
The Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.NetThe Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.Net
 
Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...
 
Programmatic login with servlet 3.0
Programmatic login with servlet 3.0Programmatic login with servlet 3.0
Programmatic login with servlet 3.0
 
C# interview-questions
C# interview-questionsC# interview-questions
C# interview-questions
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questions
 
Core java
Core javaCore java
Core java
 
Best interview questions
Best interview questionsBest interview questions
Best interview questions
 
Murach : How to develop a single-page MVC web
Murach : How to develop a single-page MVC web Murach : How to develop a single-page MVC web
Murach : How to develop a single-page MVC web
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questions
 
Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++
 
Let's start with Java- Basic Concepts
Let's start with Java- Basic ConceptsLet's start with Java- Basic Concepts
Let's start with Java- Basic Concepts
 
Java j2ee interview_questions
Java j2ee interview_questionsJava j2ee interview_questions
Java j2ee interview_questions
 
9 crucial Java Design Principles you cannot miss
9 crucial Java Design Principles you cannot miss9 crucial Java Design Principles you cannot miss
9 crucial Java Design Principles you cannot miss
 
Accelerate your Lotus Domino Web Applications with Dojo and XPages
Accelerate your Lotus Domino Web Applications with Dojo and XPagesAccelerate your Lotus Domino Web Applications with Dojo and XPages
Accelerate your Lotus Domino Web Applications with Dojo and XPages
 
Core java interview questions
Core java interview questionsCore java interview questions
Core java interview questions
 

Viewers also liked

Et 0917
Et 0917Et 0917
Et 0917
Seok Lee
 
Hirschmann: Automotive SPICE Requirements for development process and tools
Hirschmann: Automotive SPICE Requirements for development process and tools Hirschmann: Automotive SPICE Requirements for development process and tools
Hirschmann: Automotive SPICE Requirements for development process and tools
Intland Software GmbH
 
Marketing Research -- BMW
Marketing Research -- BMWMarketing Research -- BMW
Marketing Research -- BMW
christywinter
 
Maruti 800 ppt
Maruti 800 pptMaruti 800 ppt
Maruti 800 ppt
Dhiraj Kumar Golla
 
new product development and product life-cycle strategies
new product development and product life-cycle strategies new product development and product life-cycle strategies
new product development and product life-cycle strategies
sabaAkhan47
 
Project Management In The Automotive Industry
Project Management In The Automotive IndustryProject Management In The Automotive Industry
Project Management In The Automotive Industry
Gestion Projet Auto
 
BMW Case Study
BMW Case StudyBMW Case Study
BMW Case Study
Hyosuk Kang
 

Viewers also liked (7)

Et 0917
Et 0917Et 0917
Et 0917
 
Hirschmann: Automotive SPICE Requirements for development process and tools
Hirschmann: Automotive SPICE Requirements for development process and tools Hirschmann: Automotive SPICE Requirements for development process and tools
Hirschmann: Automotive SPICE Requirements for development process and tools
 
Marketing Research -- BMW
Marketing Research -- BMWMarketing Research -- BMW
Marketing Research -- BMW
 
Maruti 800 ppt
Maruti 800 pptMaruti 800 ppt
Maruti 800 ppt
 
new product development and product life-cycle strategies
new product development and product life-cycle strategies new product development and product life-cycle strategies
new product development and product life-cycle strategies
 
Project Management In The Automotive Industry
Project Management In The Automotive IndustryProject Management In The Automotive Industry
Project Management In The Automotive Industry
 
BMW Case Study
BMW Case StudyBMW Case Study
BMW Case Study
 

Similar to Poject documentation deepak

NamingConvention
NamingConventionNamingConvention
NamingConvention
Jabed Hossain
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
Nicole Gomez
 
Android coding guide lines
Android coding guide linesAndroid coding guide lines
Android coding guide lines
lokeshG38
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...
Christos Manios
 
DDD with Behat
DDD with BehatDDD with Behat
DDD with Behat
Anton Serdyuk
 
Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...
Katy Slemon
 
Django tutorial
Django tutorialDjango tutorial
Django tutorial
Ksd Che
 
Jmp108
Jmp108Jmp108
Jmp108
John Head
 
Android application architecture
Android application architectureAndroid application architecture
Android application architecture
Romain Rochegude
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software development
Mitosis Technology
 
React Best Practices All Developers Should Follow in 2024.pdf
React Best Practices All Developers Should Follow in 2024.pdfReact Best Practices All Developers Should Follow in 2024.pdf
React Best Practices All Developers Should Follow in 2024.pdf
BOSC Tech Labs
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
Robin O'Brien
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
Divyang Bhambhani
 
srt311 Project2
srt311 Project2srt311 Project2
srt311 Project2
trayyoo
 
76829060 java-coding-conventions
76829060 java-coding-conventions76829060 java-coding-conventions
76829060 java-coding-conventions
slavicp
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
 
How to increase the ui performance of apps designed using react
How to increase the ui performance of apps designed using react How to increase the ui performance of apps designed using react
How to increase the ui performance of apps designed using react
MoonTechnolabsPvtLtd
 
Multi-tenancy with Rails
Multi-tenancy with RailsMulti-tenancy with Rails
Multi-tenancy with Rails
Paul Gallagher
 
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfcreate-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdf
ShaiAlmog1
 
Java Docs
Java DocsJava Docs

Similar to Poject documentation deepak (20)

NamingConvention
NamingConventionNamingConvention
NamingConvention
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
 
Android coding guide lines
Android coding guide linesAndroid coding guide lines
Android coding guide lines
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...
 
DDD with Behat
DDD with BehatDDD with Behat
DDD with Behat
 
Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...Redux and context api with react native app introduction, use cases, implemen...
Redux and context api with react native app introduction, use cases, implemen...
 
Django tutorial
Django tutorialDjango tutorial
Django tutorial
 
Jmp108
Jmp108Jmp108
Jmp108
 
Android application architecture
Android application architectureAndroid application architecture
Android application architecture
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software development
 
React Best Practices All Developers Should Follow in 2024.pdf
React Best Practices All Developers Should Follow in 2024.pdfReact Best Practices All Developers Should Follow in 2024.pdf
React Best Practices All Developers Should Follow in 2024.pdf
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
 
srt311 Project2
srt311 Project2srt311 Project2
srt311 Project2
 
76829060 java-coding-conventions
76829060 java-coding-conventions76829060 java-coding-conventions
76829060 java-coding-conventions
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
 
How to increase the ui performance of apps designed using react
How to increase the ui performance of apps designed using react How to increase the ui performance of apps designed using react
How to increase the ui performance of apps designed using react
 
Multi-tenancy with Rails
Multi-tenancy with RailsMulti-tenancy with Rails
Multi-tenancy with Rails
 
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfcreate-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdf
 
Java Docs
Java DocsJava Docs
Java Docs
 

Recently uploaded

CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdfCHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
rishi2789
 
K CỔ TỬ CUNG.pdf tự ghi chép, chữ hơi xấu
K CỔ TỬ CUNG.pdf tự ghi chép, chữ hơi xấuK CỔ TỬ CUNG.pdf tự ghi chép, chữ hơi xấu
K CỔ TỬ CUNG.pdf tự ghi chép, chữ hơi xấu
HongBiThi1
 
Alzheimer’s Disease Case Conference: Gearing Up for the Expanding Role of Neu...
Alzheimer’s Disease Case Conference: Gearing Up for the Expanding Role of Neu...Alzheimer’s Disease Case Conference: Gearing Up for the Expanding Role of Neu...
Alzheimer’s Disease Case Conference: Gearing Up for the Expanding Role of Neu...
PVI, PeerView Institute for Medical Education
 
Tele Optometry (kunj'sppt) / Basics of tele optometry.
Tele Optometry (kunj'sppt) / Basics of tele optometry.Tele Optometry (kunj'sppt) / Basics of tele optometry.
Tele Optometry (kunj'sppt) / Basics of tele optometry.
Kunj Vihari
 
Cell Therapy Expansion and Challenges in Autoimmune Disease
Cell Therapy Expansion and Challenges in Autoimmune DiseaseCell Therapy Expansion and Challenges in Autoimmune Disease
Cell Therapy Expansion and Challenges in Autoimmune Disease
Health Advances
 
Cervical Disc Arthroplasty ORSI 2024.pptx
Cervical Disc Arthroplasty ORSI 2024.pptxCervical Disc Arthroplasty ORSI 2024.pptx
Cervical Disc Arthroplasty ORSI 2024.pptx
LEFLOT Jean-Louis
 
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotesPromoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
PsychoTech Services
 
Travel Clinic Cardiff: Health Advice for International Travelers
Travel Clinic Cardiff: Health Advice for International TravelersTravel Clinic Cardiff: Health Advice for International Travelers
Travel Clinic Cardiff: Health Advice for International Travelers
NX Healthcare
 
Cosmetology and Trichology Courses at Kosmoderma Academy PRP (Hair), DR Growt...
Cosmetology and Trichology Courses at Kosmoderma Academy PRP (Hair), DR Growt...Cosmetology and Trichology Courses at Kosmoderma Academy PRP (Hair), DR Growt...
Cosmetology and Trichology Courses at Kosmoderma Academy PRP (Hair), DR Growt...
Kosmoderma Academy Of Aesthetic Medicine
 
NARCOTICS- POLICY AND PROCEDURES FOR ITS USE
NARCOTICS- POLICY AND PROCEDURES FOR ITS USENARCOTICS- POLICY AND PROCEDURES FOR ITS USE
NARCOTICS- POLICY AND PROCEDURES FOR ITS USE
Dr. Ahana Haroon
 
Pharmacology of 5-hydroxytryptamine and Antagonist
Pharmacology of 5-hydroxytryptamine and AntagonistPharmacology of 5-hydroxytryptamine and Antagonist
Pharmacology of 5-hydroxytryptamine and Antagonist
Dr. Nikhilkumar Sakle
 
CBL Seminar 2024_Preliminary Program.pdf
CBL Seminar 2024_Preliminary Program.pdfCBL Seminar 2024_Preliminary Program.pdf
CBL Seminar 2024_Preliminary Program.pdf
suvadeepdas911
 
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdfCHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
rishi2789
 
How to Control Your Asthma Tips by gokuldas hospital.
How to Control Your Asthma Tips by gokuldas hospital.How to Control Your Asthma Tips by gokuldas hospital.
How to Control Your Asthma Tips by gokuldas hospital.
Gokuldas Hospital
 
NAVIGATING THE HORIZONS OF TIME LAPSE EMBRYO MONITORING.pdf
NAVIGATING THE HORIZONS OF TIME LAPSE EMBRYO MONITORING.pdfNAVIGATING THE HORIZONS OF TIME LAPSE EMBRYO MONITORING.pdf
NAVIGATING THE HORIZONS OF TIME LAPSE EMBRYO MONITORING.pdf
Rahul Sen
 
Lecture 6 -- Memory 2015.pptlearning occurs when a stimulus (unconditioned st...
Lecture 6 -- Memory 2015.pptlearning occurs when a stimulus (unconditioned st...Lecture 6 -- Memory 2015.pptlearning occurs when a stimulus (unconditioned st...
Lecture 6 -- Memory 2015.pptlearning occurs when a stimulus (unconditioned st...
AyushGadhvi1
 
DECLARATION OF HELSINKI - History and principles
DECLARATION OF HELSINKI - History and principlesDECLARATION OF HELSINKI - History and principles
DECLARATION OF HELSINKI - History and principles
anaghabharat01
 
SENSORY NEEDS B.SC. NURSING SEMESTER II.
SENSORY NEEDS B.SC. NURSING SEMESTER II.SENSORY NEEDS B.SC. NURSING SEMESTER II.
SENSORY NEEDS B.SC. NURSING SEMESTER II.
KULDEEP VYAS
 
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdfCHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
rishi2789
 
The Nervous and Chemical Regulation of Respiration
The Nervous and Chemical Regulation of RespirationThe Nervous and Chemical Regulation of Respiration
The Nervous and Chemical Regulation of Respiration
MedicoseAcademics
 

Recently uploaded (20)

CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdfCHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
CHEMOTHERAPY_RDP_CHAPTER 6_Anti Malarial Drugs.pdf
 
K CỔ TỬ CUNG.pdf tự ghi chép, chữ hơi xấu
K CỔ TỬ CUNG.pdf tự ghi chép, chữ hơi xấuK CỔ TỬ CUNG.pdf tự ghi chép, chữ hơi xấu
K CỔ TỬ CUNG.pdf tự ghi chép, chữ hơi xấu
 
Alzheimer’s Disease Case Conference: Gearing Up for the Expanding Role of Neu...
Alzheimer’s Disease Case Conference: Gearing Up for the Expanding Role of Neu...Alzheimer’s Disease Case Conference: Gearing Up for the Expanding Role of Neu...
Alzheimer’s Disease Case Conference: Gearing Up for the Expanding Role of Neu...
 
Tele Optometry (kunj'sppt) / Basics of tele optometry.
Tele Optometry (kunj'sppt) / Basics of tele optometry.Tele Optometry (kunj'sppt) / Basics of tele optometry.
Tele Optometry (kunj'sppt) / Basics of tele optometry.
 
Cell Therapy Expansion and Challenges in Autoimmune Disease
Cell Therapy Expansion and Challenges in Autoimmune DiseaseCell Therapy Expansion and Challenges in Autoimmune Disease
Cell Therapy Expansion and Challenges in Autoimmune Disease
 
Cervical Disc Arthroplasty ORSI 2024.pptx
Cervical Disc Arthroplasty ORSI 2024.pptxCervical Disc Arthroplasty ORSI 2024.pptx
Cervical Disc Arthroplasty ORSI 2024.pptx
 
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotesPromoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
Promoting Wellbeing - Applied Social Psychology - Psychology SuperNotes
 
Travel Clinic Cardiff: Health Advice for International Travelers
Travel Clinic Cardiff: Health Advice for International TravelersTravel Clinic Cardiff: Health Advice for International Travelers
Travel Clinic Cardiff: Health Advice for International Travelers
 
Cosmetology and Trichology Courses at Kosmoderma Academy PRP (Hair), DR Growt...
Cosmetology and Trichology Courses at Kosmoderma Academy PRP (Hair), DR Growt...Cosmetology and Trichology Courses at Kosmoderma Academy PRP (Hair), DR Growt...
Cosmetology and Trichology Courses at Kosmoderma Academy PRP (Hair), DR Growt...
 
NARCOTICS- POLICY AND PROCEDURES FOR ITS USE
NARCOTICS- POLICY AND PROCEDURES FOR ITS USENARCOTICS- POLICY AND PROCEDURES FOR ITS USE
NARCOTICS- POLICY AND PROCEDURES FOR ITS USE
 
Pharmacology of 5-hydroxytryptamine and Antagonist
Pharmacology of 5-hydroxytryptamine and AntagonistPharmacology of 5-hydroxytryptamine and Antagonist
Pharmacology of 5-hydroxytryptamine and Antagonist
 
CBL Seminar 2024_Preliminary Program.pdf
CBL Seminar 2024_Preliminary Program.pdfCBL Seminar 2024_Preliminary Program.pdf
CBL Seminar 2024_Preliminary Program.pdf
 
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdfCHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
CHEMOTHERAPY_RDP_CHAPTER 4_ANTI VIRAL DRUGS.pdf
 
How to Control Your Asthma Tips by gokuldas hospital.
How to Control Your Asthma Tips by gokuldas hospital.How to Control Your Asthma Tips by gokuldas hospital.
How to Control Your Asthma Tips by gokuldas hospital.
 
NAVIGATING THE HORIZONS OF TIME LAPSE EMBRYO MONITORING.pdf
NAVIGATING THE HORIZONS OF TIME LAPSE EMBRYO MONITORING.pdfNAVIGATING THE HORIZONS OF TIME LAPSE EMBRYO MONITORING.pdf
NAVIGATING THE HORIZONS OF TIME LAPSE EMBRYO MONITORING.pdf
 
Lecture 6 -- Memory 2015.pptlearning occurs when a stimulus (unconditioned st...
Lecture 6 -- Memory 2015.pptlearning occurs when a stimulus (unconditioned st...Lecture 6 -- Memory 2015.pptlearning occurs when a stimulus (unconditioned st...
Lecture 6 -- Memory 2015.pptlearning occurs when a stimulus (unconditioned st...
 
DECLARATION OF HELSINKI - History and principles
DECLARATION OF HELSINKI - History and principlesDECLARATION OF HELSINKI - History and principles
DECLARATION OF HELSINKI - History and principles
 
SENSORY NEEDS B.SC. NURSING SEMESTER II.
SENSORY NEEDS B.SC. NURSING SEMESTER II.SENSORY NEEDS B.SC. NURSING SEMESTER II.
SENSORY NEEDS B.SC. NURSING SEMESTER II.
 
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdfCHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
CHEMOTHERAPY_RDP_CHAPTER 3_ANTIFUNGAL AGENT.pdf
 
The Nervous and Chemical Regulation of Respiration
The Nervous and Chemical Regulation of RespirationThe Nervous and Chemical Regulation of Respiration
The Nervous and Chemical Regulation of Respiration
 

Poject documentation deepak

  • 1.
  • 2. 1. Process Documentation 2. Code Commenting Code Commenting – First thing we learnt incorrectly as a Programmer “Commenting your code is like cleaning your bathroom—you never want to do it, but it really does create a more pleasant experience for you and your guests.” What Microsoft Says: 1. The purpose of adding comments to code is to provide an understandable description of what your code is doing. 2. Comments should provide information that is not otherwise available from reading the code itself. 3. Good comments are written at a higher level of abstraction than the code itself. 4. Comments that only restate what is already obvious add nothing to the code and should be avoided. What I think: • First and foremost, comments help you, the programmer, remember what you've done. This is especially important when debugging your code. • Well-placed comments can be very helpful in determining whether the code actually does what you think it does. • Comments that provide an “outline” of the algorithm can remind you what is happening at each stage of the program and also show us, the instructors, that you do know what's going on, even if it doesn't work correctly.
  • 3. Comments will also be useful when others are trying to determine what your code does. Specifically, if you come to office hours with a question, comments can help us help you better. Also, if anyone (including you) sees your code at a much later date, the comments will provide insight into design decisions that you may not remember or that you may not be available to explain. In addition, if your comments speak to how the code works, instead of to what it does, you have created an additional code-maintenance problem, because comments that describe how code works must be revised whenever you change the code. Failing to maintain these comments along with the code creates a risk that the comments will no longer describe the code. Summary: 1. Makes your understanding better. 2. Helps you as well as others in future and saves time. 3. Your logic becomes clearer when you comment along with code. 4. They should not state what code does. Okay, so we agree that commenting code is a Good and Useful Practice. Now, why must we have a standard? In terms of this course, a standard gives us a way to evaluate your comments as part of the grading for each lab. Also, we know that standards are used extensively in industry, and we want you to gain experience working within prescribed parameters. In practice, you will likely be required to follow much more stringent coding standards than those given in this course.
  • 4. Types of Comments 1. Code Commenting 2. Inline Commenting 3. Function Commenting 4. Class / Page Commenting Code Commenting: This refers to writing descriptive variable names that are self explanatory. This is a minimalist form of commenting, and looks like this: function AddUserToDatabase(string userName, int userAge) Without any additional information, you can tell that the function will add a user’s name and age to a database Inline Commenting: Specifically, these types of comments come at the end of a line of code, but we can also use this term to refer to comments inside of a function as well. This is the most basic form of commenting. function AddUserToDatabase(string userName, string userAge) { if(userAge > 20) // Under 20 users will go into Primary level SaveUser(userName, userAge) }
  • 5. Function Commenting : This type of commenting is found on the lines above a function, and reveals all of the necessary details about that function. This includes parameters, return values, and any logic quirks or decisions that were made: /* Summary : This function is used to save all secondary level users into existing database. Parameters: It takes 2 parameters. First one as user name and other one for user age. Return: It returns true or false after the completion of process. Author: Deepak Tripathi – 10-Dec-2011 Modifier: 1. Rohit On 11-Dec-2011(Changed User Age Condition from 20 to 25) 2. Ajay On 1-Jan-2012 (Changed User Age Condition from 25 to 20) */ function bool AddUserToDatabase(string userName, string userAge) { if(userAge > 20) // Under 20 users will go into Primary level SaveUser(userName, userAge) }
  • 6. Class / Page Commenting : Comments that refer to an entire page or top level object fall into this category. Usually these comments include a broad overview, last edit date, associated files, author, and contact information. Additionally, this may include a general footer at the bottom of every page. /* Summary : This function is used to save all secondary level users into existing database. Author: Deepak Tripathi – 10-Dec-2011 Modifier: 1. Rohit On 11-Dec-2011(Changed function AddUserToDatabas) 2. Ajay On 1-Jan-2012 (Changed function AddUserToDatabas) */ Namespace CarWale.CRM { Public Class AddUsers : Page { protected string from , to; void Page_Load(object Sender, EventArgs e) { AddUserToDatabase(“Deepak”, 27) }//Page Load function bool AddUserToDatabase(string userName, string userAge) { if(userAge > 20)// Under 20 users will go into Primary level SaveUser(userName, userAge) } //AddUserToDatabase }//Class }//NameSpace
  • 7. Do’s and Don'ts: Do’s: 1. Focus on readability of code assume that you don't have comments to explain the code. Give your method, variables and class meaningful name. 2. Precede comments by a blank line: Doing this creates a distinct separation between your code and comments. Plus, it’s visually pleasing. Make sure comments are tabbed out to the line they are referencing. Additionally, make sure similar comment types align when tabbed. Here’s an example: int maxUsers = 2 //all players int maxPoints = 100000 //needed to win game 3. Comment each level with a consistent style Comment each code block, using a uniform approach for each level. For example: • For each class, include a brief description, author and date of last modification • For each method, include a description of its purpose, functions, parameters and results There are many beliefs on the proper way to comment code. Some feel comments should be so detailed that a non programmer could follow the logic, while others believe you use comments for support. What matters most, I think, is that you are consistent in your commenting style. This helps your reader know what to expect when going through several different projects. 4. Use paragraph comments Break code blocks into multiple “paragraphs” that each perform a single task, then add a comment at the beginning of each block to instruct the reader on what is about to happen.
  • 8. // Check that all data records are correct foreach (Record record in records) { if (rec.checkStatus()==Status.OK) { ... } } // Now we begin to perform transactions Context ctx = new ApplicationContext(); ctx.BeginTransaction(); ... 5. Be polite Avoid rude comments like, “Notice the stupid user has entered a negative number,” or “This fixes the side effect produced by the pathetically inept implementation of the initial developer.” Such comments do not reflect well upon their author, and you never know who may read these comments in the future: your boss, a customer, or the pathetically inept developer you just insulted. 6. Use special tags for internal use When working on code as a team, adopt a consistent set of tags to communicate among programmers. For example, many teams use a “TODO:” tag to indicate a section of code that requires additional work: int Estimate(int x, int y) { // TODO: implement the calculations return 0; }
  • 9. Tag comments don’t explain code; rather they seek attention or deliver a message. But if you use this technique, remember to follow up and actually do what the message is asking. 7. Comment code while writing it Add comments while you write code and it’s fresh in your memory. If you leave comments until the end, it will take you twice as long, if you do it at all. “I have no time to comment,” “I’m in a hurry,” and “The project is delayed” are all simply excuses to avoid documenting your code. Some developers believe you should write comments before code as a way to plan out your ultimate solution. For example: public void ProcessOrder() { // Make sure the products are available // Check that the customer is valid // Send the order to the store // Generate bill } Commenting while you code forces you to make sure your logic “sounds right.” Plus, your comments are going to be more accurate when the understanding of what’s going on behind-the-scenes is fresh in your mind. 8. Write comments as if they were for you (in fact, they are) When it comes to commenting code, think not only about the developers who will maintain your code in the future, but also think about yourself. “As soon as a line of code is laid on the screen, you’re in maintenance mode on that piece of code.” As a result, we ourselves will be the first beneficiaries (or victims) of our good (or bad) comments.
  • 10. 9. Update comments when you update the code There is no point in commenting correctly on code if the comments are not changed with the code. Both code and comments must move in parallel, otherwise the comments will actually make life more difficult for developers who maintain your code. Pay special attention to refactoring tools that automatically update code but leave comments unchanged and hence obsolete in the same instant. 10. The golden rule of comments: readable code One of the basic principles for many developers: Let your code speak for itself. Although one suspects this movement is led by programmers who do not like to write comments, it is true that self-explanatory code can go a long way toward making code that’s easier to understand and can even render comments unnecessary. For example, the code in my Fluid Interfaces article shows how clear self-explanatory code can be: Calculator calc = new Calculator(); calc.Set(0); calc.Add(10); calc.Multiply(2); calc.Subtract(4); Console.WriteLine( "Result: {0}", calc.Get() ); In this example, comments are not needed. To facilitate readable code, you might consider using proper names,ensure correct indentation, and adopt coding style guides. Failure to comply with this tip may result in comments that seem to apologize for bad code.
  • 11. 11. Always try to finish your comment in as few words as possible, one liner comment is best until its explaining "Why" part and can't be replaced by code itself. No body likes or has enough time to read longer comment. Closing brackets : 1 } // ... if see evil 2 } // ... while monkey do. 3 } // ... if monkey see. 4 } // ... class monkey 5} // ... namespace primate Last but not the least give your code to fellow developer to understand as part of code review and ask him how much he understands it. Don’ts: 1. Don't write what code is doing: this should be left for the code to explain and can be easily done by giving class, variable and method meaningful name. For example:
  • 12. //calculates square root of given number //using Newton-Raphson method public void abc(int a) { r = a / 2; while ( abs( r - (a/r)) > t ) { r = 0.5 * ( r + (a/r) ); } System.out.println( "r = " + r ); } Above code is calculating squate root using Newton-Raphson method and instead of writing comment you can just rename your method and variable as follows: public void squareRoot(int num) { root = num/ 2; while ( abs(root - (num/ root) ) > t ) { r = 0.5 * (root + (num/ root)); } System.out.println( " root = " + root ); }
  • 13. 2. Don't write story in comment as your name, employee id, your department etc because those information can be obtained from cvs commit data in case someone wants to know who has make this change. 3. It’s not design I see a lot of people use crazy characters all over the place and it’s really not necessary. More often than not, it distracts from the business at hand. Keep it simple, keep it sweet. 4. Don’t insult the reader’s intelligence Avoid obvious comments such as: if (a == 5) // if a equals 5 counter = 0; // set the counter to zero This wastes your time writing needless comments and distracts the reader with details that can be easily deduced from the code.
  • 14. From - Deepak Tripathi