Spring API Bingo

For the occasion of today’s date, I’ve just invented a fun game. The Spring API Bingo! How does it work?

Let us write the following little piece of code:

public class SpringAPIBingo {
    public static void main(String[] args) {
        // Any similarities with actual API
        // (e.g. that of Spring) are completely 
        // accidental
        List<String> terms = Arrays.asList(
            "Abstract",
            "Adapter",
            "Adaptor",
            "Advisor",
            "Aware",
            "Bean",
            "Class",
            "Container",
            "Data",
            "Definition",
            "Delegate",
            "Delegating",
            "Destination",
            "Detecting",
            "Disposable",
            "Entity",
            "Exception",
            "Factory",
            "Handler",
            "Info",
            "Initializer",
            "Initializing",
            "Local",
            "Loader",
            "Manager",
            "Mapping",
            "Persistence",
            "Post",
            "Pre",
            "Resolver",
            "Source",
            "Target",
            "Translation",
            "Translator"
        );

        // [...]

So far so good. We could use more terms if we wanted to but for now, these will suffice.

Now, let’s shuffle the above list and create names of length 2-5 terms. Easy as pie. We’re using Java 8 for this. So our programme above continues like so:

        // [...]

        System.out.println("<table>");
        System.out.println("<tr>");

        for (int i = 0; i < 25; i++) {
            if (i > 0 && i % 5 == 0)
                System.out.println("</tr><tr>");

            System.out.print("<td>");

            Collections.shuffle(terms);
            System.out.print(
                terms.stream()
                     .limit((long) (2 + 
                          Math.random() * 4))
                     .collect(Collectors.joining())
            );

            System.out.println("</td>");
        }

        System.out.println("</tr>");
        System.out.println("</table>");
    }
}

As you can see, the above generates a 5×5 HTML table of random names. As this blog is not wide enough for a 5×5 table, let’s break down the table for readability purposes:

Column 1
ClassContainerPost
FactoryAdvisorAdapterHandlerLoader
AdvisorMapping
ResolverAdaptorTranslatorEntity
LocalEntity
Column 2
AdaptorExceptionDefinitionPreMapping
TranslatorLoader
ContainerPreTranslatorInfoDisposable
TranslatorPostFactory
PreClassResolver
Column 3
DetectingDelegatingAdaptor
ContainerLocalTranslation
DetectingClass
DefinitionManagerDisposableAbstract
MappingDelegatingPersistenceAbstractHandler
Column 4
PreMappingDetectingClassAdapter
ManagerResolverExceptionBeanAware
BeanFactoryDestinationResolver
TranslationBean
LocalPersistenceManagerFactoryBean
Column 5
ExceptionLocal
InfoPreSourceBeanFactory
AbstractBeanDefinition
PersistencePre
DisposableBean

Now, let’s go visit the Spring Javadoc. We’ll take version 4.0’s allclasses page for optimal winning chances. Go back to your 5×5 table and mark all matches.

Now let’s check if we have 5 matches in a row, bingo!

Column 1
ClassContainerPost
FactoryAdvisorAdapterHandlerLoader
AdvisorMapping
ResolverAdaptorTranslatorEntity
LocalEntity
Column 2
AdaptorExceptionDefinitionPreMapping
TranslatorLoader
ContainerPreTranslatorInfoDisposable
TranslatorPostFactory
PreClassResolver
Column 3
DetectingDelegatingAdaptor
ContainerLocalTranslation
DetectingClass
DefinitionManagerDisposableAbstract
MappingDelegatingPersistenceAbstractHandler
Column 4
PreMappingDetectingClassAdapter
ManagerResolverExceptionBeanAware
BeanFactoryDestinationResolver
TranslationBean
LocalPersistenceManagerFactoryBean
Column 5
ExceptionLocal
InfoPreSourceBeanFactory
AbstractBeanDefinition
PersistencePre
DisposableBean

Only four hits. Better luck next time.

Next week: Facebook Bingo

We’ll write down 25 tech companies in a 5×5 grid. Then wait until Facebook buys new companies. If you got 5 in a row – Bingo!

The 10 Commandments of Programming

Patterns 34:29

As Turing descended from Mount Compute – with the two iPads of the testimony in his hands as he descended the mountain – he did not realize that the skin of his blog shone as a result of his Compiling the Code.

Patterns 35:1

Turing assembled the entire Geek community and said to them, “These are the things that the Compiler has commanded you to do:”

  1. Thou shalt not GOTO
  2. Thou shalt not TODO
  3. Thou shalt not catch all
  4. Thou shalt not <br>
  5. Thou shalt not label thy code to break or continue
  6. Thou shalt not bear false witness or side effects in getters
  7. Thou shalt not neglect your curly braces
  8. Thou shalt not desire the Unsafe
  9. Thou shalt not covet your neighbor’s private fields or methods
  10. Thou shalt not deceive with cleverness in names

But the Geek community did not obey, and the Compiler was not amused:

He was not amused - by Geek And Poke - licensed CC-BY
He was not amused – by Geek And Pokelicensed CC-BY

Disclaimer

Neither Turing nor the Compiler may not have actually said these things

Wikileaks To Leak 5000 Open Source Java Projects With All That Private/Final Bullshit Removed

Hilarious. Not even written on April 1! Taken from here:
http://steve-yegge.blogspot.ch/2010/07/wikileaks-to-leak-5000-open-source-java.html

EYJAFJÖLL, ICELAND — Java programmers around the globe are in a panic today over a Wikileaks press release issued at 8:15am GMT. Wikileaks announced that they will re-release the source code for thousands of Open Source Java projects, making all access modifiers ‘public’ and all classes and members non-‘final’.

Open source user rants

So far, I have escaped jOOQ user rants and insults. Maybe it’s because jOOQ is still quite a niche product. Maybe it’s because jOOQ has almost no bugs ;-) The only real rant I’ve seen so far is this one by a contributor to JDO, JPA, EJB 3.0:

http://erix-data-services.blogspot.ch/2010/10/jooq.html

An extract:

How should we react when reading posts like this in 2010?
It’s like being back 15 years earlier.
How is that possible to write so many irrelevant statements in a single post?

The so-called “pragmatic” approach has given birth to so many useless frameworks like this one.

The good news is there is still a need for a comprehensive data manipulation solution.

Apparently, jOOQ stirs emotions in some people ;-)

Anyway, there’s critique, there are rants and then, there are plain insults. I’ve recently stumbled across this hilarious thread here:

https://bugs.php.net/bug.php?id=50696

Quite nice :-) What’s your favourite rant by an open source user?