-
-
Save hay/1351230 to your computer and use it in GitHub Desktop.
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<title>Enterprisify your Java Class Names! (by Hay Kranen)</title> | |
<style> | |
body { | |
background: white; | |
text-align: center; | |
padding: 20px; | |
font-family: Georgia, serif; | |
font-weight: bold; | |
font-style: italic; | |
color: #999; | |
} | |
a { | |
color: #99f; | |
} | |
h1 { | |
font-size: 16px; | |
} | |
h2 { | |
font-size: 12px; | |
} | |
#word { | |
font-size: 36px; | |
color: black; | |
} | |
button { | |
font-size: 24px; | |
padding: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Enterprisify your Java Class Names!</h1> | |
<h2>By <a href="http://www.haykranen.nl">Hay Kranen</a></h2> | |
<p id="word"></p> | |
<button id="enterprise">Enterprisify!</button> | |
<button id="again">Again</button> | |
<br /><br /><br /> | |
<small><a href="https://gist.github.com/1351230">Fork this gist on Github to add your own words ;)</a></small> | |
<script> | |
var words = [ | |
"Factory", "Bean", "Wrapper", "Visitor", "Model", "Singleton", | |
"Method", "Configuration", "Exception", "Error", "Property", "Value", | |
"Identifier", "Attribute", "Authentication", "Policy", "Container", | |
"Order", "Info", "Parameter", "Request", "Adapter", "Bridge", | |
"Decorator", "Facade", "Proxy", "Worker", | |
"Interpreter", "Iterator", "Observer", | |
"State", "Strategy", "Template", "Comparator", "Clone", "Task", | |
"Resolver", "Candidate", "Expression", "Predicate", | |
"Thread", "Pool", "Descriptor", "Interceptor", "Definition", | |
"Getter", "Setter", "Listener", "Proccesor", "Printer", | |
"Prototype", "Composer", "Event", "Helper", "Utils", | |
"Invocation", "Exporter", "Importer", "Serializer", "Callback", | |
"Tag", "Context", "Mapping", "Advisor", "Filter", "Field", "Test", | |
"Tests", "Connection", "Annotation", "Service", "Repository", | |
"Stub", "Mock", "Instance", "Dispatcher", "Client", "Server", | |
"Message", "Map", "List", "Collection", "Queue", "Manager", | |
"Database", "Reponse", "Broadcaster", | |
"Watcher", "Schema", "Mapper", "Publisher", "Consumer", "Producer" | |
], | |
inWords = [ | |
"Composite", "Invalid", "Supported", "Focus", "Traversal", "Abstract", | |
"Transformer", "Common", "Concrete", "Autowire", "Simple", "Aware", | |
"Aspect", "Principal", "Driven", "Interruptible", "Batch", | |
"Prepared", "Statement", "Remote", "Stateless", "Session", | |
"Transaction", "Transactional", "Based", "Meta", "Data", "Jms", | |
"Readable", "Literal", "Reflective", "Scope", "Multipart", "Xml", | |
"Generic", "Interface", "Advisable", "Observable", "Identifiable", | |
"Iterable", "Distributed", "Notification", "Failure", "Type", | |
"Http", "Jdbc" | |
]; | |
function $(id) { | |
return document.getElementById(id); | |
} | |
function rand(min, max) { | |
return Math.round(Math.random() * (max - min)) + min; | |
} | |
function generate(min, max) { | |
var allWords = words.concat( inWords ), | |
word = ''; | |
for (var i = 0, l = rand(min, max) - 1; i < l; i++) { | |
do { | |
var w = allWords[ rand(0, allWords.length - 1) ]; | |
} while (word.indexOf(w) !== -1); | |
word += `­${w}`; | |
} | |
word += '­' + words[ rand(0, words.length) ]; | |
return word; | |
} | |
$("again").addEventListener('click', (e) => { | |
$("word").innerHTML = generate(2, 3); | |
$("enterprise").innerHTML = "Enterprisify!"; | |
}); | |
$("enterprise").addEventListener('click', (e) => { | |
var word = $("word").innerHTML; | |
$("word").innerHTML = generate(1, 1) + word; | |
$("enterprise").innerHTML = "Enterprisify even more!"; | |
}); | |
$("word").innerHTML = generate(2, 3); | |
</script> | |
</body> | |
</html> |
There is a typo: proccesor -> processor
Please add "robust" to the list of words.
what about "Builder" and "Controller"?
Oh, there could be even more:
Subscriber, View, Formatter, Master, Slave, Generator, Provider
And
Subscribed, Distributed, Generated, Data, Socket, Range, View, Pointer, Stack .....
Thanks for the great service! Typo: "Reponse" -> "Response".
Can you apply 'word-wrap:break-word;' css to the word please, so it doesn't force horizontal scrolling.
I use this in our production server, and it is a real deal breaker for us.
Due to a complex security policies and rules we are unfortunately unable at the time to host our own instance of this if we were to fork and update it.
This is revolutionary
I'm a Python programmer and this changes everything.
This improved the code in all my recent projects by a lot
This is great but the words should be added at the end, not the beginning
nice!)))
Just want to say I have showed this to many people over the years and have forked it in the past to make our own specific version as an inside joke at work, thanks for making this :P Amazed it's still up!
Updated the code from this 2011 classic: removed Google Analytics and Twitter tracking crap and finally made it mobile friendly / responsive!
@hay there are 2 small bugs in this gist:
rand(min, max)
function's result is not properly distributed, see this post: https://stackoverflow.com/questions/1527803/generating-random-numbers-in-javascript-in-a-specific-rangewords[ rand(0, words.length) ];
yieldsundefined
whenrand()
returndswords.length
Diff with 2 fixes: https://gist.github.com/vzx/d5773be59050fadc25be/revisions
Not sure how to make a pull request for a gist...