Skip to content
This repository has been archived by the owner on May 31, 2018. It is now read-only.

Structure code with banners #444

Closed
wants to merge 1 commit into from
Closed

Conversation

ismaelgv
Copy link
Contributor

I've made this Pull Request as a first approach. This shows some ideas about improving source code readability (see #443). I did not modify any function or operation, just commentaries.

  • Structure code with three types of banners commentaries. Divide
    source in four clear sections:
    • Heading
    • Configuration and Variables
    • Functions
    • Main.
  • Subdivide each category into little code parts.
  • Capitalize first letter of all commentaries.
  • Move VIM configuration hint to heading.
  • Add license to heading (just an idea).

@ismaelgv ismaelgv changed the title Structure code with banners: Structure code with banners Mar 12, 2016
* Structure code with three types of banners commentaries. Divide
  source in four clear sections:
        * Heading
        * Configuration and Variables
        * Functions
        * Main.

* Subdivide each category into little code parts.

* Capitalize first letter of all commentaries.

* Move VIM configuration hint to heading.

* Add license to heading (just an idea).
@AladW
Copy link
Contributor

AladW commented Mar 12, 2016

Some remarks:

  • Wouldn't it be better to use one or two descriptive sentences per function, rather than big banners with just a few words? Basic example
  • If code can speak for itself, let it - for example "version=foo # Version" is redundant. Similarly, you could just add the vim line at the bottom (or top I guess) as it's clear to the intended audience, i.e. vim users.
  • I don't see the point in a big "Script end".

@rmarquis
Copy link
Owner

Yes, banners hardly add anything but clutter the whole file. Vim settings at the bottom is very common, and using lower cases for comments is just my personal preference that I won't change soon. The name of functions should be self explanatory too (just let me know if something is not obvious). I'll however introduce the license at the top of the file once I'm sure there are no more GPL code left (see #430).

@rmarquis rmarquis closed this Mar 12, 2016
@ismaelgv
Copy link
Contributor Author

This pull request was meant only to show you some ideas. Coding style is a very personal stuff, I prefer to be very verbose in commentaries and I usually give a visual styling to my code. I'll try to stick to your taste about this.
What do you about making a short code style-guide to ease contributions and fit into your coding preferences?

@ismaelgv ismaelgv deleted the banner branch March 12, 2016 21:17
@ismaelgv
Copy link
Contributor Author

Well, this made me look for some style guides and check some open source projects styles. I've realized that I usually over-comment my code, I clutter it. I just want to thank you because your answers just made me improve my programming skills a bit. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants