moluwole / Bast

Simple but Elegant Web Framework
https://bast.readthedocs.io
MIT License
48 stars 10 forks source link

Render #11

Closed moluwole closed 6 years ago

moluwole commented 6 years ago

Guys, what do you think of the following: Instead of self.view() to render view, we use self.render_view() and instead of self.json() to render JSON object, we use self.render_json()?

BolajiOlajide commented 6 years ago

I haven't dived into this part of the codebase but what exacly does the self.view and `self.jsonz method?

Do they do any form of UI rendering? If not then the word, render might not be best.

moluwole commented 6 years ago

They do. self.view renders the template using Jinja while self.json sends JSON response

BolajiOlajide commented 6 years ago

self.render_view makes sense to me then.

But since the self.json isn't rendering anything and just sending a JSON response then I'll advise you don't use the word render. self.json sounds right to me, similar to res.json in express used for returning json responses.

webong commented 6 years ago

self.view and self.json naming convention is quite ok ... I'm looking at the lengthy syntax when using the render word ...

moluwole commented 6 years ago

:ok_hand:

BolajiOlajide commented 6 years ago

True @wisdomanthoni

I was just about to share that. Especially considering PEP's rule of 80xters per line.

The main thing is that users understand and are able to discern what each method does by looking at the name.

moluwole commented 6 years ago

Words of wisdom bro @wisdomanthoni 👌. We'll not change it. As long as the documentation points it out then user would be able to distinguish what it does truly @BolajiOlajide True! True!. :raised_hands: