Sponsored Content
The Lounge What is on Your Mind? Coding Style at UNIX.com forums Post 303029262 by Neo on Wednesday 23rd of January 2019 11:10:31 PM
Old 01-24-2019
As far as I am concerned, it is always best not to put "form over substance"....

Personally, I often write code which many might consider "childish" because I tend to create variables like:

Code:
$my_flag_used_for_processing_something

.... versus how "many others" code ....
Code:
$f

In fact, I have been going though someone else's PHP code yesterday (making changes), it is so cryptic it takes a lot of time because of all the cryptic var names and complex code.

On the other hand, in the Javascript, HTML and CSS world -- the Web Dev World --- many believe that code should be very short and so very cryptic, for performance reasons (takes a shorter time to download and less space to store in the browser, etc).

So, we must be careful to impose our "best practices" on others.

As the "main poobah admin and web developer here", I do not want to see people coming down hard on others who do not code according to their "best practices"; however, it is always good to lead by example.

I was once on a mountain top temple talking to the most senior monk and I was asking about a particular monk who walked around in the garden smoking a cigar.

The wise elder monk mentioned to me that everyone has their own life experiences and things they collect and "become" as they journey in life. We should not worry about what others do or do not do; but focus on ourselves.

Maybe someone here is busy, and they are helping someone out who asks a question, and they write some quick messy code to help out someone, then they jump back to work or to family matters. It is not right, in my view, for us to hold that person to some "standard" when they are already helping out someone.

That is why I often reformat other's code and wrap code tags around other's code here; because I figure if someone took the time to write a lot of code to help someone, it's not any trouble to me to spend a few seconds to format it. That's also what our great moderator's do.

So, in closing, while I certainly would be very pleased if everyone wrote great, easy to follow code, I prefer we lead by example, not by instructing others how to write or format their own code. As long as they use "code tags" that is already good.

My final thought is this...... which I learned many years ago as a coder....

We can always look at code written before us and find ways to improve it... or to say "that code is really **** ... " and people will say the same when they view our code written today in the future.

The fact of the matter is that when someone writes code, we do not know if they were given three weeks to write it, or three minutes. So it is mostly unfair to judge the code which others write.

Best is to just LEAD BY EXAMPLE... and not worry about others... unless you are a moderator, then add those code tags!!! LOL

THANKS!
These 4 Users Gave Thanks to Neo For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix Coding Standards

Hi, I am looking for some coding standards for Unix Shell Scripting. Can anyone help me out in this? Regards, Himanshu (3 Replies)
Discussion started by: himanshu_s
3 Replies

2. UNIX for Dummies Questions & Answers

Unix coding tip required

Hi! Suppose I am at a location xyz:/abc1/abc2/abc3 Is it possible to move to another location xyz:/mnl1/mnl2/mnl3 by some coding within a script? (5 Replies)
Discussion started by: udiptya
5 Replies

3. Shell Programming and Scripting

[Unix] a dos style rename wont work

Hey guys i'm creating a dos style rename script, so if a user types say q14.* as the 1st param and b14.* as the 2nd and will rename all q14 files to b14 but keep the extensions, so i've developed nearly the full script "i think", if i use echo(echo "if $1 had been renamed it would now be... (3 Replies)
Discussion started by: fblade1987
3 Replies

4. Solaris

Getting Started in UNIX - incorporating C coding

I'm just starting a 'serious' coding in UNIX, so what I need is to run a C code on UNIX, What do I have to install (app) prior to coding/running the code and how do I compile that code? can I write my c code in UNIX or I need to have a visual studio for this? (7 Replies)
Discussion started by: Peevish
7 Replies

5. UNIX for Dummies Questions & Answers

Unix coding for triggering informatica

Hi, I have very little knowledge with unix and pmcmd. I need help with a issue. I have to see whether a file has been dropped in a particular location/path. If the file dropped I have to check the last modified time, which should be greater than 8pmEST the prior day. If the file has been... (4 Replies)
Discussion started by: redwolves
4 Replies

6. What is on Your Mind?

Filenames with hyphens - UNIX style?

Hello everyone! Filenames with hyphens instead of everything else that can be as a space - is it particularly UNIX style of naming or a general practice? It kinda is so in my mind that DOS guys use underscores as spaces and UNIX guys use dashes. Is it so? (5 Replies)
Discussion started by: guest115
5 Replies

7. Shell Programming and Scripting

UNIX script coding help?

Unix script coding help? i am trying to write a code that will display following menu to user: (A) Add (B) Subtract (C) Multiply (D) Divide (E) Modulus (F) Exponentiation (G) Exit Then ask user for choice (A-F). After taking users choice ask user for two numbers and perform... (3 Replies)
Discussion started by: renegade755
3 Replies

8. Homework & Coursework Questions

UNIX script coding HW question

i am trying to write a script code in unix that will: 1. The problem statement, all variables and given/known data: display following menu to user: (A) Add (B) Subtract (C) Multiply (D) Divide (E) Modulus (F) Exponentiation (G) Exit Then ask user for choice (A-F). After taking... (5 Replies)
Discussion started by: renegade755
5 Replies

9. Programming

Coding Style checking

Is there any opensource tool which can check the coding style use in C/C++ program. (3 Replies)
Discussion started by: zinat
3 Replies
All times are GMT -4. The time now is 01:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy