If you want to show some real sack, you compile the XML, validated against a hierarchical XSD, through XSLT to three different JVM languages, none of which are Java, compile to byte-code, serialize the byte-code to XML, transform it to JSON, wrap it in a routing envelope, and transmit to your service clusters over a MOM. An Orchestration service then plucks the message off the queue, validates the JSON, transforms to XML, validates the XML, and deserializes the XML to instantiated objects. The objects then begin working. They request appropriate endpoints from a UDDI service, initiate direct TCP connections with a proprietary binary, wire-protocol (for efficiency), compute the result, wrap the result in XML, transform it to JSON, and send it to the MOM. The email service takes the message off the queue, validates the JSON, transforms to XML, validates the XML, validates the result, and composes an email to boss@enterprisey-land.com with the FizzBuzz results.
Some would say this is overkill, but look at how extensible, loosely coupled, and portable it is!
I declare this horse dead.
toaster13 ยท 2 points ยท Posted at 05:11:42 on September 14, 2013 ยท (Permalink)
We could change it to yaml to be more web 2.0
apotheon ยท 3 points ยท Posted at 05:55:49 on September 14, 2013 ยท (Permalink)
No way -- someone might be able to read it, then.
ours ยท 1 points ยท Posted at 18:28:13 on September 14, 2013 ยท (Permalink)
He said enterprise. None of that fancy schmansy JSON or YAML or anything that's not at least 10-years-old. Moar XML!
yogthos ยท 10 points ยท Posted at 22:35:14 on September 13, 2013 ยท (Permalink)
There should also be a SOAP service somewhere to connect the business logic to the presentation layer. :)
This codebase has a number of issues to resolve before it can be truly enterprise ready. Configuration is non-existent and needs to be moved into an XML layer or even better a naming service such as JNDI or LDAP. The author should consider using dependency injection to build his objects rather than invoking constructors and factories directly. As it stands you have to recompile the project to change even the simplest settings.
The most glaring error is any kind of externally configurable logging which is absolutely required to be enterprise ready. There is also a complete lack of metrics or management code. Adding some JMX support would be a good start and ideally some statsd integration so you can get some runtime insights into what the code is doing. Right now the whole thing is just a black box. How are you supposed to monitor and track this thing?
At an architectural level there is no reliability guarantee on execution either. If you crash half way through, have a power outage etc, you have to manually restart the process. The whole thing should be triggered by a durable message queue and actually processed by a set of redundant back-end services which would guarantee execution and deliver the finalized document asynchronously. This would also decouple resource usage and allow different SLAs (service level agreements). As it stands, I have no way of guaranteeing resource availability to my Gold customers and thus no way to actually deliver on contractual performance guarantees which may have been made by the sales team. Our top tier customers for example would probably have dedicated boxes reserved for handling just their traffic. Which of course requires some level of identity services/authentication.
In summary: we are missing
configuration
logging
metrics
monitoring
reliability
SLA support
security/authentication
This is a good start though.
mike413 ยท 56 points ยท Posted at 01:46:25 on September 14, 2013 ยท (Permalink)*
You must have an old version of our requirements doc, because you have no mention of:
mobile support
cloud support
hmmdar ยท 50 points ยท Posted at 03:32:17 on September 14, 2013 ยท (Permalink)
Oh, don't worry that your copy of the requirement doc says 'Final' revision. We're agile, that means we can add significant features/changes in alpha testing without adjusting the schedule.
eddiemoya ยท 54 points ยท Posted at 04:48:27 on September 14, 2013 ยท (Permalink)
Mine says "PRD_v6_final3.doc", but Bob has "PRD_v6_final3(2).doc".
quay42 ยท 27 points ยท Posted at 07:09:44 on September 14, 2013 ยท (Permalink)
Mine's named the same but has significantly different content. Good thing we sent over email so we all can have local copies.
Oh god, I'm having flashbacks to my DoD days. This is what actually happens.
[deleted] ยท 17 points ยท Posted at 06:59:20 on September 14, 2013 ยท (Permalink)*
[deleted]
[deleted] ยท 7 points ยท Posted at 13:15:28 on September 14, 2013 ยท (Permalink)
Weโll need to think about the requirements for the requirements.
Gusfoo ยท 7 points ยท Posted at 13:37:55 on September 14, 2013 ยท (Permalink)
Let's set up an architecture board to make standards decisions about the format of the requirements meeting.
eddiemoya ยท 1 points ยท Posted at 00:01:07 on September 15, 2013 ยท (Permalink)
I think the PRD you have doesnt match the BRD at this point. Figuring this all out could take some time, so lets just have the developers start working in the mean time. Wouldn't want to waste any time.
I'm going to need you to come in this weekend though just to make sure that the project is going to be on budget and on time. Also, clear your nights and sleep schedule next week.
[deleted] ยท 1 points ยท Posted at 15:51:24 on September 16, 2013 ยท (Permalink)
We invest in our employees! That is why we decided to invest in luxurious feeding tubes built into your cubicles!
toaster13 ยท 3 points ยท Posted at 05:13:12 on September 14, 2013 ยท (Permalink)
Make sure its on your next TPS report.
wolfkin ยท 1 points ยท Posted at 05:48:49 on September 14, 2013 ยท (Permalink)
in triplicate
[deleted] ยท -1 points ยท Posted at 02:10:07 on September 14, 2013 ยท (Permalink)
And make sure you put a cover sheet on the TPS report!!!
[deleted] ยท 1 points ยท Posted at 15:50:02 on September 16, 2013 ยท (Permalink)
I have definitely worked with a few recently graduated Phds that would have come up with both the original OPs code, and the response all on dead simple CRUD apps. Also, happy cakeday!
He's naming real things, but they're not complicated and they're not all required to write one line of code. No org guesses at SLAs either, they're something discussed before the dev begins.
When you work on projects of scale for clients like the govt or financial sector, standard architectures are a good thing. They're not there just because some Java dev somewhere thought he needed something called JMX. I think ppl in this thread think that there is some sort of lack of ability that brings people to Java coding which is pretty funny.
[deleted] ยท 7 points ยท Posted at 03:41:25 on September 14, 2013 ยท (Permalink)
We're also going to need Android and iOS mobile apps.
apotheon ยท 6 points ยท Posted at 05:56:51 on September 14, 2013 ยท (Permalink)
What are you waiting for? Fork, clone, edit, commit, push, send pull request! It's on GitHub!!!
[deleted] ยท 9 points ยท Posted at 07:30:53 on September 14, 2013 ยท (Permalink)
I'm waiting for Bob, your CEO, to sign my work contract for the next 5 years. $5000 per hour, mmmyiss
apotheon ยท 1 points ยท Posted at 17:48:09 on September 14, 2013 ยท (Permalink)
. . . and yet, I'd like to see the joke on GitHub progress.
flukshun ยท 2 points ยท Posted at 06:41:48 on September 14, 2013 ยท (Permalink)
Also needs to be distributed inside a virtual appliance to ensure its all run on a specific java runtime and with all supporting services configured appropriately. Yes this could be done with proper packaging but that's not enterprise enough damnit
You can dependency inject with constructors. That statement you made doesn't make any sense because using, or not using constructors has nothing to do with dependency injection.
interiot ยท 183 points ยท Posted at 16:03:52 on September 13, 2013 ยท (Permalink)*
...oh... fuck. This might not have been such a good idea after all... I don't feel so good...
FizzBuzzSolutionStrategyFactory.java
That's not what I think it is, is it? ...I think I'm gonna throw up...
package com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.factories;
import com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces.strategies.FizzBuzzSolutionStrategy;
public interface FizzBuzzSolutionStrategyFactory {
public FizzBuzzSolutionStrategy createFizzBuzzSolutionStrategy();
}
HURL
[deleted] ยท 19 points ยท Posted at 01:13:45 on September 14, 2013 ยท (Permalink)
Nothing wrong with a good package structure... But wait, isn't that second 'java' redundant?
No, in standard Maven projects you have src/main/<language>
So in this case, the root of the package name does not include main/java, instead that is specifying where to place Java source files. The mirror for tests would be src/test/java for Java based tests.
No, I'm not complaining about the first 'java', that makes sense, and I figured it was some standard project layout.
What I don't see is why you would have a package scheme that starts with com.seriouscompany.business.java -- isn't java kind of implied by the fact that this is a java package at this point? What, exactly, is it disambiguating to have a directory called src/main/java/com/seriouscompany/business/java/... ?
It needs the second "java" in order to be J2EE compliant, you see. That's why it's called J2EE.
rob132 ยท 11 points ยท Posted at 04:15:16 on September 14, 2013 ยท (Permalink)
I finally understand. Thanks!
HaMMeReD ยท 8 points ยท Posted at 06:04:59 on September 14, 2013 ยท (Permalink)
I SEE THE LIGHT!!! Finally it all makes so much sense, I finally understand java!
euos ยท -8 points ยท Posted at 04:24:15 on September 14, 2013 ยท (Permalink)
Bullshit.
What is "J2EE compliant"? Servers may be compliant with some JEE specs (e.g. Servlets, EJBs, etc.) but the applications cannot be "JEE compliant". And nothing ever requires putting "java" in package name.
[deleted] ยท 1 points ยท Posted at 05:07:17 on September 14, 2013 ยท (Permalink)
If you write JVM code in Clojure, and for some reason want to invoke a Java written version... how else would you identify it?
I'm not saying it's good, but it is at least not redundant because the JVM package doesn't know which language it came from. Perhaps you care, because you're enterprisey.
I don't know if you're serious, but the answer is: "you don't care where it comes from". It's all running on the JVM. No problem to simply call the class with Clojure/Scala/Groovy/[insert_your_favorite_langugage_on_JVM_here].
[deleted] ยท 0 points ยท Posted at 16:47:52 on September 14, 2013 ยท (Permalink)
You do care, though. Something, somewhere has to configure what version you use. If it's native extension you can only use it on the platforms the native code has been compiled for. Hence it does matter, and this is one way to use package names.
Why would you have both versions to begin with? That seems wasteful...
And why wouldn't you disambiguate that way back up at the src/ level? I mean, clojure doesn't compile to Java source, does it?
[deleted] ยท 1 points ยท Posted at 05:32:39 on September 14, 2013 ยท (Permalink)
Enterprise code is wasteful for a lot of good and bad reasons. Maybe you can get by with a pure JVM version, but some customer has performance needs that require some native code. That means you have more than one implementation of the same concept.
src/main/<language> is intended for multi-language projects, at the compiler or build tool level. Not at the runtime level.
Clojure, Scala, Groovy, etc, all compile down to the JVM bytecode. If you want a specific version of a class (maybe a C version, because you want that native code feel) then this is one possible way of specifically calling out com.mycoolproject.c.CoolClass instead of com.mycoolproject.java.CoolClass, when they both implement com.mycoolproject.CoolClassInterface. Using this may be through configuration (and not a new com.mycoolproject.c.CoolClass call) but you are still specifically targeting one version of this over others.
darkowl ยท 9 points ยท Posted at 01:55:09 on September 14, 2013 ยท (Permalink)
Meets the >=90% "ers" enterprise qualification
zefcfd ยท -2 points ยท Posted at 03:35:57 on September 14, 2013 ยท (Permalink)
I'm trying to figure out how someone would design this. Did they start with a sane implementation and then turn each statement in to a class and then do that again for each class?
Basically everything is agressively "normalized", where every operation is lifted into a generic interface that is then factory created to obtain a concrete implementation of what you had before. You know, in case you need to do something wildly different - but likely never will.
Then you repeat on those factorizations until you have a n3 explosion in code footprint.
This is akin to taking an algebraic equation and adding coefficients to everything that, in all likelihood, would be just "1".
a + b = c
becomes:
a*n + b*m = c*k
becomes:
(a*n)*x + (b*m)*y = (c*k)*z
... and so on. It's still the same equation, where n=1, m=1, k=1,x=1, y=1, and z=1. Only now it's much more "flexible."
Edit: I'm going to start calling this kind of coding practice "abnormalization"
jlink005 ยท 23 points ยท Posted at 22:32:26 on September 13, 2013 ยท (Permalink)
in case you need to do something wildly different.
Or in case you want dependency injection for testing.
yogthos ยท -6 points ยท Posted at 22:42:27 on September 13, 2013 ยท (Permalink)
Why the fuck should the code have to be aware of the testing? In a decent language you could just override the functions that need to be mocked in the tests themselves. For example, In Clojure if I had a function called get-results that calls the database to get the results:
The code in my application doesn't care that it's being tested and I don't have to mix concerns of the business logic and the tests. On top of that I can add tests after the fact as the need arises.
nemec ยท 15 points ยท Posted at 22:51:48 on September 13, 2013 ยท (Permalink)
That's not how it works. Dependency-injectable code isn't aware of the testing, it's just that dependency-injection makes code more easily testable than it would be otherwise.
Sure, you can do those redefinitions in Clojure, but very few enterprises actually use it. How would you do the same in Java or C#? (hint: it's either very difficult or not possible, depending on what you're trying to do)
If your application accessed the file system using File.Open() or something in C#, you can't redefine the method to call your code instead of the std library's code.
yogthos ยท 0 points ยท Posted at 23:28:15 on September 13, 2013 ยท (Permalink)
What I meant that your code has to be written with your testing framework in mind. If you only have a single class that does something, but you also need to test that functionality you'll have to create an interface and a whole bunch of ceremony to do that.
Sure, you can do those redefinitions in Clojure, but very few enterprises actually use it.
Not so much a problem for Clojure as for people stuck working in the enterprise. :)
How would you do the same in Java or C#? (hint: it's either very difficult or not possible, depending on what you're trying to do)
My point exactly. The lack of expressiveness in the language forces this sort of insanity. Something as simple as passing a function as an argument is all of a sudden a pattern.
If your application accessed the file system using File.Open() or something in C#, you can't redefine the method to call your code instead of the std library's code.
That's exactly the problem I'm pointing out.
nemec ยท 4 points ยท Posted at 23:45:12 on September 13, 2013 ยท (Permalink)
So functional == good, imperative == bad? Good to know you're not biased.
yogthos ยท 1 points ยท Posted at 01:47:25 on September 14, 2013 ยท (Permalink)
Your words not mine. I simply pointed out that you're introducing complexity to work around limitations of the language.
If you only have a single class that does something, but you also need to test that functionality you'll have to create an interface and a whole bunch of ceremony to do that.
So if you practiced 100% Code Coverage, literally every class would have an interface?
I feel so bad for your code base; this is so absurdly stupid and, more importantly, wrong.
yogthos ยท 1 points ยท Posted at 02:14:46 on September 14, 2013 ยท (Permalink)
So if you practiced 100% Code Coverage, literally every class would have an interface?
That sure does sound stupid, how you arrived at that from what I said though is another story entirely.
Offer an alternative. I think all he's talking about is separation of concerns. You don't want a monolithic class performing tons of operations. You'd have to verify too much behavior for each method.
Anyways, it depends on your testing approach I guess. There's something to be said for not extracting every possible operation into its own class, but you shouldn't swing too far in the other direction either.
How is not dealing with five different implementations of the same method call a problem? You have consistent code to use in your tests and if you're using dependency injection you can mock the object. For example, with your own code in C#...
public Results[] ShowResults()
{
// code for getting the results
return results[];
}
Your class implements and interface where ShowResults() is a defined as a method to implement. Then, when you test, you create a mock object and define what the test returns like so...
public void TestShowResults()
{
mockedObject.Setup(x => x.ShowResults()).Returns(mockedResults);
}
I think you made a mistake in your example; all it does is verify the behavior you mocked. Typically you would mock a dependency of the actual class you're testing.
Well yes, this is an abbreviated example, I should've added a comment that we now verify the output, etc., etc., I know, I know.
The whole point was to show that you don't have to throw out imperative languages to test things or have to overwrite basic behavior to mock things out in a test case.
You have it inside-out. In this case the code doesn't have to be aware of testing. The test framework needs a way to get inside the application. The app has no clue that the injected dependencies are mocks or intercepted test widgets.
DI is usually used to inject service-like dependencies. This gets you into a space where you can test interactions of objects and complete subsystems. So if you want to mock logging, your ORM, or something similar, DI makes it easy to do that.
Why the fuck should the code have to be aware of the testing?
It's not, in anyway. It's made more flexible in a manner that gives way to easier testing. The toy example that was taught to me is a web store application. You could write it in a straightforward manner with your Visa processing package explicitly written as part of it, sure. Or, using a DI model, you can make it so that if down the line you also get a MasterCard and AmEx processing packages or replace the entire thing with a catch-all processor you just have to say "hey, transaction processing package, use this processor" and everything will continue to work smoothly because why the fuck should it actually care what credit card processor it's working with? It just so happens that this is also incredibly useful for testing since you can swap out the actual processors for your own mocks.
yogthos ยท 2 points ยท Posted at 02:17:06 on September 14, 2013 ยท (Permalink)
This technique is also known as passing parameters in languages with first class functions.
Not exactly. After all, if your snark was true, dependency injection would be unheard of in Python and that is simply not the case.
More to the point, though, dependency injection is (in a minor simplification) just passing parameters in object-oriented languages in much the same way that the factory pattern is called creating objects. It's just a name for the design pattern.
[deleted] ยท 5 points ยท Posted at 08:24:46 on September 14, 2013 ยท (Permalink)
I'm not sure how to get a sense of what people and projects I'm not working with do in aggregate but I can say that I use DI in Python, was taught it by someone who uses Python, and have seen it in others' code, but that's not really a measure of how common it is. I will say that I find it highly unlikely that the full, heavy-weight, using a separate generic injector method is common but I would not be surprised to hear that the lighter-weight method of just passing dependencies to the constructor is in fairly common use.
[deleted] ยท 3 points ยท Posted at 19:47:56 on September 14, 2013 ยท (Permalink)
I actually do that all the time, but I was never taught to call it dependency injection. I suppose it is such a thing, it's just so easy in Python you don't know you're doing it. "Here, have a function! It's probably a class but what do you care?"
yogthos ยท 4 points ยท Posted at 12:35:35 on September 15, 2013 ยท (Permalink)
And this is precisely the point I'm making. In a language that supports first class functions you simply pass the function in as a parameter. It's simple and natural to do.
In a language like Java you have to design an interface make some classes and sacrifice a goat to do the same thing. So, there you have a DI pattern because the process is needlessly convoluted.
Well it depends... For a language without duck typing, you do have to deal with type restrictions in some way. Depending on the language, code, and tools it can be more or less of a pain.
For instance most of these languages have mocking frameworks that generate proxy classes under the covers for you. If the class you're mocking lets you override members of the class then you don't even need to make an interface since the framework will just subclass it and override everything.
Something like C# is fairly flexible these days since you have lambda functions that are first-class and can pass anywhere you want. You also have anonymous objects and the dynamic keyword to disable to create objects with run-time checking and method-missing and all that. Obviously the use in enterprises and history from Java mean people tend to program in certain ways, but it isn't black and white.
Edit: Also mocking and injection frameworks can be helpful even on their own. It is really simple in Python make a simple object with similar named attributes for easy cases, but if you want more complex testing involving tracking if something was called, returning different values on subsequent calls, etc then a mocking framework starts to be helpful.
It is similar for injection itself. Constructor or property/attribute injection are the same in most languages. You pass in an object that satisfies the typing or duck typing. But a framework can still have interesting features, a lot of it to do on how things are centralized or decentralized. In an ActiveRecord-style ORM, usually if you need something to happen on save(), then you can either override save or you can have some sort of external registration (Django calls it Signals).
Similarly, to access an external class or method, you usually import it in some way to the module. Since things are dynamic, you can usually replace it in a test call so that the same attribute in the module under test now points to something else. That is fine for testing but can feel a bit hacky in non-testing situations. In the settings file for Django, you can replace the default implementations of certain classes. You just list the path to your class to handle basic authentication handling or whatever and it works. That's a case of Django having its own internal dependency injection that you can hook into.
yogthos ยท 1 points ยท Posted at 11:19:40 on September 14, 2013 ยท (Permalink)
The fact that you have a pattern for something that's natural to do in other languages is a sign of a problem in my opinion.
That's ridiculous. A number of design patterns are natural to do in a number of languages. And, regardless, and I'm sorry to interrupt the "Clojure is the one true language" train that you seem to be trying to drive here but different language paradigms make different tasks easier and harder and this fact doesn't inherently make any one paradigm better than the rest.
yogthos ยท 1 points ยท Posted at 23:01:04 on September 14, 2013 ยท (Permalink)
A number of design patterns are natural to do in a number of languages.
That's not the point I'm making. What I'm saying is that in a functional language you do this naturally all the time. In OO there's so much ceremony around this that it's a pattern.
I'm sorry to interrupt the "Clojure is the one true language" train that you seem to be trying to drive here
That's a very nice straw man you got there. I simply used Clojure as an example, because I'm familiar with its syntax. This equally applies to a whole number of languages that aren't Clojure.
different language paradigms make different tasks easier and harder and this fact doesn't inherently make any one paradigm better than the rest
It's not about the paradigm, it's about whether the language is expressive enough so that you don't have friction when applying to the problems you're solving. My experience with most OO languages is that many common tasks are in fact a burden on the developer.
That's not the point I'm making. What I'm saying is that in a functional language you do this naturally all the time. In OO there's so much ceremony around this that it's a pattern.
No, it's not the point you're making; it's the flaw in the point you're making. "Ceremony" has nothing to do with it; as I said elsewhere, Python has little "ceremony" to do DI but it's still a pattern. You keep tying design patterns to languages and the fact that that is wrong is what I'm trying to say; a design pattern is a general solution for a problem that is relatively common and easy to do wrong. The amount of "ceremony" involved is wholly irrelevant. Functional and functional-ish languages like Clojure have design patterns, too, and it's not for lack of expressiveness.
That's a very nice straw man you got there.
It's not a straw man I'm trying to knock down; it's actually what you sound like. Maybe you're not specifically on the Clojure train but you are riding so hard on the "you actually have a name for this in your language so it sucks" train that it at least looks like the tracks are parallel to the "functional is one true paradigm" train.
My experience with most OO languages is that many common tasks are in fact a burden on the developer.
And I think many developers experienced in OO languages find that, in their experience, with most functional languages many common tasks are a burden. Funny how that works.
yogthos ยท 0 points ยท Posted at 03:38:54 on September 16, 2013 ยท (Permalink)
Python has little "ceremony" to do DI but it's still a pattern.
As another Python user mentioned in a reply to your comment, most people just think of it as passing arguments.
You keep tying design patterns to languages and the fact that that is wrong is what I'm trying to say;
Many patterns exist to work around the deficiencies in the language. It's right there in the name. DI is an approximation of first class functions, factory patterns are there due to lack of currying, and so on.
a design pattern is a general solution for a problem that is relatively common and easy to do wrong
Right a design pattern is a series of steps that you have to take. If there's no way to abstract them in the language you have to repeat them each time by hand.
The amount of "ceremony" involved is wholly irrelevant.
It's very much relevant. If something takes a lot of steps and easy to get wrong then you need to memorize a pattern to do it. If it can be abstracted or done easily then the pattern is much simpler and you do it naturally.
Functional and functional-ish languages like Clojure have design patterns, too, and it's not for lack of expressiveness.
Sure, you have patterns in all languages. However, many OO design patterns really are unnecessary in functional languages.
It's not a straw man I'm trying to knock down; it's actually what you sound like.
All I did was gave a concrete example of a problem being addressed by a language feature.
Maybe you're not specifically on the Clojure train but you are riding so hard on the "you actually have a name for this in your language so it sucks" train that it at least looks like the tracks are parallel to the "functional is one true paradigm" train.
I think that if you need a pattern for passing arguments to your function then you're working with a shitty language. Notice that this has nothing to do with FP or OO as people using languages like Python don't generally think about DI patterns either.
And I think many developers experienced in OO languages find that, in their experience, with most functional languages many common tasks are a burden.
The difference being that most people experienced in functional languages come from working with OO languages. I've certainly used OO for most of my career and so have most people, because that's the mainstream paradigm.
People who bothered to learn both paradigms and write any amount of significant code in them tend to agree that FP does provide many advantages.
You don't have to take my word for it though. Just look at any modern language and you'll see that they all have rich support of FP. Even poor old Java is scrambling to add lambdas after 20 years of stagnation.
KayRice ยท 5 points ยท Posted at 22:54:50 on September 13, 2013 ยท (Permalink)
Why the fuck should the code have to be aware of the testing?
So that you can use different implementations of dependent objects during testing.
In a decent language you could just override the functions that need to be mocked in the tests themselves.
Override what, global functions? Or monkey patch random objects? Even in your example of Closure code expand that concept further and you'll have an inter-mixed set of mock data / testing methods and real data methods, when they should be separate objects with separate concerns.
yogthos ยท 0 points ยท Posted at 23:19:57 on September 13, 2013 ยท (Permalink)
So that you can use different implementations of dependent objects during testing.
Which is precisely what I did above.
Override what, global functions? Or monkey patch random objects?
The override happens in a context of with-redefs this is completely different from globally monkey patching an object.
Even in your example of Closure code expand that concept further and you'll have an inter-mixed set of mock data / testing methods and real data methods, when they should be separate objects with separate concerns.
It's precisely the same thing as using mock objects, each having a separate concern. The interface here being the function signature. Just because you need more ceremony to do it in your language doesn't make it actually different in any way.
KayRice ยท 2 points ยท Posted at 23:28:02 on September 13, 2013 ยท (Permalink)
Sorry I don't know Clojure well enough to really make a valid comparison
Just because you need more ceremony to do it in your language doesn't make it actually different in any way.
So you put it all in one file inter-mixed with the real code?
yogthos ยท 1 points ยท Posted at 23:29:56 on September 13, 2013 ยท (Permalink)
So you put it all in one file inter-mixed with the real code?
Why in the world would you do that?
jlink005 ยท 2 points ยท Posted at 22:54:16 on September 13, 2013 ยท (Permalink)
Where does it say that using a factory to implement dependency injection means that the code is test-aware? You're simply giving it a reference to something that will provide concrete implementations for the things it needs. Only the tests would be aware that a fake factory producing fake implementations is being provided.
yogthos ยท 0 points ยท Posted at 23:23:02 on September 13, 2013 ยท (Permalink)
Bad phrasing on my part. What I meant to say is that the code has to be written with testing in mind up front.
jlink005 ยท 2 points ยท Posted at 01:19:02 on September 14, 2013 ยท (Permalink)
I might have to try Clojure now.
Dear god, I haven't seen so many parentheses since XQuery!
yogthos ยท 2 points ยท Posted at 01:44:05 on September 14, 2013 ยท (Permalink)
no more than most languages, they just happen to be in front of the function name as opposed to after. :)
leoel ยท 1 points ยท Posted at 12:12:09 on September 14, 2013 ยท (Permalink)
Your analogy of this problem is the greatest I have seen yet, it makes so much sense ! Maybe will I finally be able to explain to management why changing specs to get a + b = c +1 becomes suddenly way harder when the code is built as to manage a generic a * n + b * m = c * k.
For example at a POSIX like shell, 0 is "command executed successfully" and anything else is an error condition. The error is denoted by the return number.
simsea ยท 5 points ยท Posted at 23:08:34 on September 13, 2013 ยท (Permalink)
Codebase I, unfortunately, have to work with has nullable booleans in the model, while the view has two nullable booleans named ModelsBooleanIsFalse, ModelsBooleanIsTrue.
Then the observer pattern flips them back and forth. That's 27 possible states for what should be 3: true, false, or not answered. There are hundreds if not thousands of these.
Now that's enterprise!
quay42 ยท 4 points ยท Posted at 07:15:14 on September 14, 2013 ยท (Permalink)
FileNotFound
SilasX ยท 25 points ยท Posted at 17:45:20 on September 13, 2013 ยท (Permalink)
I confess, I used to find that way a lot easier to read. It was only after programming a while that I started preferring the idiom return boolean_expression.
Terr_ ยท 20 points ยท Posted at 17:59:10 on September 13, 2013 ยท (Permalink)*
I think it also depends on the developer's expectation for how the code will develop. The if/else style implies that it is a legitimate place to have additional tests or side-effects... and it just-so-happens that there aren't any at the moment or for this particular interchangeable piece.
P.S.:
One more side-thought: It can be a marginally more convenient for line-by-line debugging, especially when the if-statement is a little convoluted or involves function calls. You don't have to fiddle as much to stop at the right step, you just drop a breakpoint into the return-a-boolean line.
drb226 ยท 34 points ยท Posted at 18:07:28 on September 13, 2013 ยท (Permalink)
The if/else style implies that it is a legitimate place to have additional tests or side-effects, and it just-so-happens that there aren't any at the moment.
This is a fairly accurate way of describing the whole "enterprise software" style that this repository is parodying.
Terr_ ยท 18 points ยท Posted at 18:47:39 on September 13, 2013 ยท (Permalink)*
*shrug* Well... so what? I mean when you get right down to it, it's not about bad techniques or about bad intentions, but about good-techniques and good-intentions taken to bad-extremes.
Consider the flip-side: You get the "terse" C program that that looks like line-noise, relies on undefined compiler behavior, and requires a 98% rewrite to add even the smallest amount of new behavior. That doesn't mean return(a==b) is bad, it's just an example of a different direction.
[deleted] ยท 1 points ยท Posted at 23:31:38 on September 13, 2013 ยท (Permalink)
[deleted]
Terr_ ยท 1 points ยท Posted at 00:03:09 on September 14, 2013 ยท (Permalink)
I agree in general, for larger structures... but for this particular if/else example I'd say it's a waste of time to go: /* Someday we might do stuff here */
The kind of new dev who'll make a big stink about it is also the kind of person who'll insist that the comment-writer was wrong.
nemec ยท 3 points ยท Posted at 22:55:03 on September 13, 2013 ยท (Permalink)
If it is, make a comment in the source stating that.
Terr_ ยท 2 points ยท Posted at 23:52:23 on September 13, 2013 ยท (Permalink)*
I honestly don't think you need to "Explain Why" for the example we're talking about. Especially since the runtime behavior is identical, and the structure is independent and isolated.
nemec ยท 2 points ยท Posted at 00:50:21 on September 14, 2013 ยท (Permalink)
The if/else style implies that it is a legitimate place to have additional tests or side-effects
The problem is, that's not what it implies for me. If I saw the above code, I'd assume you forgot you can just return the boolean.
As for your postscript, the environment I use (Visual Studio) lets you execute arbitrary code when you're stopped at a breakpoint, so I don't even need to step through.
Terr_ ยท 1 points ยท Posted at 00:54:18 on September 14, 2013 ยท (Permalink)
I assume you still have to do stepping with ( (123 == bar()) || (456 == foo())) unless absolutely everything is idempotent.
Sure, you could manually run bar() while the debug thread is paused, but that can also screw up the remainder of the run.
nemec ยท 1 points ยท Posted at 01:05:04 on September 14, 2013 ยท (Permalink)
I believe you can do
(123 == bar()) ||
(456 == foo()))
and put breakpoints on each individual line, too.
Terr_ ยท 1 points ยท Posted at 02:04:51 on September 14, 2013 ยท (Permalink)
It probably works less-reliably with foo(bar(baz())) :p
One more side-thought: It can be a marginally more convenient for line-by-line debugging, especially when the if-statement is a little convoluted or involves function calls. You don't have to fiddle as much to stop at the right step, you just drop a breakpoint into the return-a-boolean line.
There's actually a refactoring for this specific case. Assign the result of the boolean to a descriptively named variable and use that instead of the literal logic statement. Aids in debugging, as well as reading and understanding the code in the first place.
Terr_ ยท 1 points ยท Posted at 19:36:14 on September 15, 2013 ยท (Permalink)
Yeah, but the whole point of the one-line-return version is brevity.
If the boolean expression is simple, then you will get brevity and that may be fine. If it's more complex logic, then you may want to stash it in a descriptively named variable to be returned, and also watched or stepped over in a debugger.
As with anything that can be complex, "it depends."
No kidding. There's not enough javadoc comments anywhere in this codebase. Also: no architecture diagrams, no UML, and no user stories. This would fail a code-review in a heartbeat.
cronus89 ยท 38 points ยท Posted at 16:04:39 on September 13, 2013 ยท (Permalink)
Time for a pull request
Asimoff ยท 15 points ยท Posted at 22:21:18 on September 13, 2013 ยท (Permalink)
As a user I would like to have a solution that tells me when I should fizz and when I should buzz.
GIVEN a user wishes to Fizz
WHEN it is the proper time to Fizz
THEN A user should be prompted to Fizz
GIVEN a user wishes to Buzz
WHEN it is the proper time to Buzz
THEN A user should be prompted to Buzz
apotheon ยท 6 points ยท Posted at 06:01:47 on September 14, 2013 ยท (Permalink)
Back! Back to the untold horrors of the blasphemous depths whence ye came, foul entity of unimaginable, alien blight from beyond the trackless dark twixt the stars!
With every option enabled, especially the ones to generate thousands of incomprehensible but impressive-looking diagrams. Also, make sure you print out every single page for each of the fifteen stakeholders.
FTFY. :)
Fabien4 ยท 3 points ยท Posted at 08:38:10 on September 14, 2013 ยท (Permalink)
make sure you print out every single page.
And if someone asks for a file instead of paper, all you have to do is scan the pages you just printed. (And yes, I've seen it done -- not for software documentation though.)
Still a fair bit to go from being really enterprisey:
The test coverage isn't there yet You've got to test every package that you're writing, apart from the overall result.
Where is the spring (or similar framework) configuration file and the remoting interface - actually you could go with an EJB2.1 compliant framework, and you could very easily quintuple the code base by using one of these patterns.
You need to specify an expensive framework.
You also need process diagrams and architecture conceptual diagrams, and a set of project milestones.
Follow all of that up and you'll be a really enterprisey developer.
You have never worked with source code for the U.S. federal government or Department of Defense.
Kalium ยท 14 points ยท Posted at 20:02:01 on September 13, 2013 ยท (Permalink)
Let's not forget the 80% of the private sector that can't afford top talent.
[deleted] ยท 17 points ยท Posted at 20:38:02 on September 13, 2013 ยท (Permalink)
90% * FTFY
And really its more like 95-99% of enterprise code is sub par. Even if you have AMAZING programmers if you have shitty management who enforce stupid structures like this (because they barely know how to code). You'll still get shitty code.
Kalium ยท 5 points ยท Posted at 21:04:19 on September 13, 2013 ยท (Permalink)
Years ago (late 90s early 2000) I programmed lots of Java but I saw this sort of architecture as the trend and now this is why I hate Java so very much. Java itself can be great but these OCD people have turned it into a monster. It is like having an 8 lane high quality highway with a speed limit of 30mph and reserving the leftmost lanes for bread trucks only.
I suspect that Scala was an attempt to keep that which was good in Java and turf the crap like this.
livrem ยท 4 points ยท Posted at 07:08:57 on September 14, 2013 ยท (Permalink)
I have worked with Java most of my career since the late 90's, and still do so (well, maybe 50 % of a typical work week is JavaScript now, but still). Only Java code I have truly enjoyed writing in many years was making a game for Java4k. I would never choose to use Java unless paid well to do so. All my other hobby-projects are written in Python, Clojure, sometimes JavaScript or C. Can't imagine a reason to use Java for anything when given a choice.
I fully agree with you but what language would you use for a 10 year project with a rotating staff of 300 average programmers in 6 offices where the only control you had was language choice?
SilasX ยท 39 points ยท Posted at 14:39:36 on September 13, 2013 ยท (Permalink)
I love the directory structure. Especially with java appearing twice.
[deleted] ยท 24 points ยท Posted at 16:06:45 on September 13, 2013 ยท (Permalink)
[deleted] ยท 6 points ยท Posted at 01:20:31 on September 14, 2013 ยท (Permalink)
Java only appears once in the package declarations, I disagree this is "java" appearing twice with this explanation:
src/main -> This is where you place folders for each language you use
src/main/java -> This is where Java source files go
src/main/brainfuck -> This is where Brianfuck files go
src/test/java -> This is where Java source files for tests go
src/test/erlang -> This is where Erlang source files for tests go
It's a structure popularized by Maven, but really has quite good use across multi-language projects. And nothing, whatsoever, to do with duplicating a name since you could become more enterprisey by having a src/main/scala folder with package com.seriouscompany.business.scala.fizzbuzz.packagenamingpackage.interfaces.stringreturners
but your Java code could use the Scala version and vice-versa. The src/main/<language> is to specify what compiler your build tool should select.
src/main/brainfuck -> This is where Brianfuck files go
Lucky Brian.
[deleted] ยท 1 points ยท Posted at 05:05:53 on September 14, 2013 ยท (Permalink)
We knew him well.
SilasX ยท 3 points ยท Posted at 01:56:52 on September 14, 2013 ยท (Permalink)
I was referring to the nesting within the same language folder: / src / main / java / com / seriouscompany / business / java
[deleted] ยท 1 points ยท Posted at 05:06:51 on September 14, 2013 ยท (Permalink)
If you write JVM code in Clojure, and for some reason want to invoke a Java written version... how else would you identify it?
I'm not saying it's good, but it is at least not redundant because the JVM package doesn't know which language it came from.
livrem ยท 2 points ยท Posted at 11:03:22 on September 14, 2013 ยท (Permalink)
Why do you need to know? It is pretty clear in Clojure code if something you call is Java or not (and if not I can't think of a reason it would be a big problem).
[deleted] ยท 1 points ยท Posted at 16:53:05 on September 14, 2013 ยท (Permalink)
If you have a DI layer, you code to the interface. Something configures the actual object that is injected for that interface, and that something needs to know specifically what class name to create. If you have a native version and a pure JVM version you need some smart way of separating these two implementations, even if you Clojure code only ever uses the interface.
SilasX ยท 1 points ยท Posted at 16:06:04 on September 14, 2013 ยท (Permalink)
If you write JVM code in Clojure, and for some reason want to invoke a Java written version... how else would you identify it?
By the file extension?
[deleted] ยท 0 points ยท Posted at 16:50:17 on September 14, 2013 ยท (Permalink)
So you're going to load a .class file and hope it retains debug information that include the original source filename? When you're running byte code you don't get the original file extension. Somehow you need to designate the package name is specific to a specific implementation. This isn't a problem, say, with Clojure, Java, Scala, Groovy, but is more of a problem when you start using native extensions because not all native extensions are compiled for all platforms the JVM runs on.
[deleted] ยท 0 points ยท Posted at 05:11:05 on September 14, 2013 ยท (Permalink)
I feel like I need a second reply to you. The first java is telling the build tool what compiler should be used for files in that directory. The second Java is identifying code in that package independent of what compiler is being invoked to compile that code. So you can have a package com.reddit.java that only contains Scala code, but if it resides in src/main/scala then everything is OK because the Scala compiler will be used instead of another compiler.
SilasX ยท 1 points ยท Posted at 16:05:20 on September 14, 2013 ยท (Permalink)
You've never heard of file extensions? .java vs .scala?
[deleted] ยท 1 points ยท Posted at 16:52:02 on September 14, 2013 ยท (Permalink)
See my other reply, you don't seem able to separate build tools versus runtime information.
The common practice is to put .java files in the src/main/java folder, and .scala files in the src/main/scala folder so that each compiler can be invoked.
gfody ยท 10 points ยท Posted at 23:30:44 on September 13, 2013 ยท (Permalink)
no IoC framework, no application server/container, no ESB, this is hilarious but sadly falls short of capturing the true horror of enterprise software complexity
Rhomboid ยท 26 points ยท Posted at 15:30:11 on September 13, 2013 ยท (Permalink)
If there's one thing enterprise Java people love, it's hierarchy. (Ctrl-F for ye olde AbstractSingletonProxyFactoryBean nestled in there somewhere.)
sh0rug0ru ยท 28 points ยท Posted at 18:51:34 on September 13, 2013 ยท (Permalink)*
To be fair, that is deep in the guts of the implementation of a generic dependency injection framework that is providing in runtime metaclass-like behavior in a language that really doesn't do metaprogramming. There's going to be some black magic in there. That hefty name should give you an idea of how much magic we're talking about here. And this isn't even really all that scary. Check out the implementation of AspectJ sometime, which does runtime bytecode hacking.
Java people hate hierarchy. After all, single inheritance only lets you go so far before the whole thing comes tumbling down on you like a ton of bricks. But Java people do love frameworks.
When I get into super absurd reflection stuff (I have a library that cglib captures method calls against getters/setters to spin up sets of related objects and prevent null objects from being returned from them) my class names get really short.
It's like, what this does is too silly to give it an actual name. So this class will be named Ghost. And this one over here is the UnEraser (it, as its name implies, provides a method for undoing the effects of type erasure in arbitrarily nested/inherited generics).
nicko68 ยท -3 points ยท Posted at 22:04:51 on September 13, 2013 ยท (Permalink)
I hate frameworks. Especially when they change and the one you used to know doesn't matter any more.
So the alternative is what? Doing everything from scratch yourself? You can still do that if you want, no one's forcing you to use other people's code.
Learning a framework is a better time investment than writing everything yourself. For the sake of your own sanity at the very least. This is assuming you have an actual need for a framework (ie it's not a trivial application).
nicko68 ยท 2 points ยท Posted at 22:01:58 on September 14, 2013 ยท (Permalink)
The problems I have with frameworks is they go in and out of style. We need Struts! No we need Spring! Also it seems to be more XML configuration than coding now. That's not fun.
At least in the .NET world, many people have moved from XML configuration to config via lambdas and such (since C# lambdas can be passed directly as expression trees, you can specify the name of a property with full type-safety and autocomplete but still not actually call the property).
Man... this is the first time I physically felt a little queasy from disgust with code related things. Usually it's just worth a chuckle, but that is some truly shameful shit right there.
sgoody ยท 9 points ยท Posted at 19:11:10 on September 13, 2013 ยท (Permalink)
Great project. Would be funniest if it were kept within the realms of a believable project. E.g. Looking through the issues, there's a suggestion of "going web scale" and another for "adding web sphere support". But adding a business case, costings, UML diagrams, object instance caching and not having hard-coded string but strings in resource files instead aren't completely unimaginable for an Enterprise Class piece of software.
I noticed that the strings Fizz and Buzz are hard coded into the application. Shouldn't these instead be stored as rows inside an Oracle database and fetched using data transaction beans instead?
mdinstuhl ยท 1 points ยท Posted at 16:45:55 on September 16, 2013 ยท (Permalink)
I once spoke to an "enterprise" developer about a slow web app. His response? "It's not supposed to be fast, it's enterprise." years later, I did an Ignite presentation and used that discussion to beg developers to consider their customers. the guy was in the room. Oops.
PolyPill ยท 12 points ยท Posted at 18:39:44 on September 13, 2013 ยท (Permalink)
I joked once about doing this and in java and calling it FizzBuzz Enterprise Edition, I love that some sick and twisted person actually did this!
It's a project with 12 contributors and 69 commits to date, so I'm happy to say that FizzBuzzEnterpriseEdition is a thriving community project with great prospects for future development.
It strikes me that it might be time to arbitrarily reimplement parts of it in Perl (maintaining both versions in perpetuity, of course) and then throw in a bit of dependency injection so that arbitrary modules can be used in either environment...
beltorak ยท 7 points ยท Posted at 02:12:43 on September 14, 2013 ยท (Permalink)
not bad, but it needs to inject some inversion of dependency control. I see a lot of directly instantiating classes. That's not proper separation of concerns.
[deleted] ยท 22 points ยท Posted at 17:15:43 on September 13, 2013 ยท (Permalink)*
[deleted]
deadowl ยท 19 points ยท Posted at 19:54:00 on September 13, 2013 ยท (Permalink)
Okay, Mr. _ C# pi. Did I get your middle name right?
Using IInterface names in Java is usually frowned upon. Java is usually SomeType implemented as SomeTypeImpl, whereas C# is ISomeType implemented as SomeType.
Not sure which is worse.
mavr1k ยท 6 points ยท Posted at 21:35:13 on September 13, 2013 ยท (Permalink)
Did anyone else click the linking hoping it was a Star Trek themed version of Fizzbuzz?
.... I did =(
[deleted] ยท 4 points ยท Posted at 20:53:06 on September 13, 2013 ยท (Permalink)
I can't find any spring xml in your project? How do I configure it? +Also, you should probably split some of that code into a submodule. ++Also, where is the code for the REST interface?
sirin3 ยท 13 points ยท Posted at 17:35:32 on September 13, 2013 ยท (Permalink)
Repost!
Or is that the point? In enterprises you do the same stuff again and again and claim it is an innovation? Like calling the mainframes cloud?
seruus ยท 9 points ยท Posted at 21:18:22 on September 13, 2013 ยท (Permalink)
Yes and no. It's really more of a parody of taking the absurdly simple and lofting it into the absurdly complex. Only there really are programs that do some of this - Java programsenterprise architectures seem to take the cake in this department.
The result is often anemic documentation supporting a fiendishly complex network of objects, that has you spelunking into megabytes of javadoc pages... all to write a webpage.
This thing takes it to the next level by completely obfuscating what is supposed to be a tiny code snippet that is comprised of a loop, a few modulus operations, and some print statements. But hey, if you ever wanted to implement "FizzBuzzBang", this is the architecture to use.
[deleted] ยท 6 points ยท Posted at 21:00:22 on September 13, 2013 ยท (Permalink)
all to write a web page
And this is why Comedy, is really all about tragedy.
goldman60 ยท 3 points ยท Posted at 05:02:58 on September 14, 2013 ยท (Permalink)
Good day from the land of Atlassian Confluence plugin writing.
spetznatz ยท 2 points ยท Posted at 12:38:16 on September 14, 2013 ยท (Permalink)
Oh I've been to that land. And I never want to return.
[deleted] ยท 2 points ยท Posted at 00:28:06 on September 14, 2013 ยท (Permalink)
Of course it is. The dude who made it posted it to /g/ hours after he considered it ready and got plenty of laughs.
Fabien4 ยท 2 points ยท Posted at 08:36:09 on September 14, 2013 ยท (Permalink)
The correct word is "parody".
[deleted] ยท 2 points ยท Posted at 15:29:44 on September 13, 2013 ยท (Permalink)
Well, frankly, this is what students are taught as being good style -- even if taken to absurdity.
RommelTJ ยท 18 points ยท Posted at 15:38:16 on September 13, 2013 ยท (Permalink)
Can't speak for other schools, but my professors taught that even though design patterns are important, overusing them is also bad. They taught me that the vast majority of time in the software development cycle will be spent on maintenance, so designing a simple and maintainable system at the expense of performance is more important.
vplatt ยท 12 points ยท Posted at 20:30:55 on September 13, 2013 ยท (Permalink)
I agree, except that designing a simple and maintainable system normally produces a faster system anyway, and you won't normally lose any performance. However, you might lose flexibility. Example: "Oh, you didn't put all your business logic behind Spring interfaces?! OMG! What if you want to swap one out someday?" The real question is: will you ever really swap them for new logic someday? Really?
Every bit of flexibility in a system is another feature waiting to break someday and need maintenance. Always ask yourself if you really need that flexibility before you trade in your future free time for it.
[deleted] ยท 11 points ยท Posted at 22:17:55 on September 13, 2013 ยท (Permalink)*
I have left reddit for Voat due to years of admin mismanagement and preferential treatment for certain subreddits and users holding certain political and ideological views.
The situation has gotten especially worse since the appointment of Ellen Pao as CEO, culminating in the seemingly unjustified firings of several valuable employees and bans on hundreds of vibrant communities on completely trumped-up charges.
The resignation of Ellen Pao and the appointment of Steve Huffman as CEO, despite initial hopes, has continued the same trend.
As an act of protest, I have chosen to redact all the comments I've ever made on reddit, overwriting them with this message.
Finally, click on your username at the top right corner of reddit, click on comments, and click on the new OVERWRITE button at the top of the page. You may need to scroll down to multiple comment pages if you have commented a lot.
After doing all of the above, you are welcome to join me on Voat!
ragwell ยท 2 points ยท Posted at 00:59:03 on September 14, 2013 ยท (Permalink)
I'm thinking about printing this part of the thread and posting it on my office wall.
vplatt ยท 1 points ยท Posted at 22:48:50 on September 13, 2013 ยท (Permalink)
Exactly.
zeekar ยท 6 points ยท Posted at 20:56:55 on September 13, 2013 ยท (Permalink)
YAGNI.
NYKevin ยท 5 points ยท Posted at 17:25:15 on September 13, 2013 ยท (Permalink)
My SD&D course taught us about patterns, yes, but they also gave us drawbacks for every single one of them. You can't just throw every pattern in the GoF book at the wall and expect the result to work.
That's where you start inventing new design pattern names.
Manger: Why did you use a switch block instead of the strategy pattern here behind a faรงade with an abstract factory?
Dev: We considered our options and decided that the selection pattern was more appropriate.
codygman ยท 5 points ยท Posted at 20:09:04 on September 13, 2013 ยท (Permalink)
You are awesome, that is all.
NYKevin ยท 5 points ยท Posted at 18:07:45 on September 13, 2013 ยท (Permalink)
Even GoF had drawbacks listed under its patterns. Next time someone tells you that, pull up a list of pros and cons for the pattern and start asking them about the tradeoffs.
vargonian ยท 2 points ยท Posted at 17:57:33 on September 15, 2013 ยท (Permalink)
This really did bring back awful memories of over-engineered tools I worked on at my previous job. All of the greatest internal software tools in my org started as hobbyist projects created to solve a particular problem. But as soon as they became popular, they were adopted by shared engineering teams that turned them into enterprisey engineering nightmares that never saw any progress because they were too bogged down in process.
That's not to say that I'm against solid engineering practices, but as much as I hate this cliche, it's a balance.
I'm dealing with SharePoint at work and I am amazed at how accurate this is. An example custom workflow available on CodePlex needed about 30 different files in order to perform a simple GET request on a web service.
dev_ire ยท 1 points ยท Posted at 21:51:47 on September 13, 2013 ยท (Permalink)
There is a C# edition but very few people can see it, and less people actually care.
vargonian ยท 0 points ยท Posted at 03:54:20 on September 14, 2013 ยท (Permalink)
I'll take C# over Java any day of the week.
[deleted] ยท -1 points ยท Posted at 18:52:01 on September 13, 2013 ยท (Permalink)
Do you think this is a mothe******* game?
[deleted] ยท 9 points ยท Posted at 19:23:16 on September 13, 2013 ยท (Permalink)
[deleted]
[deleted] ยท 2 points ยท Posted at 20:04:47 on September 13, 2013 ยท (Permalink)
Profanity is the crutch of the inarticulate ******.
[deleted] ยท 6 points ยท Posted at 20:15:55 on September 13, 2013 ยท (Permalink)
[deleted]
eddiemoya ยท 1 points ยท Posted at 04:51:03 on September 14, 2013 ยท (Permalink)
Because *********** * you.
[deleted] ยท 1 points ยท Posted at 21:58:03 on September 13, 2013 ยท (Permalink)*
Oh look, somebody who saw what real developers do with maven once and got scared, and went back to the sandbox with his python and sublime text editor.
Fanaden ยท 11 points ยท Posted at 20:26:49 on September 13, 2013 ยท (Permalink)
Somebodies a defensive (stockholm syndrome?) Java enterprise dev.
No, I just find it humorous when people bitch about stuff like "look at all these directories!" and somehow don't realize that's how Java lays things out in its package structure. I guess if you want to keep ALL your source in one directory, and have no concepts of modules, packages, or namespaces, that's cool...-ish
s73v3r ยท 2 points ยท Posted at 22:41:41 on September 14, 2013 ยท (Permalink)
Considering that Windows has a maximum directory string length, and will actually refuse to delete things that are longer than that, I'd prefer not having a billion directories.
I know this limitation was there in Windows XP, I'm not sure about Windows 7 or 8.
danielkza ยท 13 points ยท Posted at 20:39:15 on September 13, 2013 ยท (Permalink)
Only Java programmers are real developers, of course. Those dynamic languages are just toys for kids who think they can program. /s
bureX ยท 3 points ยท Posted at 21:33:45 on September 13, 2013 ยท (Permalink)
Poe's law up in here...
[deleted] ยท 5 points ยท Posted at 19:38:13 on September 13, 2013 ยท (Permalink)
This describes me perfectly. Import this bitches.
ahminus ยท 5 points ยท Posted at 19:09:41 on September 13, 2013 ยท (Permalink)
I laughed, but as much as "enterprise-y" tech and techniques are used in asinine ways and inappropriate situations at times, it feels like the pendulum has swung too far back the other way. (At least for serious development at any scale / reasonably high reliability standard.)
drewsy888 ยท -5 points ยท Posted at 20:43:36 on September 13, 2013 ยท (Permalink)
This was a top post on /r/programming a week or two ago. Is this how often this will get reposted?
[deleted] ยท -16 points ยท Posted at 17:29:54 on September 13, 2013 ยท (Permalink)
ITT: no engineers whatsoever
codygman ยท 4 points ยท Posted at 20:52:37 on September 13, 2013 ยท (Permalink)
I don't get it, we're not allowed to make fun of the overengineered Java enterprise software? Or do you just want us all to take this as a challenge?
well, to make you happy, here you go:
mapM_ putStrLn [fromMaybe (show n) $ mconcat (map (\(a,b) -> if (n `mod` a) == 0 then Just b else Nothing) [(3, "Fizz"), (5, "Buzz")]) | n <- [1..100]]
'course, you need to import Data.Maybe and Data.Monoid, so it's not really a one-liner
You're allowed, but there's "making fun of it" and then "being stupid." This example, while it might seem funny, has no actual relation to what happens. It'd be like if someone went into haskell and made everything a monoid, including moving an int to a string and back. You'd be like, "well, it's clearly bad, but it's not even close enough to real to be funny" If just out-weirding the next person is the goal, brainfuck or something else is the way to go.
[deleted] ยท -1 points ยท Posted at 13:03:42 on September 14, 2013 ยท (Permalink)
my point is using proven components and strategies to construct complex products is a time-honored engineering practice
and the sort of people who make fun of this approach are not engineers, nor familiar with the discipline of engineering
take a look at the open source projects by companies like Google, Twitter, Facebook et al and you'll see code that much more closely resembles FizzBuzzEE than myfirstPHPproject.com
s73v3r ยท 2 points ยท Posted at 22:43:08 on September 14, 2013 ยท (Permalink)
Your point is that this shit is somehow worthwhile, and not just a huge waste of time and pain in the ass because some business weenie somewhere has commitment issues.
and the sort of people who make fun of this approach are not engineers, nor familiar with the discipline of engineering
Yes, they are. That's why they're able to make fun of it.
This stuff you defend was not made by engineers. It was made by businessmen pretending to be engineers so they don't have to actually employ engineers.
[deleted] ยท 0 points ยท Posted at 00:18:46 on September 15, 2013 ยท (Permalink)
TIL Google, Twitter, LinkedIn, Tumblr etc engineers are really "businessmen pretending to be engineers so they don't have to actually employ engineers"
Saved comment
[deleted] ยท 153 points ยท Posted at 16:43:50 on September 13, 2013 ยท (Permalink)*
[deleted]
segfaultzen ยท 91 points ยท Posted at 17:55:18 on September 13, 2013 ยท (Permalink)
It needs to generate some of the java source code from XML run through XSLT.
ew73 ยท 68 points ยท Posted at 19:16:47 on September 13, 2013 ยท (Permalink)
Only if the XML originates on a remote SOAP endpoint.
segfaultzen ยท 32 points ยท Posted at 19:40:57 on September 13, 2013 ยท (Permalink)
But of course! And the SOAP endpoint is obtained by looking up the code generation service from a UDDI service catalogue.
I mean, what if something changes?
flying-sheep ยท 12 points ยท Posted at 00:55:13 on September 14, 2013 ยท (Permalink)
and in the end, everything there is written by the businessโs bossโs nephew
idiogeckmatic ยท 25 points ยท Posted at 01:19:22 on September 14, 2013 ยท (Permalink)
in PHP.
[deleted] ยท 28 points ยท Posted at 19:09:15 on September 13, 2013 ยท (Permalink)
twitch.
SublethalDose ยท 9 points ยท Posted at 21:57:49 on September 13, 2013 ยท (Permalink)
Been there, done that.
ikillau ยท 4 points ยท Posted at 00:32:09 on September 14, 2013 ยท (Permalink)
While using spring to automatically find the XML code
eat-your-corn-syrup ยท 2 points ยท Posted at 04:09:33 on September 14, 2013 ยท (Permalink)
Just some? Not enough mate. Real men write their whole programs in XML and compile the XML code to JVM!
segfaultzen ยท 5 points ยท Posted at 12:23:44 on September 14, 2013 ยท (Permalink)
Tiddlywinks.
If you want to show some real sack, you compile the XML, validated against a hierarchical XSD, through XSLT to three different JVM languages, none of which are Java, compile to byte-code, serialize the byte-code to XML, transform it to JSON, wrap it in a routing envelope, and transmit to your service clusters over a MOM. An Orchestration service then plucks the message off the queue, validates the JSON, transforms to XML, validates the XML, and deserializes the XML to instantiated objects. The objects then begin working. They request appropriate endpoints from a UDDI service, initiate direct TCP connections with a proprietary binary, wire-protocol (for efficiency), compute the result, wrap the result in XML, transform it to JSON, and send it to the MOM. The email service takes the message off the queue, validates the JSON, transforms to XML, validates the XML, validates the result, and composes an email to boss@enterprisey-land.com with the FizzBuzz results.
Some would say this is overkill, but look at how extensible, loosely coupled, and portable it is!
I declare this horse dead.
toaster13 ยท 2 points ยท Posted at 05:11:42 on September 14, 2013 ยท (Permalink)
We could change it to yaml to be more web 2.0
apotheon ยท 3 points ยท Posted at 05:55:49 on September 14, 2013 ยท (Permalink)
No way -- someone might be able to read it, then.
ours ยท 1 points ยท Posted at 18:28:13 on September 14, 2013 ยท (Permalink)
He said enterprise. None of that fancy schmansy JSON or YAML or anything that's not at least 10-years-old. Moar XML!
yogthos ยท 10 points ยท Posted at 22:35:14 on September 13, 2013 ยท (Permalink)
There should also be a SOAP service somewhere to connect the business logic to the presentation layer. :)
darlingbastard ยท 300 points ยท Posted at 21:08:37 on September 13, 2013 ยท (Permalink)
This codebase has a number of issues to resolve before it can be truly enterprise ready. Configuration is non-existent and needs to be moved into an XML layer or even better a naming service such as JNDI or LDAP. The author should consider using dependency injection to build his objects rather than invoking constructors and factories directly. As it stands you have to recompile the project to change even the simplest settings.
The most glaring error is any kind of externally configurable logging which is absolutely required to be enterprise ready. There is also a complete lack of metrics or management code. Adding some JMX support would be a good start and ideally some statsd integration so you can get some runtime insights into what the code is doing. Right now the whole thing is just a black box. How are you supposed to monitor and track this thing?
At an architectural level there is no reliability guarantee on execution either. If you crash half way through, have a power outage etc, you have to manually restart the process. The whole thing should be triggered by a durable message queue and actually processed by a set of redundant back-end services which would guarantee execution and deliver the finalized document asynchronously. This would also decouple resource usage and allow different SLAs (service level agreements). As it stands, I have no way of guaranteeing resource availability to my Gold customers and thus no way to actually deliver on contractual performance guarantees which may have been made by the sales team. Our top tier customers for example would probably have dedicated boxes reserved for handling just their traffic. Which of course requires some level of identity services/authentication.
In summary: we are missing
This is a good start though.
mike413 ยท 56 points ยท Posted at 01:46:25 on September 14, 2013 ยท (Permalink)*
You must have an old version of our requirements doc, because you have no mention of:
hmmdar ยท 50 points ยท Posted at 03:32:17 on September 14, 2013 ยท (Permalink)
Oh, don't worry that your copy of the requirement doc says 'Final' revision. We're agile, that means we can add significant features/changes in alpha testing without adjusting the schedule.
eddiemoya ยท 54 points ยท Posted at 04:48:27 on September 14, 2013 ยท (Permalink)
Mine says "PRD_v6_final3.doc", but Bob has "PRD_v6_final3(2).doc".
quay42 ยท 27 points ยท Posted at 07:09:44 on September 14, 2013 ยท (Permalink)
Mine's named the same but has significantly different content. Good thing we sent over email so we all can have local copies.
segfaultzen ยท 8 points ยท Posted at 12:27:14 on September 14, 2013 ยท (Permalink)
Oh god, I'm having flashbacks to my DoD days. This is what actually happens.
[deleted] ยท 17 points ยท Posted at 06:59:20 on September 14, 2013 ยท (Permalink)*
[deleted]
[deleted] ยท 7 points ยท Posted at 13:15:28 on September 14, 2013 ยท (Permalink)
Weโll need to think about the requirements for the requirements.
Gusfoo ยท 7 points ยท Posted at 13:37:55 on September 14, 2013 ยท (Permalink)
Let's set up an architecture board to make standards decisions about the format of the requirements meeting.
eddiemoya ยท 1 points ยท Posted at 00:01:07 on September 15, 2013 ยท (Permalink)
I think the PRD you have doesnt match the BRD at this point. Figuring this all out could take some time, so lets just have the developers start working in the mean time. Wouldn't want to waste any time.
segfaultzen ยท 2 points ยท Posted at 01:04:56 on September 15, 2013 ยท (Permalink)
That makes us "agile" right?
incredulitor ยท 64 points ยท Posted at 22:02:00 on September 13, 2013 ยท (Permalink)
Just make sure you can get a diagram summarizing this to me by next Friday and I think we'll be on track for next quarter's LOC target.
unstoppable-force ยท 16 points ยท Posted at 22:47:11 on September 13, 2013 ยท (Permalink)
I'm going to need you to come in this weekend though just to make sure that the project is going to be on budget and on time. Also, clear your nights and sleep schedule next week.
[deleted] ยท 1 points ยท Posted at 15:51:24 on September 16, 2013 ยท (Permalink)
We invest in our employees! That is why we decided to invest in luxurious feeding tubes built into your cubicles!
toaster13 ยท 3 points ยท Posted at 05:13:12 on September 14, 2013 ยท (Permalink)
Make sure its on your next TPS report.
wolfkin ยท 1 points ยท Posted at 05:48:49 on September 14, 2013 ยท (Permalink)
in triplicate
[deleted] ยท -1 points ยท Posted at 02:10:07 on September 14, 2013 ยท (Permalink)
And make sure you put a cover sheet on the TPS report!!!
sumdudeinhisundrware ยท 34 points ยท Posted at 03:19:45 on September 14, 2013 ยท (Permalink)
I actually believe that you are genuine. People like you really do exist.
segfaultzen ยท 6 points ยท Posted at 12:28:56 on September 14, 2013 ยท (Permalink)
Dude needs 300 slides worth of sequence diagrams.
[deleted] ยท 1 points ยท Posted at 15:50:02 on September 16, 2013 ยท (Permalink)
I have definitely worked with a few recently graduated Phds that would have come up with both the original OPs code, and the response all on dead simple CRUD apps. Also, happy cakeday!
lechatsportif ยท 0 points ยท Posted at 18:13:06 on September 14, 2013 ยท (Permalink)
He's naming real things, but they're not complicated and they're not all required to write one line of code. No org guesses at SLAs either, they're something discussed before the dev begins.
When you work on projects of scale for clients like the govt or financial sector, standard architectures are a good thing. They're not there just because some Java dev somewhere thought he needed something called JMX. I think ppl in this thread think that there is some sort of lack of ability that brings people to Java coding which is pretty funny.
sumdudeinhisundrware ยท 2 points ยท Posted at 14:59:21 on September 15, 2013 ยท (Permalink)
^ There's one
segfaultzen ยท 1 points ยท Posted at 01:07:07 on September 15, 2013 ยท (Permalink)
You're taking this thread too seriously. :)
berlinbrown ยท 9 points ยท Posted at 00:08:38 on September 14, 2013 ยท (Permalink)
It looks like he just worked on one layer.
It would be interesting if he pulled in OSGI, Spring, and a host of other large libraries
wowowowowa ยท 9 points ยท Posted at 03:11:02 on September 14, 2013 ยท (Permalink)
See, that's not Enterprise, stuff like externally configurable logging and metrics / JMX is somewhat essential.
gheffern ยท 1 points ยท Posted at 13:20:03 on September 14, 2013 ยท (Permalink)
To FizzBuzz?!!??!
mdinstuhl ยท 7 points ยท Posted at 22:35:24 on September 13, 2013 ยท (Permalink)
Do we have a support plan in place for this yet?
segfaultzen ยท 1 points ยท Posted at 12:29:57 on September 14, 2013 ยท (Permalink)
That will be determined when the budget comes out. In the meantime, write it to have 100% uptime.
[deleted] ยท 1 points ยท Posted at 15:52:15 on September 16, 2013 ยท (Permalink)
This is the one requirement that actually makes sense, given the implementation.
berlinbrown ยท 6 points ยท Posted at 00:05:42 on September 14, 2013 ยท (Permalink)
No web-app?
[deleted] ยท 7 points ยท Posted at 03:41:25 on September 14, 2013 ยท (Permalink)
We're also going to need Android and iOS mobile apps.
apotheon ยท 6 points ยท Posted at 05:56:51 on September 14, 2013 ยท (Permalink)
What are you waiting for? Fork, clone, edit, commit, push, send pull request! It's on GitHub!!!
[deleted] ยท 9 points ยท Posted at 07:30:53 on September 14, 2013 ยท (Permalink)
I'm waiting for Bob, your CEO, to sign my work contract for the next 5 years. $5000 per hour, mmmyiss
apotheon ยท 1 points ยท Posted at 17:48:09 on September 14, 2013 ยท (Permalink)
. . . and yet, I'd like to see the joke on GitHub progress.
flukshun ยท 2 points ยท Posted at 06:41:48 on September 14, 2013 ยท (Permalink)
Also needs to be distributed inside a virtual appliance to ensure its all run on a specific java runtime and with all supporting services configured appropriately. Yes this could be done with proper packaging but that's not enterprise enough damnit
MindStalker ยท 1 points ยท Posted at 15:00:02 on September 14, 2013 ยท (Permalink)
Can I just build the authentication on the firewall?
onionhammer ยท 1 points ยท Posted at 16:03:54 on September 15, 2013 ยท (Permalink)
Make a pull request
kelton5020 ยท -2 points ยท Posted at 06:48:43 on September 14, 2013 ยท (Permalink)*
You can dependency inject with constructors. That statement you made doesn't make any sense because using, or not using constructors has nothing to do with dependency injection.
interiot ยท 183 points ยท Posted at 16:03:52 on September 13, 2013 ยท (Permalink)*
Here's the directory structure:
ericanderton ยท 58 points ยท Posted at 16:11:52 on September 13, 2013 ยท (Permalink)
It was at "packagenamingpackage" that I started to wonder if GitHub's website unit-tests are this aggressive.
dirice87 ยท 41 points ยท Posted at 22:55:54 on September 13, 2013 ยท (Permalink)
i laughed until i looked at my own project directory...
[deleted] ยท 39 points ยท Posted at 17:58:58 on September 13, 2013 ยท (Permalink)
Needs some more unit tests.
kingvolcano ยท 30 points ยท Posted at 20:21:32 on September 13, 2013 ยท (Permalink)
What about integration tests and functional tests?
ikillau ยท 20 points ยท Posted at 22:56:47 on September 13, 2013 ยท (Permalink)*
don't stop there, security audit, pen test, regression test, coverage testing, an offshore and an on shore QA testing team and more unit tests
Atario ยท 6 points ยท Posted at 05:00:04 on September 14, 2013 ยท (Permalink)
Or maybe some fuzz tests, you'd thinkโฆor at least fizz tests
zefcfd ยท 1 points ยท Posted at 03:36:41 on September 14, 2013 ยท (Permalink)
testes, heh
amertune ยท 12 points ยท Posted at 22:04:49 on September 13, 2013 ยท (Permalink)
no, that one test with 20 asserts should be fine.
void_fraction ยท 3 points ยท Posted at 23:58:46 on September 13, 2013 ยท (Permalink)
No unit tests, just QA scripts.
kat5dotpostfix ยท 54 points ยท Posted at 17:05:10 on September 13, 2013 ยท (Permalink)
I think we need some longer, more descriptive package names.
[deleted] ยท 16 points ยท Posted at 20:47:56 on September 13, 2013 ยท (Permalink)
Agreed, separation of concerns also appears to be approached in a very homogenous manner.
[deleted] ยท 8 points ยท Posted at 01:11:42 on September 14, 2013 ยท (Permalink)
You're welcome to submit a pull request.
Elite6809 ยท 10 points ยท Posted at 23:10:46 on September 13, 2013 ยท (Permalink)
Java's starting to look like Objective-C, what with the half-a-megabyte identifiers.
Underbyte ยท 18 points ยท Posted at 01:17:46 on September 14, 2013 ยท (Permalink)
This is why we in Cocoa land don't have namespaces. If we did we would never get anything done.
Blou_Aap ยท -2 points ยท Posted at 06:45:40 on September 14, 2013 ยท (Permalink)
Well, java is Obj C's kid though.
0x7262 ยท 13 points ยท Posted at 04:31:50 on September 14, 2013 ยท (Permalink)
.gitignore has eclipse, visual studio, python package, windows folder, mac folder and all possible compiled artifact exclusions.
refined.
SanityInAnarchy ยท 49 points ยท Posted at 23:29:41 on September 13, 2013 ยท (Permalink)
Ah, clever. Just a little mild overkill in organizing your project properly... Let's check out the implementation...
Okay, I guess it makes sense to split up projects and allow more than one language per project, but...
Nothing wrong with a good package structure... But wait, isn't that second 'java' redundant?
Aha...
...wait, what?
Ah, haha, I see what you did there... Let's start with the interfaces.
...oh... fuck. This might not have been such a good idea after all... I don't feel so good...
That's not what I think it is, is it? ...I think I'm gonna throw up...
HURL
[deleted] ยท 19 points ยท Posted at 01:13:45 on September 14, 2013 ยท (Permalink)
No, in standard Maven projects you have src/main/<language>
So in this case, the root of the package name does not include main/java, instead that is specifying where to place Java source files. The mirror for tests would be src/test/java for Java based tests.
SanityInAnarchy ยท 11 points ยท Posted at 01:44:59 on September 14, 2013 ยท (Permalink)
No, I'm not complaining about the first 'java', that makes sense, and I figured it was some standard project layout.
What I don't see is why you would have a package scheme that starts with com.seriouscompany.business.java -- isn't java kind of implied by the fact that this is a java package at this point? What, exactly, is it disambiguating to have a directory called src/main/java/com/seriouscompany/business/java/... ?
adrianmalacoda ยท 63 points ยท Posted at 04:05:42 on September 14, 2013 ยท (Permalink)
It needs the second "java" in order to be J2EE compliant, you see. That's why it's called J2EE.
rob132 ยท 11 points ยท Posted at 04:15:16 on September 14, 2013 ยท (Permalink)
I finally understand. Thanks!
HaMMeReD ยท 8 points ยท Posted at 06:04:59 on September 14, 2013 ยท (Permalink)
I SEE THE LIGHT!!! Finally it all makes so much sense, I finally understand java!
euos ยท -8 points ยท Posted at 04:24:15 on September 14, 2013 ยท (Permalink)
Bullshit.
What is "J2EE compliant"? Servers may be compliant with some JEE specs (e.g. Servlets, EJBs, etc.) but the applications cannot be "JEE compliant". And nothing ever requires putting "java" in package name.
SanityInAnarchy ยท 12 points ยท Posted at 05:05:28 on September 14, 2013 ยท (Permalink)
Whoosh.
[deleted] ยท 1 points ยท Posted at 05:07:17 on September 14, 2013 ยท (Permalink)
If you write JVM code in Clojure, and for some reason want to invoke a Java written version... how else would you identify it?
I'm not saying it's good, but it is at least not redundant because the JVM package doesn't know which language it came from. Perhaps you care, because you're enterprisey.
tweakerbee ยท 3 points ยท Posted at 11:08:27 on September 14, 2013 ยท (Permalink)
I don't know if you're serious, but the answer is: "you don't care where it comes from". It's all running on the JVM. No problem to simply call the class with Clojure/Scala/Groovy/[insert_your_favorite_langugage_on_JVM_here].
[deleted] ยท 0 points ยท Posted at 16:47:52 on September 14, 2013 ยท (Permalink)
You do care, though. Something, somewhere has to configure what version you use. If it's native extension you can only use it on the platforms the native code has been compiled for. Hence it does matter, and this is one way to use package names.
SanityInAnarchy ยท 1 points ยท Posted at 05:21:24 on September 14, 2013 ยท (Permalink)
Why would you have both versions to begin with? That seems wasteful...
And why wouldn't you disambiguate that way back up at the src/ level? I mean, clojure doesn't compile to Java source, does it?
[deleted] ยท 1 points ยท Posted at 05:32:39 on September 14, 2013 ยท (Permalink)
Enterprise code is wasteful for a lot of good and bad reasons. Maybe you can get by with a pure JVM version, but some customer has performance needs that require some native code. That means you have more than one implementation of the same concept.
src/main/<language> is intended for multi-language projects, at the compiler or build tool level. Not at the runtime level.
Clojure, Scala, Groovy, etc, all compile down to the JVM bytecode. If you want a specific version of a class (maybe a C version, because you want that native code feel) then this is one possible way of specifically calling out com.mycoolproject.c.CoolClass instead of com.mycoolproject.java.CoolClass, when they both implement com.mycoolproject.CoolClassInterface. Using this may be through configuration (and not a new com.mycoolproject.c.CoolClass call) but you are still specifically targeting one version of this over others.
darkowl ยท 9 points ยท Posted at 01:55:09 on September 14, 2013 ยท (Permalink)
Meets the >=90% "ers" enterprise qualification
zefcfd ยท -2 points ยท Posted at 03:35:57 on September 14, 2013 ยท (Permalink)
http://i.imgur.com/Ibq3d.jpg
son-of-chadwardenn ยท 86 points ยท Posted at 14:51:02 on September 13, 2013 ยท (Permalink)
I'm trying to figure out how someone would design this. Did they start with a sane implementation and then turn each statement in to a class and then do that again for each class?
ericanderton ยท 229 points ยท Posted at 15:52:48 on September 13, 2013 ยท (Permalink)*
Yes.
Basically everything is agressively "normalized", where every operation is lifted into a generic interface that is then factory created to obtain a concrete implementation of what you had before. You know, in case you need to do something wildly different - but likely never will.
Then you repeat on those factorizations until you have a n3 explosion in code footprint.
This is akin to taking an algebraic equation and adding coefficients to everything that, in all likelihood, would be just "1".
becomes:
becomes:
... and so on. It's still the same equation, where n=1, m=1, k=1,x=1, y=1, and z=1. Only now it's much more "flexible."
Edit: I'm going to start calling this kind of coding practice "abnormalization"
jlink005 ยท 23 points ยท Posted at 22:32:26 on September 13, 2013 ยท (Permalink)
Or in case you want dependency injection for testing.
yogthos ยท -6 points ยท Posted at 22:42:27 on September 13, 2013 ยท (Permalink)
Why the fuck should the code have to be aware of the testing? In a decent language you could just override the functions that need to be mocked in the tests themselves. For example, In Clojure if I had a function called
get-resultsthat calls the database to get the results:I can just redefine it in my test
The code in my application doesn't care that it's being tested and I don't have to mix concerns of the business logic and the tests. On top of that I can add tests after the fact as the need arises.
nemec ยท 15 points ยท Posted at 22:51:48 on September 13, 2013 ยท (Permalink)
That's not how it works. Dependency-injectable code isn't aware of the testing, it's just that dependency-injection makes code more easily testable than it would be otherwise.
Sure, you can do those redefinitions in Clojure, but very few enterprises actually use it. How would you do the same in Java or C#? (hint: it's either very difficult or not possible, depending on what you're trying to do)
If your application accessed the file system using
File.Open()or something in C#, you can't redefine the method to call your code instead of the std library's code.torofukatasu ยท 2 points ยท Posted at 01:46:50 on September 14, 2013 ยท (Permalink)
for C#, check out Pex & Moles
yogthos ยท 0 points ยท Posted at 23:28:15 on September 13, 2013 ยท (Permalink)
What I meant that your code has to be written with your testing framework in mind. If you only have a single class that does something, but you also need to test that functionality you'll have to create an interface and a whole bunch of ceremony to do that.
Not so much a problem for Clojure as for people stuck working in the enterprise. :)
My point exactly. The lack of expressiveness in the language forces this sort of insanity. Something as simple as passing a function as an argument is all of a sudden a pattern.
That's exactly the problem I'm pointing out.
nemec ยท 4 points ยท Posted at 23:45:12 on September 13, 2013 ยท (Permalink)
So functional == good, imperative == bad? Good to know you're not biased.
yogthos ยท 1 points ยท Posted at 01:47:25 on September 14, 2013 ยท (Permalink)
Your words not mine. I simply pointed out that you're introducing complexity to work around limitations of the language.
LeSlowpoke ยท -1 points ยท Posted at 00:08:44 on September 14, 2013 ยท (Permalink)
So if you practiced 100% Code Coverage, literally every class would have an interface?
I feel so bad for your code base; this is so absurdly stupid and, more importantly, wrong.
yogthos ยท 1 points ยท Posted at 02:14:46 on September 14, 2013 ยท (Permalink)
That sure does sound stupid, how you arrived at that from what I said though is another story entirely.
flagrantaroma ยท 1 points ยท Posted at 01:14:23 on September 14, 2013 ยท (Permalink)
Offer an alternative. I think all he's talking about is separation of concerns. You don't want a monolithic class performing tons of operations. You'd have to verify too much behavior for each method.
Anyways, it depends on your testing approach I guess. There's something to be said for not extracting every possible operation into its own class, but you shouldn't swing too far in the other direction either.
neutronfish ยท -2 points ยท Posted at 00:59:33 on September 14, 2013 ยท (Permalink)
How is not dealing with five different implementations of the same method call a problem? You have consistent code to use in your tests and if you're using dependency injection you can mock the object. For example, with your own code in C#...
Your class implements and interface where ShowResults() is a defined as a method to implement. Then, when you test, you create a mock object and define what the test returns like so...
And there you go. What was the problem again?
flagrantaroma ยท 5 points ยท Posted at 01:17:01 on September 14, 2013 ยท (Permalink)
I think you made a mistake in your example; all it does is verify the behavior you mocked. Typically you would mock a dependency of the actual class you're testing.
neutronfish ยท 1 points ยท Posted at 06:39:07 on September 14, 2013 ยท (Permalink)
Well yes, this is an abbreviated example, I should've added a comment that we now verify the output, etc., etc., I know, I know.
The whole point was to show that you don't have to throw out imperative languages to test things or have to overwrite basic behavior to mock things out in a test case.
ericanderton ยท 6 points ยท Posted at 22:54:36 on September 13, 2013 ยท (Permalink)*
You have it inside-out. In this case the code doesn't have to be aware of testing. The test framework needs a way to get inside the application. The app has no clue that the injected dependencies are mocks or intercepted test widgets.
DI is usually used to inject service-like dependencies. This gets you into a space where you can test interactions of objects and complete subsystems. So if you want to mock logging, your ORM, or something similar, DI makes it easy to do that.
masterzora ยท 6 points ยท Posted at 00:31:35 on September 14, 2013 ยท (Permalink)
It's not, in anyway. It's made more flexible in a manner that gives way to easier testing. The toy example that was taught to me is a web store application. You could write it in a straightforward manner with your Visa processing package explicitly written as part of it, sure. Or, using a DI model, you can make it so that if down the line you also get a MasterCard and AmEx processing packages or replace the entire thing with a catch-all processor you just have to say "hey, transaction processing package, use this processor" and everything will continue to work smoothly because why the fuck should it actually care what credit card processor it's working with? It just so happens that this is also incredibly useful for testing since you can swap out the actual processors for your own mocks.
yogthos ยท 2 points ยท Posted at 02:17:06 on September 14, 2013 ยท (Permalink)
This technique is also known as passing parameters in languages with first class functions.
masterzora ยท 6 points ยท Posted at 05:19:41 on September 14, 2013 ยท (Permalink)
Not exactly. After all, if your snark was true, dependency injection would be unheard of in Python and that is simply not the case.
More to the point, though, dependency injection is (in a minor simplification) just passing parameters in object-oriented languages in much the same way that the factory pattern is called creating objects. It's just a name for the design pattern.
[deleted] ยท 5 points ยท Posted at 08:24:46 on September 14, 2013 ยท (Permalink)
How common is dependency injection in Python?
masterzora ยท 1 points ยท Posted at 17:12:03 on September 14, 2013 ยท (Permalink)
I'm not sure how to get a sense of what people and projects I'm not working with do in aggregate but I can say that I use DI in Python, was taught it by someone who uses Python, and have seen it in others' code, but that's not really a measure of how common it is. I will say that I find it highly unlikely that the full, heavy-weight, using a separate generic injector method is common but I would not be surprised to hear that the lighter-weight method of just passing dependencies to the constructor is in fairly common use.
[deleted] ยท 3 points ยท Posted at 19:47:56 on September 14, 2013 ยท (Permalink)
I actually do that all the time, but I was never taught to call it dependency injection. I suppose it is such a thing, it's just so easy in Python you don't know you're doing it. "Here, have a function! It's probably a class but what do you care?"
yogthos ยท 4 points ยท Posted at 12:35:35 on September 15, 2013 ยท (Permalink)
And this is precisely the point I'm making. In a language that supports first class functions you simply pass the function in as a parameter. It's simple and natural to do.
In a language like Java you have to design an interface make some classes and sacrifice a goat to do the same thing. So, there you have a DI pattern because the process is needlessly convoluted.
InvidFlower ยท 1 points ยท Posted at 18:46:14 on September 27, 2013 ยท (Permalink)*
Well it depends... For a language without duck typing, you do have to deal with type restrictions in some way. Depending on the language, code, and tools it can be more or less of a pain.
For instance most of these languages have mocking frameworks that generate proxy classes under the covers for you. If the class you're mocking lets you override members of the class then you don't even need to make an interface since the framework will just subclass it and override everything.
Something like C# is fairly flexible these days since you have lambda functions that are first-class and can pass anywhere you want. You also have anonymous objects and the dynamic keyword to disable to create objects with run-time checking and method-missing and all that. Obviously the use in enterprises and history from Java mean people tend to program in certain ways, but it isn't black and white.
Edit: Also mocking and injection frameworks can be helpful even on their own. It is really simple in Python make a simple object with similar named attributes for easy cases, but if you want more complex testing involving tracking if something was called, returning different values on subsequent calls, etc then a mocking framework starts to be helpful.
It is similar for injection itself. Constructor or property/attribute injection are the same in most languages. You pass in an object that satisfies the typing or duck typing. But a framework can still have interesting features, a lot of it to do on how things are centralized or decentralized. In an ActiveRecord-style ORM, usually if you need something to happen on save(), then you can either override save or you can have some sort of external registration (Django calls it Signals).
Similarly, to access an external class or method, you usually import it in some way to the module. Since things are dynamic, you can usually replace it in a test call so that the same attribute in the module under test now points to something else. That is fine for testing but can feel a bit hacky in non-testing situations. In the settings file for Django, you can replace the default implementations of certain classes. You just list the path to your class to handle basic authentication handling or whatever and it works. That's a case of Django having its own internal dependency injection that you can hook into.
yogthos ยท 1 points ยท Posted at 11:19:40 on September 14, 2013 ยท (Permalink)
The fact that you have a pattern for something that's natural to do in other languages is a sign of a problem in my opinion.
masterzora ยท 0 points ยท Posted at 16:41:52 on September 14, 2013 ยท (Permalink)
That's ridiculous. A number of design patterns are natural to do in a number of languages. And, regardless, and I'm sorry to interrupt the "Clojure is the one true language" train that you seem to be trying to drive here but different language paradigms make different tasks easier and harder and this fact doesn't inherently make any one paradigm better than the rest.
yogthos ยท 1 points ยท Posted at 23:01:04 on September 14, 2013 ยท (Permalink)
That's not the point I'm making. What I'm saying is that in a functional language you do this naturally all the time. In OO there's so much ceremony around this that it's a pattern.
That's a very nice straw man you got there. I simply used Clojure as an example, because I'm familiar with its syntax. This equally applies to a whole number of languages that aren't Clojure.
It's not about the paradigm, it's about whether the language is expressive enough so that you don't have friction when applying to the problems you're solving. My experience with most OO languages is that many common tasks are in fact a burden on the developer.
masterzora ยท -1 points ยท Posted at 22:45:21 on September 15, 2013 ยท (Permalink)
No, it's not the point you're making; it's the flaw in the point you're making. "Ceremony" has nothing to do with it; as I said elsewhere, Python has little "ceremony" to do DI but it's still a pattern. You keep tying design patterns to languages and the fact that that is wrong is what I'm trying to say; a design pattern is a general solution for a problem that is relatively common and easy to do wrong. The amount of "ceremony" involved is wholly irrelevant. Functional and functional-ish languages like Clojure have design patterns, too, and it's not for lack of expressiveness.
It's not a straw man I'm trying to knock down; it's actually what you sound like. Maybe you're not specifically on the Clojure train but you are riding so hard on the "you actually have a name for this in your language so it sucks" train that it at least looks like the tracks are parallel to the "functional is one true paradigm" train.
And I think many developers experienced in OO languages find that, in their experience, with most functional languages many common tasks are a burden. Funny how that works.
yogthos ยท 0 points ยท Posted at 03:38:54 on September 16, 2013 ยท (Permalink)
As another Python user mentioned in a reply to your comment, most people just think of it as passing arguments.
Many patterns exist to work around the deficiencies in the language. It's right there in the name. DI is an approximation of first class functions, factory patterns are there due to lack of currying, and so on.
Right a design pattern is a series of steps that you have to take. If there's no way to abstract them in the language you have to repeat them each time by hand.
It's very much relevant. If something takes a lot of steps and easy to get wrong then you need to memorize a pattern to do it. If it can be abstracted or done easily then the pattern is much simpler and you do it naturally.
Sure, you have patterns in all languages. However, many OO design patterns really are unnecessary in functional languages.
All I did was gave a concrete example of a problem being addressed by a language feature.
I think that if you need a pattern for passing arguments to your function then you're working with a shitty language. Notice that this has nothing to do with FP or OO as people using languages like Python don't generally think about DI patterns either.
The difference being that most people experienced in functional languages come from working with OO languages. I've certainly used OO for most of my career and so have most people, because that's the mainstream paradigm.
People who bothered to learn both paradigms and write any amount of significant code in them tend to agree that FP does provide many advantages.
You don't have to take my word for it though. Just look at any modern language and you'll see that they all have rich support of FP. Even poor old Java is scrambling to add lambdas after 20 years of stagnation.
KayRice ยท 5 points ยท Posted at 22:54:50 on September 13, 2013 ยท (Permalink)
So that you can use different implementations of dependent objects during testing.
Override what, global functions? Or monkey patch random objects? Even in your example of Closure code expand that concept further and you'll have an inter-mixed set of mock data / testing methods and real data methods, when they should be separate objects with separate concerns.
yogthos ยท 0 points ยท Posted at 23:19:57 on September 13, 2013 ยท (Permalink)
Which is precisely what I did above.
The override happens in a context of
with-redefsthis is completely different from globally monkey patching an object.It's precisely the same thing as using mock objects, each having a separate concern. The interface here being the function signature. Just because you need more ceremony to do it in your language doesn't make it actually different in any way.
KayRice ยท 2 points ยท Posted at 23:28:02 on September 13, 2013 ยท (Permalink)
Sorry I don't know Clojure well enough to really make a valid comparison
So you put it all in one file inter-mixed with the real code?
yogthos ยท 1 points ยท Posted at 23:29:56 on September 13, 2013 ยท (Permalink)
Why in the world would you do that?
jlink005 ยท 2 points ยท Posted at 22:54:16 on September 13, 2013 ยท (Permalink)
Where does it say that using a factory to implement dependency injection means that the code is test-aware? You're simply giving it a reference to something that will provide concrete implementations for the things it needs. Only the tests would be aware that a fake factory producing fake implementations is being provided.
yogthos ยท 0 points ยท Posted at 23:23:02 on September 13, 2013 ยท (Permalink)
Bad phrasing on my part. What I meant to say is that the code has to be written with testing in mind up front.
jlink005 ยท 2 points ยท Posted at 01:19:02 on September 14, 2013 ยท (Permalink)
I might have to try Clojure now.
Dear god, I haven't seen so many parentheses since XQuery!
yogthos ยท 2 points ยท Posted at 01:44:05 on September 14, 2013 ยท (Permalink)
no more than most languages, they just happen to be in front of the function name as opposed to after. :)
ford_contour ยท 5 points ยท Posted at 04:44:23 on September 14, 2013 ยท (Permalink)
Some people call it productivity.
leoel ยท 1 points ยท Posted at 12:12:09 on September 14, 2013 ยท (Permalink)
Your analogy of this problem is the greatest I have seen yet, it makes so much sense ! Maybe will I finally be able to explain to management why changing specs to get a + b = c +1 becomes suddenly way harder when the code is built as to manage a generic a * n + b * m = c * k.
ericanderton ยท 2 points ยท Posted at 12:20:28 on September 14, 2013 ยท (Permalink)
You're welcome.
If you really want to hit them over the head with it, there's a "full" version of E=mc2 which may serve as a less abstract example:
Eยฒ=(mcยฒ)ยฒ+(pc)ยฒ
jldugger ยท 16 points ยท Posted at 16:05:08 on September 13, 2013 ยท (Permalink)
It's git, you can examine the first commit if you so desire.
son-of-chadwardenn ยท 10 points ยท Posted at 17:52:08 on September 13, 2013 ยท (Permalink)
Bit of a git novice. Can I browse commits from the site or do I need a git client on my pc?
Y_Less ยท 16 points ยท Posted at 17:57:55 on September 13, 2013 ยท (Permalink)
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition/commit/8d101c438236013c39a47a07262f5e59084da704
Scroll right down to the bottom, to the 15 line "FizzBuzz.java" file that then did all the work.
burkadurka ยท 17 points ยท Posted at 00:39:41 on September 14, 2013 ยท (Permalink)
Second commit: commits all the class files. Enterprise quality confirmed.
son-of-chadwardenn ยท 0 points ยท Posted at 18:08:24 on September 13, 2013 ยท (Permalink)
Cool. Now I see where I should have clicked after 2 people reply with a direct link. Typical.
SwahiliToad ยท 3 points ยท Posted at 17:56:48 on September 13, 2013 ยท (Permalink)
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition/commits/master
nulpunkt ยท 57 points ยท Posted at 14:27:18 on September 13, 2013 ยท (Permalink)
I'm completely in love with this commit: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition/commit/7a796ee50f000ca010a3656109e61111bcb5accd
"Comparison for equality was heavily duplicated."
garobat ยท 61 points ยท Posted at 16:11:41 on September 13, 2013 ยท (Permalink)
This part there, in this same commit, almost made me punch my screen:
[deleted] ยท 37 points ยท Posted at 21:50:35 on September 13, 2013 ยท (Permalink)
[deleted]
ggggbabybabybaby ยท 45 points ยท Posted at 22:25:03 on September 13, 2013 ยท (Permalink)
We're adding a third value to bool.
[deleted] ยท 40 points ยท Posted at 22:51:22 on September 13, 2013 ยท (Permalink)
StrictTrue
n1c0_ds ยท 47 points ยท Posted at 23:51:07 on September 13, 2013 ยท (Permalink)
Falser
toaster13 ยท 1 points ยท Posted at 05:15:34 on September 14, 2013 ยท (Permalink)
You mean 'blue'?
garobat ยท 33 points ยท Posted at 22:46:20 on September 13, 2013 ยท (Permalink)
Sadly some coders do shit like this.
Tasgall ยท 17 points ยท Posted at 01:41:55 on September 14, 2013 ยท (Permalink)
This is amazing.
My favorite part is the fact that
Trueis 0, andFalseis 1. I don't even.withabeard ยท 9 points ยท Posted at 07:57:06 on September 14, 2013 ยท (Permalink)
I can see where the idiom comes from.
For example at a POSIX like shell, 0 is "command executed successfully" and anything else is an error condition. The error is denoted by the return number.
simsea ยท 5 points ยท Posted at 23:08:34 on September 13, 2013 ยท (Permalink)
That there nearly made me punch the screen.
narwhalslut ยท 3 points ยท Posted at 00:09:44 on September 14, 2013 ยท (Permalink)
I just lol'd because my only reaction was "Fuck! Why!?"
flying-sheep ยท 0 points ยท Posted at 01:02:40 on September 14, 2013 ยท (Permalink)
i had to re-read this even if itโs just 5 lines.
iโฆ wat.
iissqrtneg1 ยท 6 points ยท Posted at 23:35:46 on September 13, 2013 ยท (Permalink)
Codebase I, unfortunately, have to work with has nullable booleans in the model, while the view has two nullable booleans named ModelsBooleanIsFalse, ModelsBooleanIsTrue.
Then the observer pattern flips them back and forth. That's 27 possible states for what should be 3: true, false, or not answered. There are hundreds if not thousands of these.
Now that's enterprise!
quay42 ยท 4 points ยท Posted at 07:15:14 on September 14, 2013 ยท (Permalink)
FileNotFound
SilasX ยท 25 points ยท Posted at 17:45:20 on September 13, 2013 ยท (Permalink)
I confess, I used to find that way a lot easier to read. It was only after programming a while that I started preferring the idiom
return boolean_expression.Terr_ ยท 20 points ยท Posted at 17:59:10 on September 13, 2013 ยท (Permalink)*
I think it also depends on the developer's expectation for how the code will develop. The
if/elsestyle implies that it is a legitimate place to have additional tests or side-effects... and it just-so-happens that there aren't any at the moment or for this particular interchangeable piece.P.S.:
One more side-thought: It can be a marginally more convenient for line-by-line debugging, especially when the if-statement is a little convoluted or involves function calls. You don't have to fiddle as much to stop at the right step, you just drop a breakpoint into the return-a-boolean line.
drb226 ยท 34 points ยท Posted at 18:07:28 on September 13, 2013 ยท (Permalink)
This is a fairly accurate way of describing the whole "enterprise software" style that this repository is parodying.
Terr_ ยท 18 points ยท Posted at 18:47:39 on September 13, 2013 ยท (Permalink)*
*shrug* Well... so what? I mean when you get right down to it, it's not about bad techniques or about bad intentions, but about good-techniques and good-intentions taken to bad-extremes.
Consider the flip-side: You get the "terse" C program that that looks like line-noise, relies on undefined compiler behavior, and requires a 98% rewrite to add even the smallest amount of new behavior. That doesn't mean
return(a==b)is bad, it's just an example of a different direction.[deleted] ยท 1 points ยท Posted at 23:31:38 on September 13, 2013 ยท (Permalink)
[deleted]
Terr_ ยท 1 points ยท Posted at 00:03:09 on September 14, 2013 ยท (Permalink)
I agree in general, for larger structures... but for this particular if/else example I'd say it's a waste of time to go:
/* Someday we might do stuff here */The kind of new dev who'll make a big stink about it is also the kind of person who'll insist that the comment-writer was wrong.
nemec ยท 3 points ยท Posted at 22:55:03 on September 13, 2013 ยท (Permalink)
If it is, make a comment in the source stating that.
Terr_ ยท 2 points ยท Posted at 23:52:23 on September 13, 2013 ยท (Permalink)*
I honestly don't think you need to "Explain Why" for the example we're talking about. Especially since the runtime behavior is identical, and the structure is independent and isolated.
nemec ยท 2 points ยท Posted at 00:50:21 on September 14, 2013 ยท (Permalink)
The problem is, that's not what it implies for me. If I saw the above code, I'd assume you forgot you can just return the boolean.
As for your postscript, the environment I use (Visual Studio) lets you execute arbitrary code when you're stopped at a breakpoint, so I don't even need to step through.
Terr_ ยท 1 points ยท Posted at 00:54:18 on September 14, 2013 ยท (Permalink)
I assume you still have to do stepping with
( (123 == bar()) || (456 == foo()))unless absolutely everything is idempotent.Sure, you could manually run
bar()while the debug thread is paused, but that can also screw up the remainder of the run.nemec ยท 1 points ยท Posted at 01:05:04 on September 14, 2013 ยท (Permalink)
I believe you can do
and put breakpoints on each individual line, too.
Terr_ ยท 1 points ยท Posted at 02:04:51 on September 14, 2013 ยท (Permalink)
It probably works less-reliably with
foo(bar(baz())):psegfaultzen ยท 1 points ยท Posted at 13:51:08 on September 15, 2013 ยท (Permalink)
There's actually a refactoring for this specific case. Assign the result of the boolean to a descriptively named variable and use that instead of the literal logic statement. Aids in debugging, as well as reading and understanding the code in the first place.
Terr_ ยท 1 points ยท Posted at 19:36:14 on September 15, 2013 ยท (Permalink)
Yeah, but the whole point of the one-line-return version is brevity.
segfaultzen ยท 1 points ยท Posted at 23:54:42 on September 15, 2013 ยท (Permalink)
If the boolean expression is simple, then you will get brevity and that may be fine. If it's more complex logic, then you may want to stash it in a descriptively named variable to be returned, and also watched or stepped over in a debugger.
As with anything that can be complex, "it depends."
parlezmoose ยท 5 points ยท Posted at 21:19:21 on September 13, 2013 ยท (Permalink)
ಠ_ಠ
narwhalslut ยท 1 points ยท Posted at 00:08:51 on September 14, 2013 ยท (Permalink)
I think it was more than that. Did you look at the conditional itself? lol
nulpunkt ยท 1 points ยท Posted at 12:42:02 on September 15, 2013 ยท (Permalink)
That is truly work of art!
sbrick89 ยท -2 points ยท Posted at 20:33:11 on September 13, 2013 ยท (Permalink)
switches are better than if/else, as they can include a default condition for unhandled responses!
</sarcasm>
Xdes ยท -11 points ยท Posted at 16:44:19 on September 13, 2013 ยท (Permalink)
should be:
augsod ยท 47 points ยท Posted at 19:24:41 on September 13, 2013 ยท (Permalink)
A little disappointed to see no dependency injection framework.
berlinbrown ยท 10 points ยท Posted at 00:06:05 on September 14, 2013 ยท (Permalink)
Spring wrapped on jersery, wrapped on axis soap layer,
MbahSurip ยท 81 points ยท Posted at 14:25:08 on September 13, 2013 ยท (Permalink)
where is the 500-page documentation?
Eirenarch ยท 150 points ยท Posted at 14:47:09 on September 13, 2013 ยท (Permalink)
There was a chance documentation for this project might have been useful so they didn't write it.
ericanderton ยท 44 points ยท Posted at 19:01:28 on September 13, 2013 ยท (Permalink)
ccfreak2k ยท 8 points ยท Posted at 03:24:48 on September 14, 2013 ยท (Permalink)
That's just cynical enough to make me think it came from a Dilbert comic strip.
ericanderton ยท 60 points ยท Posted at 15:58:13 on September 13, 2013 ยท (Permalink)
No kidding. There's not enough javadoc comments anywhere in this codebase. Also: no architecture diagrams, no UML, and no user stories. This would fail a code-review in a heartbeat.
cronus89 ยท 38 points ยท Posted at 16:04:39 on September 13, 2013 ยท (Permalink)
Time for a pull request
Asimoff ยท 15 points ยท Posted at 22:21:18 on September 13, 2013 ยท (Permalink)
User... fucking... stories.
idiogeckmatic ยท 23 points ยท Posted at 01:22:19 on September 14, 2013 ยท (Permalink)
As a user I would like to have a solution that tells me when I should fizz and when I should buzz.
apotheon ยท 6 points ยท Posted at 06:01:47 on September 14, 2013 ยท (Permalink)
Back! Back to the untold horrors of the blasphemous depths whence ye came, foul entity of unimaginable, alien blight from beyond the trackless dark twixt the stars!
idiogeckmatic ยท 8 points ยท Posted at 06:05:39 on September 14, 2013 ยท (Permalink)
Save that for the retrospective, please.
apotheon ยท 1 points ยท Posted at 17:47:25 on September 14, 2013 ยท (Permalink)
I can't do that -- I'm "That Guy" from the weekly project meetings.
idiogeckmatic ยท 1 points ยท Posted at 01:08:56 on September 15, 2013 ยท (Permalink)
Yeeeeaaaahh, I'm gonna need you to come in on Saturday.
josefx ยท 40 points ยท Posted at 14:50:07 on September 13, 2013 ยท (Permalink)
Just run javadoc or doxygen on the source.
[deleted] ยท 34 points ยท Posted at 21:45:56 on September 13, 2013 ยท (Permalink)
[deleted]
ford_contour ยท 7 points ยท Posted at 04:43:18 on September 14, 2013 ยท (Permalink)
FTFY. :)
Fabien4 ยท 3 points ยท Posted at 08:38:10 on September 14, 2013 ยท (Permalink)
And if someone asks for a file instead of paper, all you have to do is scan the pages you just printed. (And yes, I've seen it done -- not for software documentation though.)
kaleNhearty ยท 22 points ยท Posted at 00:03:55 on September 14, 2013 ยท (Permalink)
It's enterprise code. There's no documentation or comments.
idiogeckmatic ยท 20 points ยท Posted at 01:23:25 on September 14, 2013 ยท (Permalink)
Shh, don't tell the CS students, let it surprise them when they start their first job for MomCorp
FRegistrations ยท 1 points ยท Posted at 13:36:44 on September 14, 2013 ยท (Permalink)
This x 1000
We have PM's who can't code and promise the moon in a half a day. No time for documentation. Everything must be learned through tribal knowledge!
zefcfd ยท 9 points ยท Posted at 03:39:42 on September 14, 2013 ยท (Permalink)
up your butt and around the corner.
Bobbias ยท 5 points ยท Posted at 03:51:31 on September 14, 2013 ยท (Permalink)
Normally, I'd downvote, but I haven't heard anyone say that in years.
zefcfd ยท 3 points ยท Posted at 06:04:27 on September 14, 2013 ยท (Permalink)
sadly i laughed at my own comment like a school girl. I feel i achieved ultimate immaturity.
scarecrow1 ยท 27 points ยท Posted at 18:33:43 on September 13, 2013 ยท (Permalink)
Still a fair bit to go from being really enterprisey:
Follow all of that up and you'll be a really enterprisey developer.
grauenwolf ยท 14 points ยท Posted at 19:39:12 on September 13, 2013 ยท (Permalink)
Don't forget to use a dependency injection framework to load Spring.
nicko68 ยท 2 points ยท Posted at 22:06:39 on September 13, 2013 ยท (Permalink)
Milestone 1: Fizz implementation Milestone 2: Buzz implementation Milestone 3: FizzBuzz implementation Project complete.
_njd_ ยท 25 points ยท Posted at 15:20:26 on September 13, 2013 ยท (Permalink)
Oh gods, it really is like that. It thought it was just me who thought it was all a pile of crud.
It makes COBOL look efficient.
SnottleBumTheMighty ยท 21 points ยท Posted at 19:48:20 on September 13, 2013 ยท (Permalink)
Truly it has been said that Java is the COBOL of the two thousands.
_njd_ ยท 5 points ยท Posted at 19:53:01 on September 13, 2013 ยท (Permalink)
Greetings from the data division.
ericanderton ยท 44 points ยท Posted at 16:04:39 on September 13, 2013 ยท (Permalink)
Bah, the JIT totally streamlines this into something that gives near-C like performance. /s
LOOKITSADAM ยท 7 points ยท Posted at 17:33:53 on September 13, 2013 ยท (Permalink)
Only it's really not.
Honestly who could write code like that and not get fired?
segfaultzen ยท 25 points ยท Posted at 18:00:49 on September 13, 2013 ยท (Permalink)
You have never worked with source code for the U.S. federal government or Department of Defense.
Kalium ยท 14 points ยท Posted at 20:02:01 on September 13, 2013 ยท (Permalink)
Let's not forget the 80% of the private sector that can't afford top talent.
[deleted] ยท 17 points ยท Posted at 20:38:02 on September 13, 2013 ยท (Permalink)
90% * FTFY
And really its more like 95-99% of enterprise code is sub par. Even if you have AMAZING programmers if you have shitty management who enforce stupid structures like this (because they barely know how to code). You'll still get shitty code.
Kalium ยท 5 points ยท Posted at 21:04:19 on September 13, 2013 ยท (Permalink)
...I was feeling generous...
LOOKITSADAM ยท 4 points ยท Posted at 18:03:54 on September 13, 2013 ยท (Permalink)
Ah, well I forgot about government work, I haven't and if the dmv is anything to extrapolate from...
segfaultzen ยท 1 points ยท Posted at 18:08:26 on September 13, 2013 ยท (Permalink)
The quality of code is depressing.
berlinbrown ยท 1 points ยท Posted at 00:07:04 on September 14, 2013 ยท (Permalink)
COBOL is really niche, mostly for mainframe applications, accessing the database layer. And that is all.
At least Java tries to be general purpose.
EmperorOfCanada ยท 25 points ยท Posted at 21:02:11 on September 13, 2013 ยท (Permalink)
Years ago (late 90s early 2000) I programmed lots of Java but I saw this sort of architecture as the trend and now this is why I hate Java so very much. Java itself can be great but these OCD people have turned it into a monster. It is like having an 8 lane high quality highway with a speed limit of 30mph and reserving the leftmost lanes for bread trucks only.
I suspect that Scala was an attempt to keep that which was good in Java and turf the crap like this.
livrem ยท 4 points ยท Posted at 07:08:57 on September 14, 2013 ยท (Permalink)
I have worked with Java most of my career since the late 90's, and still do so (well, maybe 50 % of a typical work week is JavaScript now, but still). Only Java code I have truly enjoyed writing in many years was making a game for Java4k. I would never choose to use Java unless paid well to do so. All my other hobby-projects are written in Python, Clojure, sometimes JavaScript or C. Can't imagine a reason to use Java for anything when given a choice.
EmperorOfCanada ยท 2 points ยท Posted at 20:41:51 on September 15, 2013 ยท (Permalink)
I fully agree with you but what language would you use for a 10 year project with a rotating staff of 300 average programmers in 6 offices where the only control you had was language choice?
SilasX ยท 39 points ยท Posted at 14:39:36 on September 13, 2013 ยท (Permalink)
I love the directory structure. Especially with java appearing twice.
[deleted] ยท 24 points ยท Posted at 16:06:45 on September 13, 2013 ยท (Permalink)
The main class is better imo
[deleted] ยท 6 points ยท Posted at 01:20:31 on September 14, 2013 ยท (Permalink)
Java only appears once in the package declarations, I disagree this is "java" appearing twice with this explanation:
src/main -> This is where you place folders for each language you use
src/main/java -> This is where Java source files go
src/main/brainfuck -> This is where Brianfuck files go
src/test/java -> This is where Java source files for tests go
src/test/erlang -> This is where Erlang source files for tests go
It's a structure popularized by Maven, but really has quite good use across multi-language projects. And nothing, whatsoever, to do with duplicating a name since you could become more enterprisey by having a src/main/scala folder with package com.seriouscompany.business.scala.fizzbuzz.packagenamingpackage.interfaces.stringreturners
but your Java code could use the Scala version and vice-versa. The src/main/<language> is to specify what compiler your build tool should select.
wowowowowa ยท 11 points ยท Posted at 03:12:51 on September 14, 2013 ยท (Permalink)
Lucky Brian.
[deleted] ยท 1 points ยท Posted at 05:05:53 on September 14, 2013 ยท (Permalink)
We knew him well.
SilasX ยท 3 points ยท Posted at 01:56:52 on September 14, 2013 ยท (Permalink)
I was referring to the nesting within the same language folder: / src / main / java / com / seriouscompany / business / java
[deleted] ยท 1 points ยท Posted at 05:06:51 on September 14, 2013 ยท (Permalink)
If you write JVM code in Clojure, and for some reason want to invoke a Java written version... how else would you identify it?
I'm not saying it's good, but it is at least not redundant because the JVM package doesn't know which language it came from.
livrem ยท 2 points ยท Posted at 11:03:22 on September 14, 2013 ยท (Permalink)
Why do you need to know? It is pretty clear in Clojure code if something you call is Java or not (and if not I can't think of a reason it would be a big problem).
[deleted] ยท 1 points ยท Posted at 16:53:05 on September 14, 2013 ยท (Permalink)
If you have a DI layer, you code to the interface. Something configures the actual object that is injected for that interface, and that something needs to know specifically what class name to create. If you have a native version and a pure JVM version you need some smart way of separating these two implementations, even if you Clojure code only ever uses the interface.
SilasX ยท 1 points ยท Posted at 16:06:04 on September 14, 2013 ยท (Permalink)
By the file extension?
[deleted] ยท 0 points ยท Posted at 16:50:17 on September 14, 2013 ยท (Permalink)
So you're going to load a .class file and hope it retains debug information that include the original source filename? When you're running byte code you don't get the original file extension. Somehow you need to designate the package name is specific to a specific implementation. This isn't a problem, say, with Clojure, Java, Scala, Groovy, but is more of a problem when you start using native extensions because not all native extensions are compiled for all platforms the JVM runs on.
[deleted] ยท 0 points ยท Posted at 05:11:05 on September 14, 2013 ยท (Permalink)
I feel like I need a second reply to you. The first java is telling the build tool what compiler should be used for files in that directory. The second Java is identifying code in that package independent of what compiler is being invoked to compile that code. So you can have a package com.reddit.java that only contains Scala code, but if it resides in src/main/scala then everything is OK because the Scala compiler will be used instead of another compiler.
SilasX ยท 1 points ยท Posted at 16:05:20 on September 14, 2013 ยท (Permalink)
You've never heard of file extensions? .java vs .scala?
[deleted] ยท 1 points ยท Posted at 16:52:02 on September 14, 2013 ยท (Permalink)
See my other reply, you don't seem able to separate build tools versus runtime information.
The common practice is to put .java files in the src/main/java folder, and .scala files in the src/main/scala folder so that each compiler can be invoked.
4lteredState ยท 18 points ยท Posted at 15:31:22 on September 13, 2013 ยท (Permalink)
I loled just trying to get to the end of the src/ tree
jeff303 ยท 6 points ยท Posted at 01:10:58 on September 14, 2013 ยท (Permalink)
Not recommended on mobile
BrunchGoat ยท 15 points ยท Posted at 18:17:01 on September 13, 2013 ยท (Permalink)
It would make my day if this doesn't work.
ActionKermit ยท 14 points ยท Posted at 01:05:12 on September 14, 2013 ยท (Permalink)
Ah, my favorite GitHub project! I strongly recommend reading the issues list if you haven't already.
YourTechGuy ยท 11 points ยท Posted at 21:24:49 on September 13, 2013 ยท (Permalink)
Let's do an enterprise-worthy Hello World next.
ahminus ยท 28 points ยท Posted at 14:23:34 on September 13, 2013 ยท (Permalink)
Awesome. And precisely why I left the disasterland that is enterprise software. ;)
yogthos ยท 15 points ยท Posted at 22:45:21 on September 13, 2013 ยท (Permalink)
Enterprise software: solving problems that we wish we had!
oldneckbeard ยท 57 points ยท Posted at 18:28:30 on September 13, 2013 ยท (Permalink)
yeah, it sucks making a ton of money.
[deleted] ยท 20 points ยท Posted at 20:26:22 on September 13, 2013 ยท (Permalink)
I know, I have to have weekly bonfires of my $2 bills to keep my sanity.
worldsayshi ยท 4 points ยท Posted at 00:11:01 on September 14, 2013 ยท (Permalink)
Well, is there a clear cut alternative?
[deleted] ยท 9 points ยท Posted at 20:03:36 on September 13, 2013 ยท (Permalink)
That's not enterprise quality. It needs the Spring Framework. THEN it would be enterprise quality.
__michaelg ยท 8 points ยท Posted at 20:14:12 on September 13, 2013 ยท (Permalink)
There is also https://github.com/Herzult/SimplePHPEasyPlus
gfody ยท 10 points ยท Posted at 23:30:44 on September 13, 2013 ยท (Permalink)
no IoC framework, no application server/container, no ESB, this is hilarious but sadly falls short of capturing the true horror of enterprise software complexity
Rhomboid ยท 26 points ยท Posted at 15:30:11 on September 13, 2013 ยท (Permalink)
If there's one thing enterprise Java people love, it's hierarchy. (Ctrl-F for ye olde
AbstractSingletonProxyFactoryBeannestled in there somewhere.)sh0rug0ru ยท 28 points ยท Posted at 18:51:34 on September 13, 2013 ยท (Permalink)*
To be fair, that is deep in the guts of the implementation of a generic dependency injection framework that is providing in runtime metaclass-like behavior in a language that really doesn't do metaprogramming. There's going to be some black magic in there. That hefty name should give you an idea of how much magic we're talking about here. And this isn't even really all that scary. Check out the implementation of AspectJ sometime, which does runtime bytecode hacking.
Java people hate hierarchy. After all, single inheritance only lets you go so far before the whole thing comes tumbling down on you like a ton of bricks. But Java people do love frameworks.
crimson_chin ยท 3 points ยท Posted at 23:51:02 on September 13, 2013 ยท (Permalink)
When I get into super absurd reflection stuff (I have a library that cglib captures method calls against getters/setters to spin up sets of related objects and prevent null objects from being returned from them) my class names get really short.
It's like, what this does is too silly to give it an actual name. So this class will be named Ghost. And this one over here is the UnEraser (it, as its name implies, provides a method for undoing the effects of type erasure in arbitrarily nested/inherited generics).
nicko68 ยท -3 points ยท Posted at 22:04:51 on September 13, 2013 ยท (Permalink)
I hate frameworks. Especially when they change and the one you used to know doesn't matter any more.
Programming used to be fun.
MachinTrucChose ยท 8 points ยท Posted at 22:41:10 on September 13, 2013 ยท (Permalink)
So the alternative is what? Doing everything from scratch yourself? You can still do that if you want, no one's forcing you to use other people's code.
Learning a framework is a better time investment than writing everything yourself. For the sake of your own sanity at the very least. This is assuming you have an actual need for a framework (ie it's not a trivial application).
nicko68 ยท 2 points ยท Posted at 22:01:58 on September 14, 2013 ยท (Permalink)
The problems I have with frameworks is they go in and out of style. We need Struts! No we need Spring! Also it seems to be more XML configuration than coding now. That's not fun.
InvidFlower ยท 1 points ยท Posted at 19:58:13 on September 27, 2013 ยท (Permalink)
At least in the .NET world, many people have moved from XML configuration to config via lambdas and such (since C# lambdas can be passed directly as expression trees, you can specify the name of a property with full type-safety and autocomplete but still not actually call the property).
thelehmanlip ยท 5 points ยท Posted at 18:28:55 on September 13, 2013 ยท (Permalink)
Oh god that page is a nightmare
flying-sheep ยท 3 points ยท Posted at 01:06:51 on September 14, 2013 ยท (Permalink)
i prefer TransactionAwarePersistenceManagerFactoryProxy
maybe theyโll even add an abstract version or a bean of it!
wowowowowa ยท 5 points ยท Posted at 03:14:19 on September 14, 2013 ยท (Permalink)
Sad to say, the name tells you what it is. Of course, you need to know a bit about Spring to know why it's doing it like that.
sDFBeHYTGFKq0tRBCOG7 ยท 1 points ยท Posted at 08:24:56 on September 14, 2013 ยท (Permalink)
Man... this is the first time I physically felt a little queasy from disgust with code related things. Usually it's just worth a chuckle, but that is some truly shameful shit right there.
sgoody ยท 9 points ยท Posted at 19:11:10 on September 13, 2013 ยท (Permalink)
Great project. Would be funniest if it were kept within the realms of a believable project. E.g. Looking through the issues, there's a suggestion of "going web scale" and another for "adding web sphere support". But adding a business case, costings, UML diagrams, object instance caching and not having hard-coded string but strings in resource files instead aren't completely unimaginable for an Enterprise Class piece of software.
adrianmalacoda ยท 7 points ยท Posted at 04:19:36 on September 14, 2013 ยท (Permalink)
I noticed that the strings Fizz and Buzz are hard coded into the application. Shouldn't these instead be stored as rows inside an Oracle database and fetched using data transaction beans instead?
mdinstuhl ยท 1 points ยท Posted at 16:45:55 on September 16, 2013 ยท (Permalink)
WON'T SOMEONE THINK OF i18n??!?
leogodin217 ยท 8 points ยท Posted at 10:13:21 on September 14, 2013 ยท (Permalink)
I once spoke to an "enterprise" developer about a slow web app. His response? "It's not supposed to be fast, it's enterprise." years later, I did an Ignite presentation and used that discussion to beg developers to consider their customers. the guy was in the room. Oops.
PolyPill ยท 12 points ยท Posted at 18:39:44 on September 13, 2013 ยท (Permalink)
I joked once about doing this and in java and calling it FizzBuzz Enterprise Edition, I love that some sick and twisted person actually did this!
ActionKermit ยท 12 points ยท Posted at 01:12:54 on September 14, 2013 ยท (Permalink)
It's a project with 12 contributors and 69 commits to date, so I'm happy to say that FizzBuzzEnterpriseEdition is a thriving community project with great prospects for future development.
ford_contour ยท 2 points ยท Posted at 04:51:00 on September 14, 2013 ยท (Permalink)
It strikes me that it might be time to arbitrarily reimplement parts of it in Perl (maintaining both versions in perpetuity, of course) and then throw in a bit of dependency injection so that arbitrary modules can be used in either environment...
beltorak ยท 7 points ยท Posted at 02:12:43 on September 14, 2013 ยท (Permalink)
not bad, but it needs to inject some inversion of dependency control. I see a lot of directly instantiating classes. That's not proper separation of concerns.
[deleted] ยท 22 points ยท Posted at 17:15:43 on September 13, 2013 ยท (Permalink)*
[deleted]
deadowl ยท 19 points ยท Posted at 19:54:00 on September 13, 2013 ยท (Permalink)
Okay, Mr. _ C# pi. Did I get your middle name right?
wowowowowa ยท 9 points ยท Posted at 03:15:54 on September 14, 2013 ยท (Permalink)
Using IInterface names in Java is usually frowned upon. Java is usually SomeType implemented as SomeTypeImpl, whereas C# is ISomeType implemented as SomeType.
Not sure which is worse.
mavr1k ยท 6 points ยท Posted at 21:35:13 on September 13, 2013 ยท (Permalink)
Did anyone else click the linking hoping it was a Star Trek themed version of Fizzbuzz?
.... I did =(
[deleted] ยท 4 points ยท Posted at 20:53:06 on September 13, 2013 ยท (Permalink)
Well, thatโs certainly a good start.
worldsayshi ยท 2 points ยท Posted at 23:52:56 on September 13, 2013 ยท (Permalink)*
I can't find any spring xml in your project? How do I configure it? +Also, you should probably split some of that code into a submodule. ++Also, where is the code for the REST interface?
sirin3 ยท 13 points ยท Posted at 17:35:32 on September 13, 2013 ยท (Permalink)
Repost!
Or is that the point? In enterprises you do the same stuff again and again and claim it is an innovation? Like calling the mainframes cloud?
seruus ยท 9 points ยท Posted at 21:18:22 on September 13, 2013 ยท (Permalink)
It's the fourth Enterprise FizzBuzz posted on Proggit, but apparently the last one was four years ago. I do remember seeing this one, but I can't find it.
Oh well, not that it matters. What's more enterprisey than replication?
grimeMuted ยท 4 points ยท Posted at 21:36:31 on September 13, 2013 ยท (Permalink)
It's possible you saw it on /r/shittyprogramming, /r/programminghorror, or /r/programminghumor. I know I've seen it posted in those a few times.
sirin3 ยท 2 points ยท Posted at 22:14:08 on September 13, 2013 ยท (Permalink)
The reddit search sucks
http://www.reddit.com/r/programming/comments/1lmsk5/top_github_languages_for_2013_so_far/cc0ue82
http://www.reddit.com/r/programming/comments/1jq71f/goldman_sachs_sent_a_computer_scientist_to_jail/cbha3cu
http://www.reddit.com/r/programming/comments/1abd6u/live_programming_language_popularity_github_vs/c8w4siy
RecursiveSolipsism ยท 10 points ยท Posted at 19:40:23 on September 13, 2013 ยท (Permalink)
pom.xml sure looks a lot like porn.xml. I was a little scared to click on that file.
bulbasaurado ยท 2 points ยท Posted at 12:49:22 on September 14, 2013 ยท (Permalink)
Fuck Yeah Keming!
foxh8er ยท 1 points ยท Posted at 23:50:18 on September 13, 2013 ยท (Permalink)
That's always how I see it. Now I search for pom whenever I can.
[deleted] ยท 3 points ยท Posted at 23:40:44 on September 13, 2013 ยท (Permalink)
What, not cloud-based?
lexpattison ยท 3 points ยท Posted at 23:44:26 on September 13, 2013 ยท (Permalink)
My buddy forked it and created FizzBuzz Enterprise SOA Edition... you should see the useless abstraction - it's staggering.
ford_contour ยท 1 points ยท Posted at 04:52:49 on September 14, 2013 ยท (Permalink)
Link?
lexpattison ยท 2 points ยท Posted at 14:40:53 on September 16, 2013 ยท (Permalink)
https://github.com/TeamWTF/FizzBuzzSOA
sumdudeinhisundrware ยท 3 points ยท Posted at 02:36:16 on September 14, 2013 ยท (Permalink)
Yeah that's about right. It could use a few more abstract factory factories to create abstract factories to instantiate an integer.
IT Programming FTW!
drewying ยท 12 points ยท Posted at 14:23:59 on September 13, 2013 ยท (Permalink)
This is joke.
Right?
...right?
ericanderton ยท 40 points ยท Posted at 16:00:08 on September 13, 2013 ยท (Permalink)*
Yes and no. It's really more of a parody of taking the absurdly simple and lofting it into the absurdly complex. Only there really are programs that do some of this - Java
programsenterprise architectures seem to take the cake in this department.The result is often anemic documentation supporting a fiendishly complex network of objects, that has you spelunking into megabytes of javadoc pages... all to write a webpage.
This thing takes it to the next level by completely obfuscating what is supposed to be a tiny code snippet that is comprised of a loop, a few modulus operations, and some print statements. But hey, if you ever wanted to implement "FizzBuzzBang", this is the architecture to use.
[deleted] ยท 6 points ยท Posted at 21:00:22 on September 13, 2013 ยท (Permalink)
And this is why Comedy, is really all about tragedy.
goldman60 ยท 3 points ยท Posted at 05:02:58 on September 14, 2013 ยท (Permalink)
Good day from the land of Atlassian Confluence plugin writing.
spetznatz ยท 2 points ยท Posted at 12:38:16 on September 14, 2013 ยท (Permalink)
Oh I've been to that land. And I never want to return.
[deleted] ยท 2 points ยท Posted at 00:28:06 on September 14, 2013 ยท (Permalink)
Of course it is. The dude who made it posted it to /g/ hours after he considered it ready and got plenty of laughs.
Fabien4 ยท 2 points ยท Posted at 08:36:09 on September 14, 2013 ยท (Permalink)
The correct word is "parody".
[deleted] ยท 2 points ยท Posted at 15:29:44 on September 13, 2013 ยท (Permalink)
Well, frankly, this is what students are taught as being good style -- even if taken to absurdity.
RommelTJ ยท 18 points ยท Posted at 15:38:16 on September 13, 2013 ยท (Permalink)
Can't speak for other schools, but my professors taught that even though design patterns are important, overusing them is also bad. They taught me that the vast majority of time in the software development cycle will be spent on maintenance, so designing a simple and maintainable system at the expense of performance is more important.
vplatt ยท 12 points ยท Posted at 20:30:55 on September 13, 2013 ยท (Permalink)
I agree, except that designing a simple and maintainable system normally produces a faster system anyway, and you won't normally lose any performance. However, you might lose flexibility. Example: "Oh, you didn't put all your business logic behind Spring interfaces?! OMG! What if you want to swap one out someday?" The real question is: will you ever really swap them for new logic someday? Really?
Every bit of flexibility in a system is another feature waiting to break someday and need maintenance. Always ask yourself if you really need that flexibility before you trade in your future free time for it.
[deleted] ยท 11 points ยท Posted at 22:17:55 on September 13, 2013 ยท (Permalink)*
I have left reddit for Voat due to years of admin mismanagement and preferential treatment for certain subreddits and users holding certain political and ideological views.
The situation has gotten especially worse since the appointment of Ellen Pao as CEO, culminating in the seemingly unjustified firings of several valuable employees and bans on hundreds of vibrant communities on completely trumped-up charges.
The resignation of Ellen Pao and the appointment of Steve Huffman as CEO, despite initial hopes, has continued the same trend.
As an act of protest, I have chosen to redact all the comments I've ever made on reddit, overwriting them with this message.
If you would like to do the same, install TamperMonkey for Chrome, GreaseMonkey for Firefox, NinjaKit for Safari, Violent Monkey for Opera, or AdGuard for Internet Explorer (in Advanced Mode), then add this GreaseMonkey script.
Finally, click on your username at the top right corner of reddit, click on comments, and click on the new OVERWRITE button at the top of the page. You may need to scroll down to multiple comment pages if you have commented a lot.
After doing all of the above, you are welcome to join me on Voat!
ragwell ยท 2 points ยท Posted at 00:59:03 on September 14, 2013 ยท (Permalink)
I'm thinking about printing this part of the thread and posting it on my office wall.
vplatt ยท 1 points ยท Posted at 22:48:50 on September 13, 2013 ยท (Permalink)
Exactly.
zeekar ยท 6 points ยท Posted at 20:56:55 on September 13, 2013 ยท (Permalink)
YAGNI.
NYKevin ยท 5 points ยท Posted at 17:25:15 on September 13, 2013 ยท (Permalink)
My SD&D course taught us about patterns, yes, but they also gave us drawbacks for every single one of them. You can't just throw every pattern in the GoF book at the wall and expect the result to work.
segfaultzen ยท 7 points ยท Posted at 17:59:22 on September 13, 2013 ยท (Permalink)
I've had managers who would question everything we did if it didn't conform to a design pattern. They viewed them as magic bullets.
grauenwolf ยท 28 points ยท Posted at 19:37:36 on September 13, 2013 ยท (Permalink)
That's where you start inventing new design pattern names.
codygman ยท 5 points ยท Posted at 20:09:04 on September 13, 2013 ยท (Permalink)
You are awesome, that is all.
NYKevin ยท 5 points ยท Posted at 18:07:45 on September 13, 2013 ยท (Permalink)
Even GoF had drawbacks listed under its patterns. Next time someone tells you that, pull up a list of pros and cons for the pattern and start asking them about the tradeoffs.
segfaultzen ยท 2 points ยท Posted at 18:15:12 on September 13, 2013 ยท (Permalink)
Oh yeah, I did. I had vigorous technical discussions many times.
berlinbrown ยท 2 points ยท Posted at 00:05:18 on September 14, 2013 ยท (Permalink)
You didn't declare your variables as final.
C_Lance ยท 2 points ยท Posted at 01:54:49 on September 14, 2013 ยท (Permalink)
I see it's already been refucktorized.
bwainfweeze ยท 2 points ยท Posted at 06:56:08 on September 14, 2013 ยท (Permalink)
Pshh. If they'd just auto wired everything they would have needed half as much code.
g4b1nagy ยท 2 points ยท Posted at 12:54:54 on September 14, 2013 ยท (Permalink)
- How deep does the rabbit hole go?
- FizzBuzzEnterpriseEdition / src / main / java / com / seriouscompany / business / java / fizzbuzz / packagenamingpackage / impl / strategies / converters / primitivetypesconverters
...
http://i.imgur.com/MHuW96t.jpg
vargonian ยท 2 points ยท Posted at 17:57:33 on September 15, 2013 ยท (Permalink)
This really did bring back awful memories of over-engineered tools I worked on at my previous job. All of the greatest internal software tools in my org started as hobbyist projects created to solve a particular problem. But as soon as they became popular, they were adopted by shared engineering teams that turned them into enterprisey engineering nightmares that never saw any progress because they were too bogged down in process.
That's not to say that I'm against solid engineering practices, but as much as I hate this cliche, it's a balance.
RoverDaddy ยท 2 points ยท Posted at 20:40:16 on September 13, 2013 ยท (Permalink)
I haven't looked through all the code yet, but I'm sure it's not using enough design patterns.
nicko68 ยท 1 points ยท Posted at 22:07:01 on September 13, 2013 ยท (Permalink)
Reading this thread is making me feel nauseated. :)
mdinstuhl ยท 1 points ยท Posted at 22:34:30 on September 13, 2013 ยท (Permalink)
God. Dammit.
foxh8er ยท 1 points ยท Posted at 23:36:40 on September 13, 2013 ยท (Permalink)
I no longer want to work at a large company.
bumble012 ยท 1 points ยท Posted at 00:27:52 on September 14, 2013 ยท (Permalink)
Ahhh! This feels like im back at work!
mike413 ยท 1 points ยท Posted at 01:42:31 on September 14, 2013 ยท (Permalink)
Welcome to Mighty Microcomputer Corporation, you're hired!
475c ยท 1 points ยท Posted at 01:49:55 on September 14, 2013 ยท (Permalink)
Innoprise Solutions, Inc.
vargonian ยท 1 points ยท Posted at 03:49:08 on September 14, 2013 ยท (Permalink)
As a former enterprise-by-day, indie-game-developer by night, it was difficult to switch gears all the time.
ford_contour ยท 1 points ยท Posted at 04:39:46 on September 14, 2013 ยท (Permalink)
It's almost impossible to tell which of the apologetic sounding comments are real and which are snark. It's just so beautiful.
eddiemoya ยท 1 points ยท Posted at 04:50:14 on September 14, 2013 ยท (Permalink)
What if we change the name of the Project to BuzzFizz?
ancientGouda ยท 1 points ยท Posted at 11:14:30 on September 14, 2013 ยท (Permalink)
If you thought the file hierarchy was great, wait til you read the issues list..
hsuh ยท 1 points ยท Posted at 12:13:13 on September 14, 2013 ยท (Permalink)
Well, when you have to extend the application to (say) also log the numbers instead of just printing, then a decoupled architecture pays off.
[deleted] ยท 1 points ยท Posted at 22:38:34 on September 14, 2013 ยท (Permalink)
That pom is way too short.
WisconsnNymphomaniac ยท 1 points ยท Posted at 20:58:39 on September 13, 2013 ยท (Permalink)
I'm dealing with SharePoint at work and I am amazed at how accurate this is. An example custom workflow available on CodePlex needed about 30 different files in order to perform a simple GET request on a web service.
dev_ire ยท 1 points ยท Posted at 21:51:47 on September 13, 2013 ยท (Permalink)
There is a C# edition but very few people can see it, and less people actually care.
vargonian ยท 0 points ยท Posted at 03:54:20 on September 14, 2013 ยท (Permalink)
I'll take C# over Java any day of the week.
[deleted] ยท -1 points ยท Posted at 18:52:01 on September 13, 2013 ยท (Permalink)
Do you think this is a mothe******* game?
[deleted] ยท 9 points ยท Posted at 19:23:16 on September 13, 2013 ยท (Permalink)
[deleted]
[deleted] ยท 2 points ยท Posted at 20:04:47 on September 13, 2013 ยท (Permalink)
Profanity is the crutch of the inarticulate ******.
[deleted] ยท 6 points ยท Posted at 20:15:55 on September 13, 2013 ยท (Permalink)
[deleted]
eddiemoya ยท 1 points ยท Posted at 04:51:03 on September 14, 2013 ยท (Permalink)
Because *********** * you.
[deleted] ยท 1 points ยท Posted at 21:58:03 on September 13, 2013 ยท (Permalink)*
[deleted]
russellsprouts ยท -5 points ยท Posted at 19:35:43 on September 13, 2013 ยท (Permalink)
I hate that that is the stock response to every ******.
[deleted] ยท 16 points ยท Posted at 19:38:29 on September 13, 2013 ยท (Permalink)
[deleted]
russellsprouts ยท 1 points ยท Posted at 05:09:12 on September 14, 2013 ยท (Permalink)
No, YOU see hunter2, because that's your password. All I see is ******.
oldneckbeard ยท -18 points ยท Posted at 18:31:29 on September 13, 2013 ยท (Permalink)
Oh look, somebody who saw what real developers do with maven once and got scared, and went back to the sandbox with his python and sublime text editor.
Fanaden ยท 11 points ยท Posted at 20:26:49 on September 13, 2013 ยท (Permalink)
Somebodies a defensive (stockholm syndrome?) Java enterprise dev.
oldneckbeard ยท -9 points ยท Posted at 20:38:32 on September 13, 2013 ยท (Permalink)
No, I just find it humorous when people bitch about stuff like "look at all these directories!" and somehow don't realize that's how Java lays things out in its package structure. I guess if you want to keep ALL your source in one directory, and have no concepts of modules, packages, or namespaces, that's cool...-ish
s73v3r ยท 2 points ยท Posted at 22:41:41 on September 14, 2013 ยท (Permalink)
Considering that Windows has a maximum directory string length, and will actually refuse to delete things that are longer than that, I'd prefer not having a billion directories.
I know this limitation was there in Windows XP, I'm not sure about Windows 7 or 8.
danielkza ยท 13 points ยท Posted at 20:39:15 on September 13, 2013 ยท (Permalink)
Only Java programmers are real developers, of course. Those dynamic languages are just toys for kids who think they can program. /s
bureX ยท 3 points ยท Posted at 21:33:45 on September 13, 2013 ยท (Permalink)
Poe's law up in here...
[deleted] ยท 5 points ยท Posted at 19:38:13 on September 13, 2013 ยท (Permalink)
This describes me perfectly. Import this bitches.
ahminus ยท 5 points ยท Posted at 19:09:41 on September 13, 2013 ยท (Permalink)
Or maybe C and vi.
lechatsportif ยท -1 points ยท Posted at 22:06:08 on September 13, 2013 ยท (Permalink)
Have any of you even seen an enterprise coder before?
/bluth
apotheon ยท 0 points ยท Posted at 05:58:17 on September 14, 2013 ยท (Permalink)
It needs a license -- something REALLY LONG and BUREAUCRATIC. I vote either GPLv3 or Apache License 2.0, either of which would fit that description.
macleod2486 ยท 0 points ยท Posted at 06:48:03 on September 14, 2013 ยท (Permalink)
What a classic.
Unomagan ยท 0 points ยท Posted at 09:32:44 on September 14, 2013 ยท (Permalink)
Oh my goodness! I laughed so hard! HAHA! I almost spit out my coffee :)
I will send this code around my company. Will be a good laugh :) THANKS A LOT!
Ilostmyredditlogin ยท 0 points ยท Posted at 10:36:51 on September 14, 2013 ยท (Permalink)
I laughed, but as much as "enterprise-y" tech and techniques are used in asinine ways and inappropriate situations at times, it feels like the pendulum has swung too far back the other way. (At least for serious development at any scale / reasonably high reliability standard.)
drewsy888 ยท -5 points ยท Posted at 20:43:36 on September 13, 2013 ยท (Permalink)
This was a top post on /r/programming a week or two ago. Is this how often this will get reposted?
[deleted] ยท -16 points ยท Posted at 17:29:54 on September 13, 2013 ยท (Permalink)
ITT: no engineers whatsoever
codygman ยท 4 points ยท Posted at 20:52:37 on September 13, 2013 ยท (Permalink)
Ftfy
oldneckbeard ยท -5 points ยท Posted at 18:30:23 on September 13, 2013 ยท (Permalink)
seriously. i'm surprised people aren't posting their own 1-line solutions in their favorite language.
dreugeworst ยท 15 points ยท Posted at 19:21:50 on September 13, 2013 ยท (Permalink)
I don't get it, we're not allowed to make fun of the overengineered Java enterprise software? Or do you just want us all to take this as a challenge?
well, to make you happy, here you go:
'course, you need to import Data.Maybe and Data.Monoid, so it's not really a one-liner
oldneckbeard ยท -5 points ยท Posted at 20:28:28 on September 13, 2013 ยท (Permalink)
You're allowed, but there's "making fun of it" and then "being stupid." This example, while it might seem funny, has no actual relation to what happens. It'd be like if someone went into haskell and made everything a monoid, including moving an int to a string and back. You'd be like, "well, it's clearly bad, but it's not even close enough to real to be funny" If just out-weirding the next person is the goal, brainfuck or something else is the way to go.
dreugeworst ยท 2 points ยท Posted at 21:49:10 on September 13, 2013 ยท (Permalink)
I dunno, I rather appreciate the effort that went into it
lechatsportif ยท 2 points ยท Posted at 02:29:57 on September 14, 2013 ยท (Permalink)
yeah its pretty far from the mark.
[deleted] ยท -1 points ยท Posted at 13:03:42 on September 14, 2013 ยท (Permalink)
my point is using proven components and strategies to construct complex products is a time-honored engineering practice
and the sort of people who make fun of this approach are not engineers, nor familiar with the discipline of engineering
take a look at the open source projects by companies like Google, Twitter, Facebook et al and you'll see code that much more closely resembles FizzBuzzEE than myfirstPHPproject.com
s73v3r ยท 2 points ยท Posted at 22:43:08 on September 14, 2013 ยท (Permalink)
Your point is that this shit is somehow worthwhile, and not just a huge waste of time and pain in the ass because some business weenie somewhere has commitment issues.
Yes, they are. That's why they're able to make fun of it.
This stuff you defend was not made by engineers. It was made by businessmen pretending to be engineers so they don't have to actually employ engineers.
[deleted] ยท 0 points ยท Posted at 00:18:46 on September 15, 2013 ยท (Permalink)
TIL Google, Twitter, LinkedIn, Tumblr etc engineers are really "businessmen pretending to be engineers so they don't have to actually employ engineers"
thanks, /r/programming
benibela2 ยท 4 points ยท Posted at 20:03:55 on September 13, 2013 ยท (Permalink)
I'm here for that!
Shortest FizzBuzz I could write in my favorite language!
oldneckbeard ยท -1 points ยท Posted at 20:24:03 on September 13, 2013 ยท (Permalink)
arrite, you got me. what the hell language is that? :)
PSquid ยท 2 points ยท Posted at 00:13:18 on September 15, 2013 ยท (Permalink)
Homespring.