Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Add a new article about naming convention. #9

Merged
merged 1 commit into from
Jul 7, 2017

Conversation

shulard
Copy link
Contributor

@shulard shulard commented Jun 17, 2017

Hello @Hywan,

I've just started writing the article about naming convention. The content is still WIP and is actually nothing more than a transcription of issue body.

Is it the right way to create a new article ?

@Hywan Hywan self-assigned this Jun 19, 2017
@Hywan
Copy link
Member

Hywan commented Jun 19, 2017

I will assign @vonglasow for the review of this PR (if he agrees).

@Hywan Hywan assigned vonglasow and unassigned Hywan Jun 19, 2017
<p>
This is not something we will use often, but it is important to have a
strict naming here. Based on this naming, the user will be able to choose
if the resulting data must be cached or not (for instance, all to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all to conversions => all <code>to</code> conversions

@vonglasow
Copy link
Member

You can complete for example with hoaproject/Central#54 (comment) but it looks good for me.

</p>
<p>
So far, we use this formalism: <code>getFoo()</code> to name a method
that returns the value foo. This can be a direct attribute, or a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add around foo also

</li>
</ul>
<p>
Conversions prefixed as and into typically decrease abstraction, either
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add <code> around as and into they are keyword needed to be highlighted

</ul>
<p>
Conversions prefixed as and into typically decrease abstraction, either
exposing a view into the underlying representation (as) or deconstructing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here around <code> for as and to few lines below around brackets

<p>
Conversions prefixed as and into typically decrease abstraction, either
exposing a view into the underlying representation (as) or deconstructing
data into its underlying representation (into). Conversions prefixed to,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conversions prefixed to -> Conversions prefixed to

@shulard shulard force-pushed the naming-convention-article branch 3 times, most recently from eda08d9 to e3039f2 Compare June 20, 2017 11:29
@shulard shulard changed the title WIP: Add a new article about naming convention. Add a new article about naming convention. Jun 20, 2017
@shulard
Copy link
Contributor Author

shulard commented Jun 29, 2017

Hello @vonglasow,

Any news about this article ? Do you think it miss something ?

@vonglasow
Copy link
Member

@shulard looks ok for me maybe last review from @Hywan

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work, congrats!

Maybe we should say that we took inspiration from the Rust language?

and simplification</a>.
</p>
<p>
So far, we use this formalism: <code>getFoo()</code> to name a method
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove parenthesis please.

</p>
<h2>Property access</h2>
<p>
Initially we decided to remove the <code>get</code> prefix from getters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“getter methods”

<p>
Initially we decided to remove the <code>get</code> prefix from getters
methods because it's not mandatory to understand the code. Also in many
languages this prefix have been drop/is not present so we can ask if it's
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“has been dropped”

<p>
After receiving some <a href="https://github.com/hoaproject/Central/issues/54#issuecomment-281268963">community
feedbacks</a> it seems that this prefix is too present in the PHP world.
Removing it will make code more complex to read and understand for PHP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not “more complex” but “less consistent”, thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure here... The code will be less consistent without the prefix but it's more complex to read...

Maybe we can use :

"Remove it will make the code harder to read and understand ..." ?

Copy link
Contributor Author

@shulard shulard Jun 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just :

“Removing it will make the code harder to understand for most PHP developers.“

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</p>
<h2>Conversions</h2>
<p>
Conversions can be expensive so the method prefix must be clear enough to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“A conversation have a computing cost. Some of them can be expensive, so the method…”

<h2>Conversions</h2>
<p>
Conversions can be expensive so the method prefix must be clear enough to
know operation cost directly inside the code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“directly by reading the code”

know operation cost directly inside the code.
</p>
<p>
We decided to introduce 3 method prefixes:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“We have decided”

@shulard
Copy link
Contributor Author

shulard commented Jun 30, 2017

We can add a line about Rust, I've found that link : https://aturon.github.io/style/naming.html

Can't find a note about naming convention in the Rust documentation, is there something like that ?

@Hywan
Copy link
Member

Hywan commented Jun 30, 2017

Let's use this link 👍!

@shulard shulard force-pushed the naming-convention-article branch 2 times, most recently from 7f3da38 to 71247ad Compare June 30, 2017 13:53
@shulard
Copy link
Contributor Author

shulard commented Jun 30, 2017

Ok I've added the link in article introduction :

One of these RFC is about naming convention and simplification inspired by the Rust coding convention.

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting the final feedback from @vonglasow.

reading the code.
</p>
<p>
We have decided to introduce 3 method prefixes:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except this typo everything looks ok for me.

We have decided to introduce 3 methods prefixes:

Copy link
Member

@vonglasow vonglasow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fix the last typo and everything is ok.

This article explain what was discussed in the RFC : hoaproject/Central#54
@shulard shulard force-pushed the naming-convention-article branch from ffddf52 to b26e34b Compare July 5, 2017 07:33
@shulard
Copy link
Contributor Author

shulard commented Jul 5, 2017

The typo is now fixed 😄, thank you for the review !

@Bhoat Bhoat merged commit b26e34b into hoaproject:master Jul 7, 2017
@Hywan
Copy link
Member

Hywan commented Jul 7, 2017

https://blog.hoa-project.net/2017/07-Introduce-data-conversion-naming.html

Congrats!

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

Successfully merging this pull request may close these issues.

4 participants