File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes need help in understanding terms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need help in understanding terms" Watch "need help in understanding terms" New topic
Author

need help in understanding terms

Kari Gulbrandsen
Greenhorn

Joined: Feb 07, 2007
Posts: 4
Hi, I am trying to edit a paper on topics that include String, BeanFactory, and Inversion of ControlIt is a new gig for me, and I don't want to end up asking really silly questions, so I was wondering if I could run some by here ...
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,

Welcome to JavaRanch!

Sure. Fire away!


[Jess in Action][AskingGoodQuestions]
Kari Gulbrandsen
Greenhorn

Joined: Feb 07, 2007
Posts: 4
Well, the first one is that my sentence reads, "Spring is an excellent tool for integrating Invesion of Control in your application." I have looked at all the Wikipedia sites. I have looked at the Spring sites, and I still can't figure out why.

Is Spring a tool or a framework, and what about it makes it excellent for integrating IoC. And why is IoC important. Again, I have read about that -- but it doesn't make sense to me. I think that it changes control (control of what? Information?) from object-specific information to control that is not limited by a certain object. But I don't know if that is right, or how to change that into terms that somebody without a detailed understanding of IoC would understand.

And does Spring use a container for the beans (whatever they are in layman's terms), or does the Spring framework use a BeanFactory Container to manage and configure beans.

And then this idea of the Hollywood Principle, don't call me, I'll call you? and Dependency Injection and classes.

One form of IoC is Dependency Injection, or is a just a specialized form of IoC and how does it differ. And I have gone to Martin Fowler;s page. De couple dependent clauses?

Then there are setter based, constructor based, and getter based?

And why does a class look like code?

whew ... I think that is about it for now .. Believe me, I have looked and read. and I can usually understand tech info, but this is beyond me.

Thanks for any translation that you can offer.

I just want to understand this information, so I can be sure that I am editing it correctly and not changing meanings ...
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Spring is a framework, not a tool: http://www.springframework.org/ (Well, you could call it a "tool" in the more general sense of the word, but it isn't a program by itself just like other software tools).

Wikipedia explains what Inversion of Control is. Martin Fowler's article explains what IoC and Dependency Injection is: Inversion of Control Containers and the Dependency Injection pattern.

There's a lot of theory in these articles, and if don't have a lot of experience with object oriented analysis and design, then I can imagine that all that theory is difficult to understand. Maybe it's a good idea if you first study the more basic concepts of object oriented analysis and design before you try to understand all the advanced ideas.

The main idea behind Inversion of Control is that you let the framework handle the configuration of your program, and putting all your classes together to form a complete application, instead of the application doing that itself. Instead of writing a lot of "plumbing" code in Java to put together all the parts of your application, you just program the parts and you write a configuration file that specifies how these parts should be put together. The framework reads the configuration file and does the putting together.

One advantage of this is that it is more flexible - changing a configuration file to change the application is faster and easier to do than changing the code (which means you have to recompile all the code). Also, you just have to write a configuration file instead of a lot of cumbersome "plumbing" code (although Spring configuration files can get quite complicated...).

Decoupling is an important principle in software design, see this: Coupling (computer science). In general, when you develop a software system consisting out of several components, you want those components to be loosely coupled and not tightly coupled to keep the system less complex and more maintainable. When two components are tightly coupled, it means that when you need to change one of the components, you'll most likely need to change the other one as well - which means more work.

Dependency Injection is a technique used in combination with Inversion of Control to do the actual configuration of your program's parts. It is the mechanism which frameworks such as Spring use to put together the parts of your application.

"Then there are setter based, constructor based, and getter based?"

Those are just different ways to implement Dependency Injection in Java, as Fowler describes them.

"And why does a class look like code?"

I don't know what you mean by that question...


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Kari Gulbrandsen
Greenhorn

Joined: Feb 07, 2007
Posts: 4
Thanks very much for the help. I appreciate it. Is there a Java book for dummies? Or a Spring book for Dummies? <wry grin>.

What I meant by why does a class look like a code, was that I have, "Let's look at a class before it's been made IoC ready. Below is a Struts Action called ListUsers that depends on a UserDAO, which in turn requires a connection as part of its constructor." Then it gives a snippet of code, starting with

public class ListUsers extends Action {
public ActionForward execute (Action Mapping mapping,

and so on ...
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

"Why does a class look like code?"

A class is code. All code in Java is part of the definition of a class.

A class is like a mold or cookie cutter: cookies are made with a cookie cutter in the same way that objects are made from a class. The class (cookie cutter) defines what the objects (cookies) look like. To do anything at all in Java, you must define a class, and then, generally, you use that class to make objects. It's the objects that actually exist when the program is running, and do useful things.
Kari Gulbrandsen
Greenhorn

Joined: Feb 07, 2007
Posts: 4
Thanks Ernest. It still sounds like Greek, but I think I am making progress. Is there a good intro book on this? I lost the gig, but I think that it is something that I should know more about.

Thanks everybody for your patience.

K.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Around here, the beginner Java book is Head First Java. Check it out!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: need help in understanding terms
 
Similar Threads
WA #1.....word association
Cant use object from another class
Posting to bump up my count...
Text box value is not being completely filled with request attribute
The x900 effect ?