<?xml version="1.0" encoding='utf-8'?>
<?xml-stylesheet type="text/xsl" href="https://raibledesigns.com/roller-ui/styles/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom">
    <title type="html">Raible Designs</title>
    <subtitle type="html">Raible Designs is an Enterprise Open Source Consulting company. We specialize in UI and Full Stack Architectures using HTML5, CSS, JavaScript and Java. We love HTML5, Angular, Bootstrap, Spring Boot, and especially JHipster.</subtitle>
    <id>https://raibledesigns.com/rd/feed/entries/atom</id>
            <link rel="self" type="application/atom+xml" href="https://raibledesigns.com/rd/feed/entries/atom?cat=%2FJava%2FNFJS" />
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/" />
        <updated>2026-05-09T04:29:55-06:00</updated>
    <generator uri="http://roller.apache.org" version="5.0.3 (1388864191739:dave)">Apache Roller (incubating)</generator>
        <entry>
        <id>https://raibledesigns.com/rd/entry/facets_of_ruby_by_dave</id>
        <title type="html">Facets of Ruby by Dave Thomas</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/facets_of_ruby_by_dave"/>
        <published>2004-11-12T18:39:59-07:00</published>
        <updated>2007-02-10T20:07:56-07:00</updated> 
        <category term="/Java/NFJS" label="NFJS" />
        <content type="html">You can learn Ruby in 4 hours. This talks isn&apos;t to learn Ruby, but rather
    to show &lt;em&gt;facets of Ruby&lt;/em&gt;. Ruby has made programming fun again for
    Dave. It&apos;s also made him more productive. &lt;/p&gt;
&lt;p style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Languages and tools make a difference&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Ruby has variables, methods, but no types in methods. When Dave first started
    using Ruby, he had a strong typing background - and was terrified of Ruby&apos;s
    un-typed feature. He first thought Ruby was a toy language for hobbyists
    because of the lack of typing. Now, many years later, he really likes the
    lack of typing and hardly even has bugs relating to typing. He notes that
    with Java we store most of our data in Collections - and those are all Objects
    - so Java is essentially un-typed as well. How often do you get ClassCastExceptions?
     The rooms concensus is not &lt;em&gt;not a whole lot&lt;/em&gt;. To make up for the
     lack of typing, Ruby developers tend to write a lot more unit tests.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ActiveRecord - Ruby O/R Mapping Library&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Ruby on Rails - not a single line of XML. Uses intelligent defaults and allows
    you to override them. The following creates a wrapper around the &amp;quot;ranks&amp;quot;
    table. &lt;/p&gt;
&lt;pre&gt;class Rank &amp;lt; ActiveRecord::Base
end&lt;/pre&gt;
&lt;p&gt;The original author of RoR thinks that every database table should be plural,
    so singular class names map to plural table names. It&apos;s even smart enough
    to change Person to a &amp;quot;people&amp;quot; database table. Apparently it has a bunch
    of the singular-to-plural mappings for the English language built-in. The
    key to Rails is &lt;em&gt;clever defaulting&lt;/em&gt; - allow you to write a lot less
    code, but override if you really need to. &lt;/p&gt;
&lt;p&gt;ActiveRecord has many lifecyle hooks (17) that you can override. For example,
    before_save, before_destroy, validate. For example&lt;/p&gt;
&lt;pre&gt;def before_save
  self.when_added ||= Time.now
end&lt;/pre&gt;
&lt;p&gt;I wonder if Rails has any support for transactions and specifying propagation
    behavior on transactions? I asked Dave this question and it sounds like ActiveRecord
    has a rich support for transactions - and even wraps the &amp;quot;save&amp;quot; method with
    a transaction by default. &lt;/p&gt;
&lt;p style=&quot;text-align:center&quot;&gt;&lt;strong&gt;&amp;quot;Ruby is pretty damn good at web applications&amp;quot;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Simple CGI is a common choice. FastCGI and mod_ruby in Apache are other common
    choices. There are also a number of different web frameworks for Ruby:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Roll-your-own&lt;/li&gt;
    &lt;li&gt;Templating systems
        &lt;ol&gt;
            &lt;li&gt;erb&lt;/li&gt;
            &lt;li&gt;Amarita&lt;/li&gt;
            &lt;li&gt;RDoc templates&lt;/li&gt;
        &lt;/ol&gt;
    &lt;/li&gt;
    &lt;li&gt;Iowa - similar to WebObjects&lt;/li&gt;
    &lt;li&gt;Ruby on Rails&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Ruby on Rails - MVC Framework&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Contoller - one method per view. Setup context (a.k.a. the model) for views.
    Views contain &amp;quot;rhtml&amp;quot; - HTML with embedded Ruby. Lots of helper functions.
    Can access model data (context) setup by Controller. The name of the method
    in the Controller determines the name of the view file. A &amp;quot;select&amp;quot; method
    will dispatch to a &amp;quot;select.rhtml&amp;quot; file. The method name to call in a Controller
    is determined by the URI - for example, /ranks/view calls the &amp;quot;view&amp;quot; method
    in the RanksController class. Pretty slick! I like the idea of smart defaults
    - IMO this should be used a lot more in webapps. I&apos;d love to get away from
    mapping URLs in Struts, Spring and WebWork.&lt;/p&gt;
&lt;p&gt;Rails has built-in support for configurable URLs - so you can change query
    strings to more slash-type URLs. What about things like client-side validation,
    success messages and sortable/pageable tables? Do those exist in Rails? I
    asked Dave and he said said they have good support for success messages with
    a &amp;quot;flash&amp;quot; concept and the post-to-redirect problem is almost non-existant
    because most controller invocations are redirects. Client-side validation
    and sortable/pageable tables don&apos;t exist in Rails. &lt;/p&gt;
&lt;p&gt;Rails has Needles - and IoC framework similar to Pico. However, there&apos;s a
    fair amount of traffic on the mailing list and a lot of Ruby developers think
    they just don&apos;t need IoC. Dave&apos;s suggestion is to use &lt;em&gt;Class Injection&lt;/em&gt;. &lt;/p&gt;
&lt;p&gt;The largest Ruby application is probably Daves - 55,000 lines or code, couple
    hundred thousand users. There are entire companies who write all all their
    applications in Ruby. The founder of Rails wrote it so he could write Basecamp
    - which is only 4500 lines of code. &lt;/p&gt;
&lt;p&gt;Good stuff Dave - and definitely a nice overview of Rails. Will I be digging
    in an using Rails anytime soon? Not this year, I&apos;m going to have some fun
    with Tapestry and JSF first. Maybe next year.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/design_patterns_revisited_taking_advantage</id>
        <title type="html">Design Patterns Revisited: Taking Advantage of Dynamic Reflective Languages by Stuart Halloway</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/design_patterns_revisited_taking_advantage"/>
        <published>2004-11-12T18:38:07-07:00</published>
        <updated>2007-02-10T20:07:56-07:00</updated> 
        <category term="/Java/NFJS" label="NFJS" />
        <content type="html">SmartFactory - one factory for all factories. Allows developers to handle
    failures rather depending on various factories. Unfortunately, you will have
    to do Casts. Stuart things that Generics should&apos;ve never been added and instead
    we should just have no casts. Instead, the compiler should inject the cast
    implicitly.&lt;/p&gt;
&lt;pre&gt;Document d = SmartFactory.getInstance();&lt;/pre&gt;
&lt;p&gt;Java might be a lot more powerful if we could return a different type from
    constructors - like Class Clusters in Objective-C. You can get a lot of dynamic
    features in Java using AspectJ. Java Developers
    have a lot of responsibility when they start using aspects.&lt;/p&gt;
&lt;p&gt;Stuarts talk was 3 hours and I only attended the first half. He&apos;s a very good
    speaker and I enjoyed listening to him more a lot. The basic gist of his
    talk seemed to be that Java should be more dynamic, and using AspectJ, it
    can be. I thought he was going to recommend we switch languages - so I was
    surprised to here him recommend AOP. The last example he gave was how to
    interrupt a FileInputStream so you could test the condition in a unit test.
    I can see how this could be quite useful for causing network or database
    failures and seeing how your application behaves.</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/njsf_denver_ant_hacks_by</id>
        <title type="html">Ant Hacks by Erik Hatcher</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/njsf_denver_ant_hacks_by"/>
        <published>2004-11-12T17:12:12-07:00</published>
        <updated>2007-02-10T20:07:56-07:00</updated> 
        <category term="/Java/NFJS" label="NFJS" />
        <content type="html">The first session I attended was Erik Hatcher&apos;s Ant Hacks talk. The first
    half of his talk was about Ant in general and was most of the stuff covered
    in Java Development with Ant. The good stuff was the 2nd half when he covered
    all the new stuff in Ant 1.6. Steve is working on an update to Java Development
    with Ant - shoujld will be a lot thinner. Below are some notes I took on
    what&apos;s new in 1.6. &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;&amp;lt;image&amp;gt;&lt;/strong&gt; task. Requires Java Advanced Imaging API
        &lt;ul&gt;
            &lt;li&gt;Performs image manipulation&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&amp;lt;import&amp;gt;&lt;/strong&gt; task
        &lt;ul&gt;
            &lt;li&gt;No more entity ref includes needed - can use Ant properties for
                file reference now. &lt;/li&gt;
            &lt;li&gt;OO Nature
                &lt;ul&gt;
                    &lt;li&gt;mix in imported build files - call super on imported
                        file by specifying depends=&amp;quot;${ant.project.name}.target&amp;quot;
                        where the project.name is specified in the imported build
                        file. Only targets that are overridden will get prefixed
                        with namespace.&lt;/li&gt;
                    &lt;li&gt;target overriding -
                                main build file takes precedence&lt;/li&gt;
                    &lt;li&gt;&amp;quot;abstract&amp;quot; targets - requires main build file implementation&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&amp;lt;subant&amp;gt;&lt;/strong&gt; task - Recurses tree
        &lt;ul&gt;
            &lt;li&gt;Two modes: 1) same build file in each sub directory 2) crawl
                a tree and run same build file on all subdirectories&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Can have &lt;strong&gt;targetless build files&lt;/strong&gt;. Everything outside a target gets executed
        before any targets&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&amp;lt;presetdef&amp;gt;&lt;/strong&gt; - Use the same task and optionally repeat. Define the options
        once, give it a name and refer to it later. Can override attributes later
        in the build.xml file. Only works for one task at a time.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&amp;lt;macrodef&amp;gt;&lt;/strong&gt; - bye bye antcall. Much faster than antcall - does all the
        same things
        &lt;ul&gt;
            &lt;li&gt;You can specify attributes and elements as part of the definition.
                Tasks are wrapped in a &amp;lt;sequential&amp;gt; tag.
                &lt;ul&gt;
                    &lt;li&gt;attributes are referred to in tasks using @{attribute}&lt;/li&gt;
                    &lt;li&gt;elements are simple placeholders using XML &amp;lt;element/&amp;gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
            &lt;li&gt;I could really use this stuff in AppFuse to replace the compile-module
                and test-module targets&lt;/li&gt;
            &lt;li&gt;&amp;quot;spawn&amp;quot; a new attribute on &amp;lt;java&amp;gt; - allows process to live past
                when Ant dies&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&amp;lt;scriptdef&amp;gt;&lt;/strong&gt; - allows you to use all kinds of scripting languages - i.e.
        Groovy, JavaScript, etc.
        &lt;ul&gt;
            &lt;li&gt;the project, attributes and elements are given to you - so you
                can easily grab them in the scripts&lt;/li&gt;
            &lt;li&gt;helpful to know Ant&apos;s API when writing&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;&amp;lt;antlib&amp;gt;&lt;/strong&gt; - componentizes definition of types and tasks
        &lt;ul&gt;
            &lt;li&gt;anything that defines stuff - put in antlib.xml (i.e. &amp;lt;taskdef&amp;gt;)&lt;/li&gt;
            &lt;li&gt;mostly designed for Ant task distributors because they can package
                an antlib.xml with a namespace&lt;/li&gt;
            &lt;li&gt;has root element
                    of &amp;lt;antlib&amp;gt; instead of XML
                &lt;ul&gt;
                    &lt;li&gt;xmlns:antcontrib=&amp;quot;antlib:net.sf.antcontrib&amp;quot; - brings
                        in all tasks into your project&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I really liked Erik&apos;s talk because AppFuse was inspired by his Java Development
    with Ant book. Its build.xml file was intially based on Erik&apos;s sample app
    and therefore, the first half of his talk pretty much pointed out tips and
    tricks that I&apos;m currently using. The 2nd half of his talk was highlighting
    the new features of 1.6 - which he&apos;s suggested I adopt in the past. I&apos;ve
    never had much desire (or time) to dig in and update AppFuse&apos;s build.xml
    file to 1.6. However, after attending his talk - it seems like it should
    be pretty easy to do. Good bye &amp;lt;antcall&amp;gt;, hello &amp;lt;macrodef&amp;gt;.
