I should preface this with this statement. I actually do like Spring. At least Spring core. And I use it almost every chance I get.
But I started to really think about it the other day. What is Spring? What is it doing? What is dependency injection?
Here is a typical usage. At least from my experience.
class SomeService {
@Autowired
SomeDao someDao;
}
So whats going on. I'll tell you a dirty little secret. SomeDao is a reference to a Global variable. But here in OO land Global is an obscenity.
So what do we do to hide the fact that we are using Global variables but want to pretend we are OO kosher.
We use an annotation. And 5 layers of javASSist.
What did this achieve? This @Autowired. Well it saved me from writing
SomeDao someDao = SomeDao.getInstance();
Which would probably be a Singleton pattern. Which is evil too of course.
Or maybe I would have written it
SomeDao someDao = SomeDaoFactory.getSomeDao();
Factory how retro. We don't use Factories any more. They just pollute.
So, now I have a new clean elegant way to get my Globals.
I just use @Autowired
And that makes me feel a lot better.
Friday, December 24, 2010
Monday, December 13, 2010
Spring Guys - Enough with the names already
Can't you come up with a better naming scheme than AbstractThingThatDoesSomethingALittleDifferentFromThatOtherThingImpl
It makes my eyes bleed to read your Javadocs.
It makes my eyes bleed to read your Javadocs.
Sunday, December 12, 2010
Oracle v Google
I think the the biggest question that no-one is asking is: Why didn't Google acquire Sun?
Hmmm
Any takers.
Everyone is whining about Oracle. But why didn't the geniuses at Google didn't figure it out?
Like every other tired American corp, Sun was tired of trying and begging for an acquisition. Pretty obvious to anyone watching quarterly reports.
IBM wasn't going to do it. Too Indian. Microsoft. Come on. That pretty much left Oracle.
So wheres the surprise?
Hmmm
Any takers.
Everyone is whining about Oracle. But why didn't the geniuses at Google didn't figure it out?
Like every other tired American corp, Sun was tired of trying and begging for an acquisition. Pretty obvious to anyone watching quarterly reports.
IBM wasn't going to do it. Too Indian. Microsoft. Come on. That pretty much left Oracle.
So wheres the surprise?
Saturday, December 11, 2010
Apache Leaving JCP Side Note
Take a breath. Good. In... Out...
OK.
Now stop and think.
This is not really that bad for Java the language. Or Java the community. And now lets hope Apache goes forward with Harmony and creates something special. If they put a different language on it, even better.
Does the community need JSRs? Does it really need "standards"? (Yep I quoted that. We could do a whole nother post on Sun/Oracle specs parading as standards. Or how if you wait 10 years for ISO standards you wind up with C++.)
No and No.
Java in the last 7 or so years has been dominated by projects that are not standards. Why? Because they are solid, dependable, growing projects. Lets name a few. Log4j/slf4j. Struts. Hibernate. Spring. That took 5 seconds. And if I spent the time, I could easily rattle off a dozen more.
Plain and simple, these projects fill needs that software developers have. If the Java community sat around and waited for Sun (or Oracle) to fill every hole, then the Java community really would have died on the vine.
In fact waiting for a large company to solve basic issues is a crap shoot at best. Sun did the world a huge favor releasing Java and the JVM. They spent millions of dollars developing Java/JVM technology. And basically gave it away for free. For that, they deserve a tremendous amount of thanks.
However, for 15+ years, they failed to really nurture it in some aspects. I would argue that is because, they didn't know what to do with it or how to capitalize on it.
For example, 15+ years later and we have as part of the standard
poor date handling
poor math libs
poor collections libs
poor ORM (JPA is a disaster. Like JDO and EJB/EJBQL before it.)
poor CDI
two weak tries at web ui interaction (JSP & JSF. Can we please stick the fork in JSF?)
poor threading/concurrency model (Its getting better.)
Projects and people outside Sun did a fantastic job of rising to the occasion and filling these needs. Without standards without JSRs and without JCPs.
OK.
Now stop and think.
This is not really that bad for Java the language. Or Java the community. And now lets hope Apache goes forward with Harmony and creates something special. If they put a different language on it, even better.
Does the community need JSRs? Does it really need "standards"? (Yep I quoted that. We could do a whole nother post on Sun/Oracle specs parading as standards. Or how if you wait 10 years for ISO standards you wind up with C++.)
No and No.
Java in the last 7 or so years has been dominated by projects that are not standards. Why? Because they are solid, dependable, growing projects. Lets name a few. Log4j/slf4j. Struts. Hibernate. Spring. That took 5 seconds. And if I spent the time, I could easily rattle off a dozen more.
Plain and simple, these projects fill needs that software developers have. If the Java community sat around and waited for Sun (or Oracle) to fill every hole, then the Java community really would have died on the vine.
In fact waiting for a large company to solve basic issues is a crap shoot at best. Sun did the world a huge favor releasing Java and the JVM. They spent millions of dollars developing Java/JVM technology. And basically gave it away for free. For that, they deserve a tremendous amount of thanks.
However, for 15+ years, they failed to really nurture it in some aspects. I would argue that is because, they didn't know what to do with it or how to capitalize on it.
For example, 15+ years later and we have as part of the standard
poor date handling
poor math libs
poor collections libs
poor ORM (JPA is a disaster. Like JDO and EJB/EJBQL before it.)
poor CDI
two weak tries at web ui interaction (JSP & JSF. Can we please stick the fork in JSF?)
poor threading/concurrency model (Its getting better.)
Projects and people outside Sun did a fantastic job of rising to the occasion and filling these needs. Without standards without JSRs and without JCPs.
Thursday, December 9, 2010
Scala Cons
Here is one of my biggest gripes with Scala.
It has a very irregular syntax.
Here are two examples straight from Odersky's book.
for (p <- persons; n = p.name; if (n startsWith "To")
yield n
for {
p <- persons
// a generator
n = p.name // a definition
if (n startsWith "To") // a filter
} yield n
These are equivalent for expressions. In my opinion there is a huge problem with this.
Sometimes I can do for() sometimes for{} and they are the same.
I think this reflects poor design. Someone thought they were clever and got the grammar to do the same thing so they left it.
But syntax, including punctuation, is very important in how quickly someone can read text and comprehend it.
Now, if someone is reading Scala code, they have to be very careful about how they mentally parse and interpret a block of code.
These are valuable mental cycles that must to be spent on the syntax of the language, instead of the semantics of the code.
When looking at Java or C for example, a developer doesn't have this issue.
A for loop always uses parens, period end of story. There is no time spent thinking about paren vs brace. Or semi colon vs missing semi colon.
It has a very irregular syntax.
Here are two examples straight from Odersky's book.
for (p <- persons; n = p.name; if (n startsWith "To")
yield n
for {
p <- persons
// a generator
n = p.name // a definition
if (n startsWith "To") // a filter
} yield n
These are equivalent for expressions. In my opinion there is a huge problem with this.
Sometimes I can do for() sometimes for{} and they are the same.
I think this reflects poor design. Someone thought they were clever and got the grammar to do the same thing so they left it.
But syntax, including punctuation, is very important in how quickly someone can read text and comprehend it.
Now, if someone is reading Scala code, they have to be very careful about how they mentally parse and interpret a block of code.
These are valuable mental cycles that must to be spent on the syntax of the language, instead of the semantics of the code.
When looking at Java or C for example, a developer doesn't have this issue.
A for loop always uses parens, period end of story. There is no time spent thinking about paren vs brace. Or semi colon vs missing semi colon.
Subscribe to:
Posts (Atom)