• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

[book promo] Reflection not part of OCP?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi  Jeanne & Scott!

Congratulations on your latest OCP Study Guide! I'm thrilled that you both keep writing these excellent books.

I just learned about Java [1]Reflection in a Spring Boot course and was a bit shocked that I had never heard of Reflection. It seems quite an essential feature of Java.

I quickly checked the index of your two OCP11 Study Guides (must confess I've not managed to finish them yet) and did not find Reflection (or Introspection).

What is your view on Reflection not included in OCP? (or is it, and do I need to slap myself around with a copy of your OCP17 Study Guide?).

Sander

1. https://www.oracle.com/technical-resources/articles/java/javareflection.html
 
author
Posts: 4356
45
jQuery Eclipse IDE Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the questions Sander!  First off, Reflection has never been part of the Java Certification exams (that I can recall).

In my experience, reflection is not commonly used in professional software development, save a few special circumstances.  Some examples include architecture code that process unknown classes, or even code generators.  I’m not saying there’s not important use cases, but in my experience it’s not common.  I think the only time I ever used it was to read annotation metadata.

Many people try to reflection to bypass access modifiers, like reading private fields, but that code may fail in production, as the security manager can block it.  I’m not sure why you would need reflection for spring boot though.. there’s so many powerful things in spring boot already!
 
Marshal
Posts: 6211
501
IntelliJ IDE Python TypeScript Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm quite glad that the reflection library isn't part of the cert exams because as Scott says it's valid use is a rare case. I would not consider it part of your toolkit for what I call "general purpose" programming and if you find yourself reaching for it then seriously ask yourself why because almost always there is a better way to do it.
 
Sander Hollaar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Scott Selikoff wrote:
I’m not sure why you would need reflection for spring boot though.. there’s so many powerful things in spring boot already!



Ah, I've not properly expressed the reason for my question seeing your and Tim's reply :-)

It is not that I think anybody should use reflection, but that knowing the principle of reflection helps to understand how for example annotations work.

Similar to understanding the principle of Java bytecode - without the actuall need to write bytecode - helps to understand the compile and run processes of Java.

Thank you for your extensive answer!

Sander
 
Tim Cooke
Marshal
Posts: 6211
501
IntelliJ IDE Python TypeScript Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Scott will keep me right on this, but I would view the Java Certs as an in depth examination on using the language constructs rather than digging into how things work behind the scenes.
 
author & internet detective
Posts: 42200
937
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:Scott will keep me right on this, but I would view the Java Certs as an in depth examination on using the language constructs rather than digging into how things work behind the scenes.


Agreed. Language constructs and built in libraries. Also, the exam can't include everything. It contains a lot for a 90 minute exam as it is!
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic