Okay, with the title you may have guessed the content. Yeah! now it is about programming.
Sorry for the boring stuff๐. But in every nook and corner programming
is widespread like a disease and every new student is now trying to
learn to program, no matter what kind of studies they are pursuing,
either it is Mechanical or Electronics every one is shifting because of
two reasons.
- Programming and developing is absolutely fun as you go.๐
- Software jobs are easy to secure and lots of jobs are being created a day in and day out.๐
It
is not a blog that teaches any programming language or shows you how to
do any cool stuff like automating your birthday wishes reply in
WhatsApp. No, it's not. Then what it is all about? Hoping that you do
programming or you write code either in a programming platform or in any
school assignments or in any project development, I write this blog.๐
Nothing
new to say, just the old typical techniques. But the fact is that about
75% of programmers don't even follow those primitive rules to produce
good code.
Fine, now back to the topic
First and foremost,
if I ask people what is the powerful symbol in a programming language a
typical programmer would say "It's Semicolon". But what about people
who worship the snake, there is no symbol called semicolon, no braces,
just indentation. Then what would be the answer? Commenting. Yes, commenting makes the code powerful.
Commenting is not this๐๐
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. -Ryan Campbell
No one on this earth would be able to explain your code after a month if you didn't comment on it.
The second thing is making it readable,
Programs are meant to be read by humans and only incidentally for computers to execute. -Donald Knuth
Making
readable is not increasing the font size or changing the style, it is
all about the way you name your variables, functions, and classes. Name
it meaningfully, don't abbreviate it.
'n' is different from 'numberOfInputs'
Though it may seem a big work to do, it makes your code look gorgeous๐ after some time when you come and read it.๐
The next thing is the partitioning. Partition your program. Don't allow only your main program itself to do all the work. Define functions, call it, and use it.
And
while defining and naming the functions, be careful that you are
defining the functions only for what the name of the function says.
Don't make your function do more than the specified work in the name of
the function.
And finally, the important note is trying to reduce your lines of code with some logical thinking.
Before concluding this blog, I would like to let you know about Google CodeBase, which is a centralized source control system. It is a repository that contains roughly 2 Billion lines of code. People working over there are supposed to submit their code in it so that other people at Google can read that. But the thing is, the code base is programmed in a way that it accepts the code only after so many tests.
People working right there are supposed to write clean code with proper indentation, spacing, and much more. Google's codebase doesn't accept a
code if it fails any of those constraints.
Yeah! spaces between the "for loop's" three section are also mandatory to submit a code to the Google Code Base.
Hence
learning to write clean code is as important as learning to write powerful code. Hence I wrote this blog hoping that you'll find it useful. ๐
Happy coding!
Ps: Quote Source: College Laboratory ๐
As many good hearts suggested me to write a blog about the books I read, for sure the next blog will be about it.๐
That's for now, Subscribe๐ to the mail list if you like to receive any notification about the blog release.
Nice work...
ReplyDeleteThanks a lot ED..:)
Delete