&lt;br /&gt;&lt;br /&gt;
&lt;strong&gt;Later:&lt;/strong&gt; One of the coolest things I saw in Erik&apos;s talk was how his Ant logging was color coded.  I asked him about it and all your need to do is specify &quot;-logger org.apache.tools.ant.listener.AnsiColorLogger&quot; in an ANT_ARGS environment variable.  Good stuff!</content>
    </entry>
    <entry>
        <id>https://raibledesigns.com/rd/entry/denver_s_no_fluff_just1</id>
        <title type="html">Denver&apos;s No Fluff Just Stuff starts today</title>
        <author><name>Matt Raible</name></author>
        <link rel="alternate" type="text/html" href="https://raibledesigns.com/rd/entry/denver_s_no_fluff_just1"/>
        <published>2004-11-12T09:11:55-07:00</published>
        <updated>2007-02-10T20:07:56-07:00</updated> 
        <category term="/Java/NFJS" label="NFJS" />
        <content type="html">It&apos;s time for another NFJS conference.  I &lt;a href=&quot;http://raibledesigns.com/page/rd/20040521#denver_s_no_fluff_just&quot;&gt;attended&lt;/a&gt; the one in June and had an awesome experience.  I doubt I&apos;ll cover it as much as I did last time, that&apos;s just a lot of work - not to mention my cell phone&apos;s data bill was $300!  As I look through the sessions, I&apos;m noticing that it&apos;s a great thing to attend 2 of these conferences - b/c you can skip all the sessions you saw the first time.  Since there&apos;s usually 2-3 good ones per time slot, reducing that down to 1-2 is nice.
&lt;br /&gt;&lt;br /&gt;
This afternoon, I&apos;m planning to attend sessions by Erik Hatcher and Stuart Halloway.  Erik for Ant 1.6 and Subversion (maybe even Lucene) and Stuart for &quot;dynamic, reflective languages&quot;.  Since much of AppFuse&apos;s build.xml is based on Erik&apos;s Java Dev with Ant sample app, it&apos;d be nice to figure out how to take advantage of 1.6 features (especially since &lt;a href=&quot;http://raibledesigns.com/page/rd?anchor=aren_t_out_of_container&quot;&gt;1.6.2 is required&lt;/a&gt;). I&apos;ve never seen Stuart speak before, but I&apos;ve heard he&apos;s excellent.
&lt;br /&gt;&lt;br /&gt;
Saturday I plan on learning more about Tapestry from Erik (in a 3-hour session!).  Since adding Tapestry to AppFuse is my next open-source development effort, this weekend and ApacheCon are good opportunities to learn more about it.  I know, I should just buck up and read the book (I made it to page 100 a couple of weeks ago, nothing since), but it&apos;s tough to find the time.
&lt;br /&gt;&lt;br /&gt;I&apos;ll probably skip out tomorrow afternoon and work on Spring Live since Chapter 10 is due by Monday and I&apos;m not done yet.  Sunday, I&apos;ll be talking about AppFuse making open-source easier.  &quot;Brain, get ready to be stuffed.&quot;</content>
    </entry>
</feed>

