Editoral Readability? | Any Thoughts will be Appreciated

JUST WONDERING…

Why you folks AVOID writing GOOD READABLE CODE while writing EDITORIALS ?

That will significantly improve the reading time & experience.

I appreciate the team's effort of posting quality content & resource material as the editorials.

I would like to know how the community thinks about it.


The Editorial ’ s Code are:

  • Not Readable Code at All
  • Somewhat Readable Code
  • Highly Readable Code

0 voters


Problem can be fixed with :

  • Better Explanation in the Post
  • Writing More Maintainable Logic in the Code
  • Writing Clear Variable Names

0 voters

I created this thread to know the thoughts of the community. And Perhaps do our part to uplift the platform. :blush:

All Thoughts are Welcomed!


EDIT 1

Take this as an Analogy ( with a grain of salt )

Consider there is a Magical Problem of Finding MAX element.

Followed by really well explanation on how to approach this…

After reading a little, I might wonder how the solution looks like.

And, after Clicking on a solution, I get the following.

console.log([5,4,3,9,7,4,15,].reduce((x,y) => y > x ? y : x));


For those familier with it, might know what it is. Even if the post is very detailed, after looking at it, some people (including me also :stuck_out_tongue_closed_eyes:) will be like, "WAIT, WHAT? HUH ?"

Just because it is well detailed, won’t it be kind of really helpful to have really a much readable version AS EDITORIAL ? For example,

let array = [5,4,3,9,7,4,15,];    //initialization

function findMax(firstNumber,secondNumber) {
    if ( firstNumber > secondNumber) {
        return firstNumber;
    }
    return secondNumber;
}

let maxValue = array.reduce(findMax);    // iterate over the array &                                                  
                                        //  Reduce it to only max Value in that array

console.log(maxValue);    //    Print the Max

At this point the code is self explanatory, compared to the previous one.

Quick Example Reference : CODING TRAIN YOUTUBE CHANNEL


As always, All Thoughts are Welcomed! :heart:

2 Likes

Going to piggy-back this thread with a small suggestion of my own, if you don’t mind :slight_smile:

Currently, the Editorial template gives the Setter’s, Tester’s and Editorialist’s solutions in that order; I think this is the opposite of the way it should be, and that the Editorialist’s solution - which of the three is almost always the least unreadable - should be the first thing a reader sees.

5 Likes

+1 to @ssjgz
Thoughts are warmly Welcomed! :blush:

3 Likes

:+1:
agreed
My problem: I code in PYTH 3.6, but setter’s, tester’s and editorialist’s solutions are always in C++14/17 or JAVA

1 Like

great initiative tho :slightly_smiling_face: :+1:

2 Likes

I can understand.

But, As long as the code is readable enough & the logic is clear enough, the code becomes self explanatory. Later it can be easily translated to any language.

What do you say?

I understand that many coders start with Python and it would be great to have editorial codes in many languages, ​​including Python. But in this little world of competitive programming, understanding c++ code is a must. You may feel more comfortable with other languages ​​and use them as your first option, that’s fine, but if you can’t understand well written c++ code…you should change that asap.

2 Likes

ok…i have been doing some tutorials. hopefully, i will learn soon enough

1 Like

:+1:
yeah, but many a times it is not
also, i just started coding (in April itself) and joined Codechef in late May
Thus, i’m not familiar with some commands and functions and exact syntax which i can not translate from C++ and JAVA :cry:

1 Like

I would say,

consider this,

console.log([5,4,3,9,7,4,15,].reduce((x,y) => y > x ? y : x));

For those familier with it, might know what it is. Even if the post is very detailed, after looking at it, some people (including me also :stuck_out_tongue_closed_eyes:) will be like, “WAIT, WHAT? HUH?”

Just because it is well detailed, won’t it be kind of really helpful to have really a much readable version AS EDITORIAL ?

let array = [5,4,3,9,7,4,15,];    //initialization

function findMax(firstNumber,secondNumber) {
    if ( firstNumber > secondNumber) {
        return firstNumber;
    }
    return secondNumber;
}

let maxValue = array.reduce(findMax);    // iterate over the array &                                                  
                                        //  Reduce it to max Valu in that array

console.log(maxValue);    //    Print the Max

As this point the code is self explanatory, compared to the previous one.

Reference : CODING TRAIN YOUTUBE CHANNEL

YES, but that shall only be in # or ‘’’ (PYTH 3.6, dunno bout the rest)
Coding is helpful if we can give minimal commands to get the same output.
that should be there for explanation, if required, but a shorter code is desirable
What do you say?

1 Like

tried to increase number of voters by sharing on FB and creating new topic :+1: :+1:

2 Likes

I would say, coding is easy. Constructing a solution is where we need to focus on.

For ongoing contests, of course shorter & faster solution is great!

But, This might not be the case for Editorials.

For me, Editorials are a place where, I can learn how to think. How I can approach a problem. How to build up solutions.

Therefore, A code that can help me to construct a solution is likely to be the one which is more readable. So, that, whenever i look back to it, I get the point clearly!

Translating a code or writing something into different language is just a matter of syntaxes.

What matters more to me is the value that a good editorial with nice & clear implementation gives.


Once I get a hang out of the core idea & implemtation techniques, it’s kind of cool to write CRYPTIC CODES which can save time in a CONTEST.

BUT ! I will prefer not to write CRYPTIC CODES in development of a Real Software. Because, SOMETIMES, CRYPTIC CODES ARE HARD TO READ & LESS MAINTAINABLE IF NOT UNDERSTOOD PROPERLY.

Perhaps leaving comments might help | if someone is really into CRYPTIC CODES


OPEN TO ANY THOUGHTS❤️

Thank You @wickedknight