Scenario

A family is having dinner the father ask the daughter to “psWb” the daughter does as said then the mother asked the children to “fnFdFst” and also if they have “cmpltdHw” the children didnt respond.

Did you get what was the conversation ?

If yes (your are not human please get a checkup 😜)

If no , i am here to help !

Elaboration

A family is having dinner the father ask the daughter to “pass to water bottle” the daughter does as said then the mother asked the children to “finish food fast” and also if they have “completed their home work” the children didnt respond.

If you might have saw the functions/methods we write are same as this action words in the above sentences !

The Problem

public int unameVer(String email){

    try{

       if(doSomething)

          return 1;

       else

           return 0;

    } catch(Exception e) {

      return 0;

    }
}

Here can you guess what this method is doing without knowing what the whole implementation of method ? (what’s inside do something)

Your answer might be:-

The Fix

Treat functions like day to day actions

Write the function name as a verb representing action (And no SHOFOS (Short forms))

Have a correct return type



public boolean verifyEmail(String email){

    try{

       if(doSomething)

          return true;

       else

           return false;

    } catch(Exception e) {

      return false;

    }
}

Now is it more clear ?

Yes it is.

Bye,

Thanks and regards

Fellow blogger

Hope above was helpful for writing a better code.

%d bloggers like this: