Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

AppFuse Refactorings Part I: Changing directory structure

I changed the directory structure of AppFuse's "src" and "test" directories this weekend. Rather than:

src 
  - common
  - ejb
  - web

I changed it to:

src
  - dao
  - service
  - web

The change wasn't too difficult, but the results of doing it make me a bit sick to my stomach. I always new that the Managers in AppFuse were dependent on Struts, that's why I originally put them in the src/web/**/webapp/service folder. Now that I've moved them into the service folder, they don't inherit all the luxuries like struts.jar being in the classpath. Even worse, to compile the Managers, I have to compile any ActionForms, both from the build/web/gen directory, as well as from src/web/**/Form. This is because the Managers use BeanUtils.copyProperties() to transfer values from POJOs -> ActionForms and visa-versa.

Ech - this exercise has really shown me how tied together the different directories and layers are. I think I liked it better the other way - or maybe I just liked not knowing how tightly integrated everything was. ;-) The most frustrating thing turned out to be that Ant's <javac> task wanted to re-compile the generated ActionForm's each time I I ran "ant compile-service". Adding an <uptodate> property fixed this problem, but it seems like it should be easier than that.

I ended up putting the org.appfuse.model package in the "dao" directory. It just made things easier - since the model.* classes are used in my DAOs and the "test-dao" needs the XDoclet-generating Hibernate mapping files. I didn't want to have to depend on classes in the src/service directory to compile src/dao. It's bad enough I have to do that with the service-web stuff.

All in all, I'm happy with the refactorings, but implementing workarounds for the service-web relationship was no fun. I probably did this when I originally created AppFuse, but since I haven't heavily manipulated build.xml in so long - I've forgotten the trouble I went through.

Oh yeah, I also integrated Spring for binding the layers and configuring Hibernate. And Charles' persistent cookie strategy? That's done too. I'll write up details on both of these refactorings in the next couple of days.

Posted in Java at Feb 03 2004, 03:56:27 PM MST 10 Comments
Comments:

Cool stuff. Bearing in mind the <em>&quot;dependencies go down, data goes up&quot</em>; paradigm, it makes sense to put the model-classes in the DAO directory. I'll be interested to read part II, III, IV and V ;)

Posted by Jaap on February 04, 2004 at 06:45 AM MST #

IMO, a single src dir makes more sense. You already have java packages that enforce directory structure. e.g. com.example.dao com.example.service com.example.web.action com.example.web.filter com.example.util etc.

Posted by Otis on February 04, 2004 at 01:29 PM MST #

You are correct Otis - it <em>does make more sense</em>. However, it's easier to test with the directory structure I have. This way, I can just point to a specific directory and say "run all the *Test.class" files in there. This is not something I came up with - I got it from Erik Hatcher's Java Dev with Ant book.

Posted by Matt Raible on February 04, 2004 at 05:28 PM MST #

The other benefit to separate source trees is that it's easy to specify different classpaths during compilation, and that may be the only way to prevent creeping dependencies.

Posted by Bear Giles on February 04, 2004 at 07:21 PM MST #

I agree with Otis. I think it'd be easier and make more sense to have two directories 'src/java' and 'src/test' with mirrored package directory structures. I picked this up from the OpenSymphony developers who have a great project structure (though ironically the code is often a bit scary).

Posted by Bo on February 04, 2004 at 08:41 PM MST #

struts_form.xdt org.appfuse.persistence.BaseObject -> org.appfuse.model.BaseObject

Posted by tiger on February 07, 2004 at 03:50 AM MST #

how do i get this flipping service off my computer? it has totally screwed up other web search engiones. i hate the damn thing it cant't find crap

Posted by susan elder on March 29, 2006 at 11:14 PM MST #

text tax teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Posted by 66.194.182.7 on April 15, 2009 at 07:19 PM MDT #

<script> onSubmit() { } </script>

Posted by 66.194.182.7 on April 15, 2009 at 07:20 PM MDT #

fsdfd

Posted by 66.194.182.7 on April 15, 2009 at 07:20 PM MDT #

Post a Comment:
  • HTML Syntax: Allowed