avatarGwang Jin Kim, PhD

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

1122

Abstract

ce or its readability by changing this or that part.</p><p id="89b1">But because you copy-pasted countless times the same function(s) over and over again, it is tedious to upgrade all the function definitions in the entirety of your codebase.</p><p id="f1a4">What if you would have learned from the start on how to create a package in your programming language? And if you — in your entire computer — have only a single place where you define any single function?</p><ol><li>You would know exactly where your function is defined. And <code>grep</code>ing for the function definition start would result in exactly one hit in your package.</li><li>If you improve/refactor any of your functions, you would be sure that the improvements would be valid for any occurrences of the function in our code. (Of course, you would improve always in a backward-compatible manner, so that no old code gets broken).</li><li>You would never scratch your head where this improved version of your code is located, waste tons of time searching for it, then give up and have to reinvent the improvement again (it happened to me countless time

Options

s, unfortunately).</li><li>Your functions will evolve with time — no effort would be wasted. There is no better feeling than to know that your code is well-organized and no effort done in the past is ever wasted.</li><li>You would discipline yourself to write reusable code.</li><li>You can use the saved time to improve the documentation of your function.</li><li>You can contribute to the community by providing them your well-documented package at some point.</li></ol><p id="5c0a">If I had a time machine and would travel back to the time where I started programming, it would be to define any of the functions in just one place in nicely documented packages in this language.</p><p id="fbf4">It would have saved me tons of (search) time and effort. And it would have made me write and publish more packages not only for myself but also for other’s work, too.</p><p id="b6ef">In Python, this would mean to learn to write packages using the <code>poetry</code> package about which I will write soon.</p><p id="7eaf"><i>More content at <a href="http://plainenglish.io"><b>plainenglish.io</b></a></i></p></article></body>

Programming Advice I Wished Somebody Would Have Told Me

Advice to Beginner Programmers

Photo by Laura Ockel on Unsplash

Right now I am leaving my second programming position (Bioinformatics Postdoctoral Research in a University). Time to look back and asking myself: What I have learned? What would I do differently when I would start this job again?

The most important piece of advice I wished somebody would have told me four years ago would have been: Centralize your code! — Learn right at the beginning how to write packages in your programming language!

How often did you as a programming novice copy over and over again the same function? At the n-th copy, you realize you could improve the code or its performance or its readability by changing this or that part.

But because you copy-pasted countless times the same function(s) over and over again, it is tedious to upgrade all the function definitions in the entirety of your codebase.

What if you would have learned from the start on how to create a package in your programming language? And if you — in your entire computer — have only a single place where you define any single function?

  1. You would know exactly where your function is defined. And greping for the function definition start would result in exactly one hit in your package.
  2. If you improve/refactor any of your functions, you would be sure that the improvements would be valid for any occurrences of the function in our code. (Of course, you would improve always in a backward-compatible manner, so that no old code gets broken).
  3. You would never scratch your head where this improved version of your code is located, waste tons of time searching for it, then give up and have to reinvent the improvement again (it happened to me countless times, unfortunately).
  4. Your functions will evolve with time — no effort would be wasted. There is no better feeling than to know that your code is well-organized and no effort done in the past is ever wasted.
  5. You would discipline yourself to write reusable code.
  6. You can use the saved time to improve the documentation of your function.
  7. You can contribute to the community by providing them your well-documented package at some point.

If I had a time machine and would travel back to the time where I started programming, it would be to define any of the functions in just one place in nicely documented packages in this language.

It would have saved me tons of (search) time and effort. And it would have made me write and publish more packages not only for myself but also for other’s work, too.

In Python, this would mean to learn to write packages using the poetry package about which I will write soon.

More content at plainenglish.io

Python
Python Programming
Advice
Programming
Software Development
Recommended from ReadMedium