So, as the tone of this journey undergoes a metamorphosis, we will hold a discussion on object-oriented programming and function declarations. However, since this isn't an overview on specifically how to do any of this, then that portion of the post will be brief; although I will still link any resources I've used or found useful in my educational exploration. That is to say, across both languages of Python and C#, you can easily declare classes, constructors, and objects. Tutorials Point actually has a very nice, and what I consider to be a comprehensive, overview of how to do exactly these things in Python; titled Python - Object Oriented. As for functions and their declarations, Tutorials Point also has a section on that as well, titled Python - Functions.
Now then, as for how this particularly ties together with Clean Code and the previous post; since, very clearly, there wasn't any mention of coding practices in that one. That connection would be the subject of meaningful names. Whether in the form of declaring variables, arrays, lists, functions, objects, classes, et cetera, the name of the declared item should be sufficiently explanatory of what that item represents. That is to say, "If a name requires a comment, then the name does not reveal the intent."
Now, let's look at an example from some code with which I've been working. In particular, a data frame. Which is like the Python version of a temporarily held database object and they're usually prefixed by "df_". So, suppose you have a name such as "df_HR". While it may be possible to infer the meaning of such a name given the context of the data being analyzed, it slightly violates the tenet of "literate" mentioned in my first post. This is so since it makes the assumption that the person reading the code after the fact is inherently familiar with the subject matter or the initial data set. Now, I will admit that I did take some liberties and chose "df_humRes", but even that wouldn't hurt to be written fully as "df_humanResources" or "df_human_resources" if I wasn't being lazy or writing a template I intend to change at a later date. So, if you're keeping up with my GitHub projects, then yes, I'm going to admit now that I'll probably change that for legibility in a later refactoring event.
Moreover, within your descriptive nomenclature, it is highly important to avoid misinformation. That is, while it is imperative to avoid leaving false clues and obscuring your code's intent, it is equivalently imperative to be mindful of spelling. To state it explicitly, "Spelling similar concepts similarly is information", then anything else, including but limited to inconsistent spellings however unintentional, is by definition misinformation. Thankfully, most IDEs now have code completion features which help to mitigate these unintentional misspellings.
Personally, I've become a fan of Droid Edit, Atom, VSCode, PyDroid 3, Spyder, and most recently VIM. Now, I'm sure you've noticed that these aren't all on a personal computer, mac, or laptop; for a while, I had to write code on mobile so I needed an editor for that too.
That being said, I often find myself writing these things as if they were an essay or otherwise a really long paper. In the sense that, there are often several drafts before a final copy is made. In the mathematics related coursework, the ones that have direct ties to any programming languages, there is often a disconnect between writing something to be used by many and writing something to find a solution so you can move on to the next stage. Much the same is true for many of the other hard science courses; physics, chemistry. While biology is a wet science, I haven't done much computational work in that area (read: any computational work) so I am loathed to comment on their practices. That is, much of the "programs" aren't what programmers would call "programs", or "production ready". Therefore, throughout the learning process of the students in these majors, although they may gain a deep understanding and respect of the scientific material and thus the world around them as it relates to their subject area, they tend to complete undergraduate study and find out that either they are exceedingly specialized in a language only used in the scientific community or find themselves ostracized from their assumed peer intellectuals in the workforce. You know, unless said peers were also in the same area of study.
I would say that this has hindered my growth a bit and stunted my progress in the way of the self-taught developer. As an example, much in the same way that there are few who understand or use Matlab in the industry (that I've encountered), there is a lot that the computer science students have studied and gone through that, as one who performed active research in chemistry and mathematics, I simply did not encounter. So as much as their struggles are foreign to me, mine are equivalently foreign. Doesn't help that there's an attached stigma along the lines of "everything relates to math". Ignoring that things that are "based on math" or "based on calculus" often have long since lost their meanings and hold a stronger relationship with their directly computater-related counterpart than with the parent science.
Then, in the same research experiences, although I wrote things to accomplish the tasks I desired, comparatively they were little more than scripts to aggregate and analyze data to a readable form rather than an outright program intended for mass consumption. That is, the level of work output for writing something to be used on information produced by an atomic force microscope, ignoring all work output towards the experiment, the analysis, the aggregation of results, the calibration, the presentation, or anything involved with the inorganic chemistry itself, is much less. Since writing the script is just something that was done because a minor portion of the overall experiment was hindering progress in the larger picture. Much the same goes for mathematics as well. That is, as it relates to differential equations, algorithms, or even machine learning, if we ignore any of the analytical work done to first find some calculable relationship between species of interest, if we ignore all of the time spent in the initial stages of the foundation, then the writing of the scripts is far less intense than it would be were you to solely spend time on writing something that would be overall beneficial to the larger populace.
Honestly, though, this should be no surprise. If you consider the overall population of a university, then the sheer number of students pursuing any of the hard sciences as their explicit area of study is almost inconsequential. It might even be considered a highly egregious sin to make the request that others come to understand you, subsequently anything about you, before making any assessments when your own experiences are inconsequential by population. If indeed you should choose to consider.
Consequently, it is then little to no surprise that an undergraduate has to make a decision to either forfeit the years of struggle and self-sacrifice or to return to academia from whence they came. Where the options become increasingly limited to either disappearing almost permanently from public view unless necessary or returning to academia may yet mean to never leave the halls; scarcely to be seen attending a non-mandatory social function outside of a laboratory, library, classroom, or their office. Either case dictates a scarcity of presence, only punctuated by the minor social circle with which one would choose to be surrounded. Which, in many cases, I have found that many humans are either intimidated by things they don't understand or would rather expend the energy to believe such things do not exist; conformity be damned. Which, again, should be no surprise given our collectively colourful histories.
That being said, I would choose neither to forfeit nor to ignore my years of sacrifice and instead to make the effort to build on them. That is, throughout the years in pursuit of the hard sciences, there are many soft skills which are cultivated; not unlike those taught in a martial arts dojo. An actual dojo, not one that just teaches you to beat people up or how to become a talented bully. Skills such as perseverance, the value of hard work, discipline, self-confidence, and, most importantly, how to learn. Yes, fellow humans, I would argue that learning is a developed skill which can be cultivated but cannot be taught. I would choose to build on these skills and use them to spur explosive growth.
Now, neither will I say that I am some savant who masters everything in a day nor that I am a saint. However, I will say that I will diligently study as I learn my limits and exceed them in each regard as I am able. Grey hairs gained purely from biological age don't have very interesting stories.
Top comments (0)