For web applications I've developed I tend to build up a library of functions, and for some sites I end up encapsulating them all into a single object, so say FooBar
and then all the things I end up doing are within that object. My understanding is that this is part-of-the-way to "Enterprise JavaScript" - encapsulating the functionality in ways that are logical, avoid polluting the JavaScript with lots of global variables.
How do I distinguish good coding practice from what's considered "Enterprise JavaScript"?
A simpler way to ask this might be in terms of scale -- as a web application or site grows it will include more JavaScript and organizing it gets harder, and there are patterns for doing this well and they're Enterprise? What are resources for learning about approaches to handling large libraries of functionality.
Or are people just making it up, as in this joke site?
UPDATE: I am not kidding, really, though I wonder if what I'm seeking is more along the lines of Pro JavaScript Design Patterns. Perhaps "Enterprise" encompasses some of this?
Enterprise JavaScript Is: Ensuring lines are terminated with multiple semicolons so the JavaSript parser Really Knows when a line is ending.
var helloWorld = function (message) {
if (!message) {
message = "Hello World";;;;;;
}
alert(message);;;;;;;;;;;;;;;;;;;
};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(By bentruyman)
I love the term enterprise javascript and enterprise coding. I doubt that it's a well defined term but it has a strong appeal.
As I have come to understand it; Enterprises deal with a lot of developers working on different aspects of projects. So there is a lot of communication required to make things work. Enterprise coding is a term to describe the techniques used to aid the communication of developers and modules in code but have gone wrong.
As the site shows, it's easy to over do it!
So enterprise coding results in harder to understand code that seems more robust than it needs. Quite ironic as enterprise coding is intended to ease production.
Examples of enterprise code could easily be found in
Writing clean good code is something that will be debated forever. As there is no perfect approach to all problems.
In a way enterprise coding is coining good practice techniques that have gone bad.
An antonym to enterprise coding might be Cowboy Coding
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With