User talk:AnatolV: Difference between revisions
Content added Content deleted
mNo edit summary |
(adding a few notes) |
||
Line 1: | Line 1: | ||
==Aphorisms (good to follow or just keep in mind)== |
|||
From my OEIS Wiki user page.<br> |
|||
'''Socrates''' (470 BC - 399 BC)<br> |
|||
"As for me, all I know is that I know nothing."<br> |
|||
"Question everything."<br> |
|||
'''Terence''' (195 BC - 159 BC)<br> |
|||
"There are as many opinions as there are people: each has his own correct way."<br> |
|||
"Nothing is so difficult but that it may be found out by seeking."<br> |
|||
'''Edgar Rice Burroughs''' (1875 - 1950)<br> |
|||
"We are, all of us, creatures of habit."<br> |
|||
[Find more on my OEIS Wiki user page and much more on Wikiquote.] |
|||
==About Clean Code and Internet Graffiti== |
|||
The following is a short list of bad practices in programming industry (related to the code only): |
|||
* Very long historical and/or technical '''preludes'''. |
|||
* Multiple '''comments''' (almost on each line). |
|||
* '''Decorating code''', e.g., using tricky frames for comments, also, unnecessary multiple pound and other signs, |
|||
* Obsession with tabbing (code is shifted too far to the right side). And opposite: totally avoiding '''identification'''. |
|||
* '''Splitting''' one statement (fitting one line) into 5 lines. And opposite: putting 10 and more statements on 1 line.. |
|||
* '''Code leftovers''': not used definitions, variables, code fragments for testing, etc. |
|||
* '''Typos''' in the code. |
|||
All of these bad practices you can find here on Rosetta Code.<br> |
|||
Doesn't matter what contributing author, or somebody else thinks about it, - it is still a bad practice known and avoiding for decades.<br> |
|||
If you have/had a job as a programmer/developer for a solid company or university producing software (including Web pages) it is well known fact for you that your supervisor will not |
|||
allow/tolerate any of these bad practices.<br> |
|||
'''Main reason is always - money.''' Such "dirty", not structured code is difficult to read and maintain.<br> |
|||
I'm not gonna write an article here. Just google please: "bad programming practice", and you will find hundreds of pages devoted to it. |
|||
But be reasonable in selecting some advises. For example, you can find advises about '''comments''' ranging from "too many is bad" to |
|||
"not enough is bad", but also: "Do not write code that needs comments."<br> |
|||
The good '''rule of thumb''' in this case is following: If function (method, etc.) is 5-10 lines of code or less then describe briefly function purpose and calling parameters only (if any).<br> |
|||
Here is another contradictory advise popular in many documents, books, etc.: "use '''white spaces'' to make code more readable". But, contrary, it is not a bad practice/habit to use minimal number of white spaces.<br> |
|||
If you are using languages that would be interpreted, e.g., Java, JavaScript, PHP, ASP/ASPX, etc., then all comments are usually deleted and code is shrunk as much as possible |
|||
to speed up processing time. So, keep well documented version of code in archive.<br> |
|||
'''Decorating code''' and using not related images are considered an "Internet graffiti" |
|||
by some authors/bloggers. But more often it is called just trash and spam.<br> |
|||
Regarding "preludes" here on RC I would say they are OK, but better place would be on related language page, e.g., with titles like "Interesting historical notes" |
|||
"Useful XXX language tips", etc.<br> |
|||
The main reason: task pages becoming too big and looking through it sometimes is really difficult.<br> |
|||
Here is another sample. My VoeLib.gp page (pure text file) on OEIS Wiki became too big, and I've got automatic Wiki message: "Your page is bigger than 32K. Please reduce its size. Some browsers can't |
|||
handle big pages". This forced me to split my page into 2 pages. Soon we will have the same problem here on RC. |
|||
See another even more appropriate suggestion below. |
|||
==How to handle huge code and comments== |
|||
Here is a very good sample how to handle big chunk of code and, additionally, how to deal with huge comments.<br> |
|||
Task page [[AVL_tree| AVL tree]] has [[AVL_tree#C.2B.2B| C++]] 3 versions.<br> |
|||
Note that first version has a realy huge chunk of code. But "More elaborate version" has no code,- just a link: "See AVL_tree/C++".<br> |
|||
It links to: "AVL tree/C++" page with huge code, and this page has a typical "Discussion" link that leads to:<br> |
|||
[[Talk:AVL_tree/C%2B%2B| Talk page]] titled "Talk:AVL tree/C++". So, put all notes you want here. |
|||
[[User:AnatolV|AnatolV]] ([[User talk:AnatolV|talk]]) |
|||
==Obsessed??== |
|||
'''<<This is copied from Dragon curve Discussion page. Just added 1 related reply.>>'''<br> |
|||
Some contributors are obsessed with: |
|||
* Very long historical and technical preludes; |
|||
* Multiple comments (almost on each line); |
|||
* Unnecessary multiple pound and other signs. |
|||
All this makes code "dirty", hard to read and maintain. I'm just curious: who will read such preludes, comments?<br> |
|||
An obvious sample is the first version of dragon curve in R. I thought that contributor is for sure obsessed with pounds...<br> |
|||
Or trying to camouflage original code... Although original code has a lot of pounds too, |
|||
but RC contributor added even more! LOL See for yourself: |
|||
rstudio-pubs-static.s3.amazonaws o com/185483_0f31b11d2def43aea33658b5b7908cf3.html<br> |
|||
Team MEOW: Eric Lewis, Ricky Hardiyanto, Yanna Chen - CityTech. May 29, 2016<br> |
|||
BTW, it’s impossible to find who is the contributor of the first version of R.--[[User:AnatolV|AnatolV]] |
|||
: Probably not a great idea to make disparaging remarks about other peoples code. That being said, it's a public wiki. If there is code that is unidiomatic or messy, clean it up. Just be aware that some users are very protective of their contributions and coding styles. |
|||
: As far as who contributed the first R example, looks like it was [http://rosettacode.org/wiki/Special:Contributions/Werewolff519 Werewolff519]; see [http://rosettacode.org/mw/index.php?title=Dragon_curve&type=revision&diff=196234&oldid=195807 this revision] --[[User:Thundergnat|Thundergnat]] ([[User talk:Thundergnat|talk]]) 12:58, 4 March 2017 (UTC) |
|||
::TYVM Thundergnat! Now I can see: he attached solution to Perl with no comments. I did the same when I started here. LOL But later I've found it is useful to leave a short comment. I was hoping the contributor is one of the authors of the cited article. But, in general, it doesn't matter for me. |
|||
::I will continue discussion on my Talk page. (not today, I have too many logins) -- [[User:AnatolV|AnatolV]] ([[User talk:AnatolV|talk]]) |
|||
::'''@Thundergnat:''' I have 2 issues with your suggestion to "clean it up": 1st, I prefer author or at least admin do it; 2nd, it is "eating" my logins. I did edited a few typos, wrong tag using, etc. But soon I've found: my (actually everybody but admins) logins are restricted. See my post on talk:Short Circuit page "Problems and a few suggestions". |
|||
==Hailstone sequence version 2 (& not ONLY)== |
==Hailstone sequence version 2 (& not ONLY)== |
||
'''@Gerard Schildberger:''' |
'''@Gerard Schildberger:''' |