• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Whew--Release Is Done

 
author
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Companies are so inconsiderate, scheduling releases during stuff like this. Now back to the good stuff

Seriously, so far, this has been a really great forum to participate in. I've really enjoyed discussing the topics you've posted, and look forward to continuing.

Best Regards,

Nate
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope you had fun! Any new reflection insights after the current project release?

--
./pope
[the_mindstorm]
 
Nate Forman
author
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not much time for experimentation... the schedule was really tight. However, I did use a lot of the old standbys: dynamic loading and construction, inspection and access, some proxying... These things really seem to help a framework come up quickly when used in conjunction with the right patterns.

Ali, from your previous postings ('loading plugins') I know you've done this before, but here's an example for the body of the forum:

- data in the form of XML enters my application remotely. I want to handle these messages to do different things in my application.

- I grab a specific token from the XML and synthesize a class name.

- I check a property file for a property that may overload that specific class.

- I use Class.forName() to load the handler class by that name (or the overloaded version from properties)

- I use newInstance() on the loaded handler class to create a handler instance.

- I pass the handler instance my XML data, and the program continues.

This is classic delegation (Command pattern) with a twist. I can extend my application's capability to handle XML by just writing new classes and dropping them in the classpath. This technique is covered in more detail in Chapter 2 of our book.

Best Regards,

Nate
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In addition to insights that you provided above, do you wanna shine some light on us about some "watch-out" things to be prepared to start a new project using Java Reflection?

We do hope you have been in a great week here in the Ranch... Thanks a lot for sharing your valuable time with us...
 
Nate Forman
author
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ko Ko,

It was really my pleasure to participate. Thanks for your insightful questions and comments.

The thing that I like to think about reflection is that it's really good for doing what it does, but you don't want to use it for just anything. When you want to extend your program's flexibility past what you know at writing time, to what you can find out and do while the program is running, that's when to use reflection. We tried to capture as many specific patters (and antipatterns) as we could in the book.

In terms of other "watch outs" in starting a project, it seems like most are the same as starting any project. Misunderstanding requirements, over-design, under-design, lack of documentation, lack of process, lack of testing, etc. can all get you with reflection.

Nate
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic