You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@polygene.apache.org by Niclas Hedhman <ni...@hedhman.org> on 2015/08/24 12:39:50 UTC

Is Java 8 still Java?

I end up with a lot of code similar to this;

Class getInterfaceMethodDeclaration( Method method, Class clazz )
    throws NoSuchMethodException
{
    return interfacesOf( clazz )
        .map( Classes.RAW_CLASS )
        .filter( intface -> checkForMethod( intface, method ) )
        .findFirst()
        .orElseThrow( () -> new NoSuchMethodException( method.getName() ) );
}

Not sure I would have recognized this Java a few years back.

-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Re: Is Java 8 still Java?

Posted by Jiri Jetmar <ju...@gmail.com>.
" but I think we all "oldies" need to freshen up on the code
reading skills for Java 8. ;-)"

YES !! Thats the way to go, 100% agree.. :-)



2015-08-24 15:13 GMT+02:00 Niclas Hedhman <ni...@hedhman.org>:

> Not so sure I am esoteric... But it just falls this way when converting all
> the Iterable<> stuff that Rickard put in place 4 years ago.
>
> Still making good progress, and I like the internals better afterwards. So
> it is all good, but I think we all "oldies" need to freshen up on the code
> reading skills for Java 8. ;-)
>
>
> Cheers
> Niclas
>
> On Mon, Aug 24, 2015 at 7:27 PM, Jiri Jetmar <ju...@gmail.com>
> wrote:
>
> > Hi Niclas,
> >
> > haha.. now you start to be esoteric :-)
> >
> > Java evolves with time as any other language. Remember this C versus C++
> > discussions..
> >
> > What I;m asking my self sometimes is e.g. in case of Scala where one can
> > produce really
> > elegant expressions but needs a huge knowledge and experience in order to
> > be able
> > to read and understand code sources fast. So code compression prevents
> lot
> > of times easy
> > readability and "hides" key concepts.
> >
> > Just my 2cents on this topic...
> >
> > Cheers,
> > Jiri
> >
> > 2015-08-24 12:39 GMT+02:00 Niclas Hedhman <ni...@hedhman.org>:
> >
> > > I end up with a lot of code similar to this;
> > >
> > > Class getInterfaceMethodDeclaration( Method method, Class clazz )
> > >     throws NoSuchMethodException
> > > {
> > >     return interfacesOf( clazz )
> > >         .map( Classes.RAW_CLASS )
> > >         .filter( intface -> checkForMethod( intface, method ) )
> > >         .findFirst()
> > >         .orElseThrow( () -> new NoSuchMethodException(
> method.getName() )
> > > );
> > > }
> > >
> > > Not sure I would have recognized this Java a few years back.
> > >
> > > --
> > > Niclas Hedhman, Software Developer
> > > http://zest.apache.org - New Energy for Java
> > >
> >
>
>
>
> --
> Niclas Hedhman, Software Developer
> http://zest.apache.org - New Energy for Java
>

Re: Is Java 8 still Java?

Posted by Niclas Hedhman <ni...@hedhman.org>.
Not so sure I am esoteric... But it just falls this way when converting all
the Iterable<> stuff that Rickard put in place 4 years ago.

Still making good progress, and I like the internals better afterwards. So
it is all good, but I think we all "oldies" need to freshen up on the code
reading skills for Java 8. ;-)


Cheers
Niclas

On Mon, Aug 24, 2015 at 7:27 PM, Jiri Jetmar <ju...@gmail.com>
wrote:

> Hi Niclas,
>
> haha.. now you start to be esoteric :-)
>
> Java evolves with time as any other language. Remember this C versus C++
> discussions..
>
> What I;m asking my self sometimes is e.g. in case of Scala where one can
> produce really
> elegant expressions but needs a huge knowledge and experience in order to
> be able
> to read and understand code sources fast. So code compression prevents lot
> of times easy
> readability and "hides" key concepts.
>
> Just my 2cents on this topic...
>
> Cheers,
> Jiri
>
> 2015-08-24 12:39 GMT+02:00 Niclas Hedhman <ni...@hedhman.org>:
>
> > I end up with a lot of code similar to this;
> >
> > Class getInterfaceMethodDeclaration( Method method, Class clazz )
> >     throws NoSuchMethodException
> > {
> >     return interfacesOf( clazz )
> >         .map( Classes.RAW_CLASS )
> >         .filter( intface -> checkForMethod( intface, method ) )
> >         .findFirst()
> >         .orElseThrow( () -> new NoSuchMethodException( method.getName() )
> > );
> > }
> >
> > Not sure I would have recognized this Java a few years back.
> >
> > --
> > Niclas Hedhman, Software Developer
> > http://zest.apache.org - New Energy for Java
> >
>



-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Re: Is Java 8 still Java?

Posted by Stanislav Muhametsin <st...@zest.mail.kapsi.fi>.
As someone who reads (and writes) a lot of LINQ expressions, what Niclas 
wrote seemed pretty natural (albeit a bit clumsy, because of Java).
I personally think it is OK to write compressed, elegant code, and 
assume that the reader will have enough theoretical knowledge and 
practical experience to understand it.
One reason for this is also because these managed languages (Java, C#, 
and their variants), even with expressions like that, are still a lot 
easier to understand than most C/C++ stuff, especially now with all the 
'fun' extra features with new standards.


Some of the trickier parts of the code in Java/C# should have a detailed 
explanation in comments, if for nothing else, then because the possible 
need to revisit your own code later. ;)
And the C/C++ stuff always needs comments...

On 24.8.2015 14:27, Jiri Jetmar wrote:
> Hi Niclas,
>
> haha.. now you start to be esoteric :-)
>
> Java evolves with time as any other language. Remember this C versus C++
> discussions..
>
> What I;m asking my self sometimes is e.g. in case of Scala where one can
> produce really
> elegant expressions but needs a huge knowledge and experience in order to
> be able
> to read and understand code sources fast. So code compression prevents lot
> of times easy
> readability and "hides" key concepts.
>
> Just my 2cents on this topic...
>
> Cheers,
> Jiri
>
> 2015-08-24 12:39 GMT+02:00 Niclas Hedhman <ni...@hedhman.org>:
>
>> I end up with a lot of code similar to this;
>>
>> Class getInterfaceMethodDeclaration( Method method, Class clazz )
>>      throws NoSuchMethodException
>> {
>>      return interfacesOf( clazz )
>>          .map( Classes.RAW_CLASS )
>>          .filter( intface -> checkForMethod( intface, method ) )
>>          .findFirst()
>>          .orElseThrow( () -> new NoSuchMethodException( method.getName() )
>> );
>> }
>>
>> Not sure I would have recognized this Java a few years back.
>>
>> --
>> Niclas Hedhman, Software Developer
>> http://zest.apache.org - New Energy for Java
>>


Re: Is Java 8 still Java?

Posted by Jiri Jetmar <ju...@gmail.com>.
Hi Niclas,

haha.. now you start to be esoteric :-)

Java evolves with time as any other language. Remember this C versus C++
discussions..

What I;m asking my self sometimes is e.g. in case of Scala where one can
produce really
elegant expressions but needs a huge knowledge and experience in order to
be able
to read and understand code sources fast. So code compression prevents lot
of times easy
readability and "hides" key concepts.

Just my 2cents on this topic...

Cheers,
Jiri

2015-08-24 12:39 GMT+02:00 Niclas Hedhman <ni...@hedhman.org>:

> I end up with a lot of code similar to this;
>
> Class getInterfaceMethodDeclaration( Method method, Class clazz )
>     throws NoSuchMethodException
> {
>     return interfacesOf( clazz )
>         .map( Classes.RAW_CLASS )
>         .filter( intface -> checkForMethod( intface, method ) )
>         .findFirst()
>         .orElseThrow( () -> new NoSuchMethodException( method.getName() )
> );
> }
>
> Not sure I would have recognized this Java a few years back.
>
> --
> Niclas Hedhman, Software Developer
> http://zest.apache.org - New Energy for Java
>