Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve JS Philosophy with design pattern #3493

Closed
JpEncausse opened this issue May 15, 2012 · 7 comments
Closed

Improve JS Philosophy with design pattern #3493

JpEncausse opened this issue May 15, 2012 · 7 comments

Comments

@JpEncausse
Copy link

  • The "JS Philosophy" is really great for naming convention and organisation.
  • Looking at the jQuery source code gives clues on how to code a new jQuery Bootstrap plugin

Could you also provide:

  • A link to a jQuery reference guide that describe Bootstrap convention ? Where is your inspiration ?
  • Snippet Design Patterns for Bootstrap:
    => A basic plugin architecture
    => A basic element's wrapper (like tooltip, ...) with extensibility (like popover, ...)
    => A basic manager or utility class

Might be idiomatic.js ? (https://github.com/rwldrn/idiomatic.js/)

@mchiocca
Copy link

Hello. Have you tried resources such as this one, http://docs.jquery.com/Plugins/Authoring, directly from jQuery?

@JpEncausse
Copy link
Author

Yes, in fact there is a huge gap between

  1. I start jQuery and read the doc
  2. I do something like Bootstrap with smart styling

The best JavaScript coding convention should be : https://github.com/rwldrn/idiomatic.js/
The closest best practices to Bootstrap should be: http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/

@richardp-au
Copy link

You might like to check out one of @fat's blog posts I don't write "JavaScript" as it describes a bit about his coding style. In his blog, he also refers to another blog entitled An Open Letter to JavaScript Leaders Regarding Semicolons, which is also a good read.

These describe the code format and conventions that @fat has used in Bootstrap. After reading those articles, I've come to like the comma first, no semicolon style and have reformatted all of my code accordingly. I find that it make the code much more readable and easier to follow. It also allows you to write better code when you understand how JS handles truthy/falsy values and how you can use that to write shorter and more concise code.

@fat: Your JS Philosophy (and your blog perhaps) could be extended to include more detail for people who wish to write their own BS plugin.

@fat
Copy link
Member

fat commented May 15, 2012

@richardp-au
Copy link

I have indeed. I even referred to it in #3346.

@JpEncausse
Copy link
Author

@fat yes,
@R1ch0 thanks i will read it

I use Bootstrap as a base Framework to replace an old one on Prototype/Scriptaculous/Livepipe in a big CMS.

  • For CSS part everythings is fine, we build a layer on top of bootstrap to handle backward compatibility
  • For JS part it is a little bit messy because in a nutshel there is many ways to write jQuery in a large scale app. I like the way @fat did but it's only a boostrap. So I thought @fat learned all theses tricks in a dedicated books, or website ? And I thought README.md should contains links to good practices or boilerplates on common design patterns like a basic Singleton

@fat
Copy link
Member

fat commented May 20, 2012

Oh i see. Nope, no books talk about my odd way of writing javascript as far as I know. The closest thing to this is probably @isaacs blog http://blog.izs.me/

@fat fat closed this as completed May 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants