how to learn java using just the official apis? [closed] - java

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I learned php using just the website php.net, but I'm struggling to do the same with Java.
I would like to reach my php level with jsp and generally java, but I find the official docs way too much difficult to read, and if I have a task to accomplish it's quite impossible (to me) without googling and stackoverflowing.
I am wondering if it's normal, or I'm ignoring some secret about the APIs I should know.
I want to make an example: if I have to manipulate a string in a way, I look the PHP manuals for the string functions, and look for the ones I could use reading the brief description I find there.
But if I want to do the same with Java, ok, I know that there's the String class, but there are also an incredible amount of other classes, inherited classes, abstract superclasses, accessories, methods inherited from, interfaces, and I don't know what, that's impossible to read anything (if I'd try perhaps I'll learn Java in the following life).
So I have to rely to manuals websites and google, and find guides and tutorials which describe how to do a particular task (for example, connecting to a Tomcat server and manipulate a DB);
But I don't like to rely to external sources, I would like to find what I need at the source, as I had the experience of my php.net pages which are so precise and full of info and examples.
So? What am I missing?
I am quite sure there's a way to find the right info starting from the api. is it true? and how?

Welcome to the wonderful world of Java.
Yes, just for something like reading from a file, you have java.io classes for things like File, RandomAccessFile, FileReader, FileInputStream, DataInputStream, and BufferedReader (all slightly different and used for different purposes, often one stacked atop another). Then you have java.nio, plus the auxiliary classes like java.util.Scanner which are great to have but you need to be aware of first. For any package you'll want to use there's generally an interface, an abstract class, and then a factory to actually manufacture the instance (generally of a third-level derived class) you need to use.
No, reading the JavaDoc is not a great way to learn the language. Java is not as simple as PHP, for whatever reason (the word "enterprise" comes up often, and static safety is a big difference in the language core even without philosophical angles). It has strong advantages, but being able to learn it just from the APIs is not one of those pluses.
You should get a book - I recommend O'Reilly Publishers' products. There are also plenty of decent tutorials on the Internet for the taking. The raw APIs are more "I know which class I want to use, now what methods does it have?".

I don't recommend using the API unless you want clarification on how a particular object behaves, or how you can best manipulate the object for your purposes. The reason being, as you said, there are a lot of different objects that do very similar things, but with subtle differences.
The API is a reference to information about the language; exploring the Java Trails would be the ideal place to start.

Related

Best practices when learning a new API [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
When learning/working with a new API, does anyone have any tips for effectively learning it?
I currently make a bunch of get requests to understand what I can and cannot retrieve based on the API's responses. From that point I try to map out what is within the API and see what I can build out.
If you guys could share anything what you do that would be great.
The first thing i do is to read API documentation and search for examples in it. As you get used to read this kind of docs you'll find easier to find exactly what parts of the functionality you need to learn first.
I also use search engines to look for more working examples, and after that I work on creating a minimal use case of the API (for example write a file with commons-io api of apache). For this is a good idea to create a project with multiple JUnit tests with minimal use cases of an API (in the example of commons-io create a file, delete a file, move a file, copy a file, ...).
I must say this is not a science and each API is a new world and may require a slightly differnt approach (As with rest apis you'll need to use some tool like curl or postman to understand how to communicate with them, others will have pre-requirements like have a working installation of a system, and so on).
As everything in coding you'll need to do it by yourself and struggle to solve issues you'll find by yourself (what can take several hours of your free time).
There is no "magic" behind learning something, and coding is in some way like playing a musical instrument, it requires practice.
I dont know whether you are a beginner or you have developed already but will start from scratch..!!
Apis are the code which will allow you to play with the content having certain formats...!!
There are apis based on what operations you want to do are.
Get=> In order to fetch something.
Post=> In order to save something.
Put => to update something.
Delete => to delete something.
People also use patch similar to update...!!
You can play around all these by constructing objects and databases...!!
You will require rest services spring restful web service is the ultimate good options..!!
Diving deeper you need to be careful assigning the names you give I mean the meaningful names as you dont know if tomorrow you become famous and need to make your apis sharable ;)
Now some common concerns are like
Meaningful Name.
Versioning is required like what the old apis are working and now what data your apis give.
Can implement swagger its a tool which will allow you to describe the apis like you can write what this api does what type of data it brings etc etc..!!
Apis are more or less called an end points means you have that link as a connection between front end and backend So need to keep it secure..!! By authentication.
Above four points are considered to be good practises for writing apis ;)

Learning Java so I can get at clojure [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I have a history of hating Java, having used it pretty regularly in the late 90's during the 'slow as balls' era. As such, I never really learned it well. From what I understand, Java is actually a pretty good language to use these days. I've been thinking about diving into it because of Jython and Clojure. That is to say, I'd like to program in Java and use inline Jython or Clojure where appropriate. But truthfully, I'll probably just be programming in Jython/jRuby and calling up clojure from there.
Which brings me to my question. I know both of these languages can be called from Java, but is that necessarily good practice? Should I even bother learning java if I just want to use Jython as the primary language? Seeing as how that's a large part of my motivations here, I'd like to know that I'm not terribly misguided before jumping in. I'm aware there is a very high risk for projects to become a kludge if done in multiple languages like this.
I'm still learning about the JVM and the like, so I apologize if this question is painfully obvious.
Jython can be viewed as a cross compiler from Python to the Java Virtual Machine. As such, to get the most out of Jython you'll obviously have to learn Python, and probably will need to learn Java.
You can skip some of the Java learning, but at the end of the day, Java and the JVM grew up together. That means that Java code tends to lend understanding of the JVM. It is possible to gain understanding of the JVM without Java, but that's not a path well travelled. Any Jython code that imports a Java library will immediately have you searching Java documentation, so if you avoid leaning Java you're going to learn it piecemeal anyway.
You will have to decide if a piecemeal approach or a formal approach is more appropriate for you and your situation. A lot of deciding which path to take is knowing how you learn best.
As far as the "slow as balls" period of the 90's, that's when I was learning Java. Personally, I feel it is better to describe it as "slow as balls if you did incredibly stupid things with Java". Now I think people have built up a sufficient skill set to avoid translating C directly into Java. That said, I do occasionally encounter the 2000+ line method, so perhaps I'm being a bit rosy in my projection. The entire JVM is laid out in such a manner that good object oriented code runs faster, and if you're constantly trying to go to "other" objects for all the data you need locally, you'll just stack thrash the JVM.
Regardless of opinions, the JVM is now the hot Java item. There has been "other language" support by one means or the other for over a decade now; however, the excitement around Domain Specific Languages seems to have sparked an interest in compilation technologies and the JVM. The other languages benefit from the JVM being an easy target to hit with built-in cross platform support, excellent performance, huge availability of libraries, and generally good documentation. Learning Java and the JVM will help you with a lot of the JVM supported languages, as many of them don't flesh out their library space in favour of hooking into a pure Java library.
I'd say it's worth knowing Java even if you plan on only using other JVM languages. I use JRuby and Scala, and have played around with Clojure. If you are building things to run on the JVM, knowing Java is a bit like knowing C when working natively–you don't have to know C, but if you do, you can write the bits that need speed in C and wrap them in a Ruby or Python library or whatnot.
It's worth knowing the basic principles of how Java works in terms of things like interfaces and annotations and how the classpath works because otherwise you are working with basically a leaky abstraction. What happens when your interop isn't very good? This is especially true if you are planning to do Clojure and Jython!
The other reason to know Java is simply because if you are using code in the Java ecosystem, you have to be able to read and write Java. You need to write a library? Yes, you can probably write it in Clojure, but if you want other JVM language users to be able to use it, you should probably have written it in good, idiomatic Java. Scala is close enough to Java for this purpose; Clojure or Ruby or Python, not so much. Just being able to read and comprehend Java programs is very important too.
The other great benefit is simply that you get more libraries and they are better tested. You need a double-ended queue? Check the Java Collections Framework. Good random number generation? java.security.SecureRandom. UIs? Well, Swing, AWT and SWT are... okay, bad example. Knowing the benefits and shortcomings of these only comes from doing some Java programming and learning the various ways not to suck at Java.
From a couple of years experience of using Clojure (plus many more years of Java...) here is my perspective:
You don't strictly need any Java experience to write Clojure code - Clojure is a full language in its own right and you can write perfectly capable programs without using any Java.
You will need to set up the JVM environment - the Java environment has some rules about where code gets loaded from (i.e. the "classpath") that need to be followed to get a working environment. Not a big deal, and most IDEs will do it for you, but it can be a hurdle for people completely new to the JVM world. I'd suggest careful following of the setup instructions for whichever IDE/toolset you choose.
There are some Java-related concepts that are helpful to understand - for example, Clojure harnesses Java exception handling features with (try ... (catch ...)) etc. so it's useful to be somewhat familiar with the Java approach to exception handling.
Ultimately you will probably want to use Java APIs - bacause a huge amount of the value of being on the JVM in the first place is in having access to the huge diversity of libraries and tools that are available in the Java ecosystem. You don't need to write any Java code to use Java APIs from Clojure, but you do need to know enough Java (method signatures, data types etc.) to be able to read the JavaDoc documentation of the APIs and convert this into an appropriate Clojure function call. Often, this is as simple as (.someJavaMethod someJavaObject param1 param2) but sometimes it can be more complex (e.g. when you need to instantiate a subclass of some Java class to pass as a parameter)
Java isn't a bad language to learn anyway - while I'll readily admit Java has some weak points (as do all languages!), it's still a great, simple, high performance, cross-platform, object-oriented language that has a lot of value. Even if you only do a few short tutorials and never write anything substantial in Java, I'd still recommend it for the learning experience.
I believe most of the above would also apply to Jython.
I can't speak for Jython, but if you want to really get to grips with clojure, you want to understand its trade-offs compared to Java, especially wrt memory/gc and the basics of Clojure/Java interop. You also need at least an abstract understanding of how the clojure collections are implemented unless you really don't care about performance - that's not to say that clojure is particularly inefficient, but more the opposite: the implementation of its immutable collections is fairly unique and tailored to clojure's stance on persistence and performance and it helps to understand the underlying details when you're trying to improve on performance issues.
For all of that, I don't think you actually need a lot of Java knowledge. Being able to read Java fairly well, a basic understanding of the concepts, and a knowledge of where to find the documentation is probably enough.
I think if you want to do a hybrid Clojure/Jython project the interoperation details are most crucial. That probably means you have to know in some detail how classes, interfaces, some of the standard library and (to a minimal extend) generics work in Java and how to deal with all of those in your chosen languages since the interoperation necessarily reduces to the more basic Java constructs. Some of this is tricky and can be confusing, and in clojure's case at least the documentation often refers back to Java concepts and documentation for obvious reasons, so you have to make sure you read both, closely.
I would definitely learn java and learn it well, not only because Clojure is built on top of the JVM but also to get anything done you will be calling Java libraries all the time, and you may even need to dip into Java occassionally.
On another note it would be expand your mind to understand Java's OO concepts and pain poaints too and this will enhance your undersatnding of Clojure too.
Above all, study the Java libraries. Part of the joy of using the JVM is having access to "it's already been done" libraries, as well as to parts of the core language that accomplish certain tasks with optimum performance on the JVM. In addition, some languages (e.g. Clojure) purposefully dip directly into Java and don't completely discourage it in your own code, so if you want to be able to read others' code Java basics are a must.
As for the rest of "learning Java" (design patterns, concurrency in Java, etc.), I wouldn't waste your time unless/until specific projects requirements demand it.

asm / C / Python / Perl / Lisp / Scheme Programmer looking for something new to learn [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I need to have an at-home project now that I'm working on Python/Django at work. I'd like to learn something new, so I was thinking of checking out Java.
What's the most well respected web framework for deploying Java web apps?
The only reason I'm not checking out ruby on rails is because of how similar the ORM and other parts are to Django.
Alternatively, does anyone think I should take a look at seaside/smalltalk? Can anyone explain why I should?
Haskell is something I'll consider if anyone can make a good argument for it. I'd need a web framework and database access library to go along with it though.
I'd consider factor/forth if I wasn't so accustomed to the stack paradigm via x86/asm. I'd be willing to hear any counter-arguments to this as well.
See also: http://www.reddit.com/r/programming/comments/9v3uf/asm_c_python_perl_lisp_scheme_programmer_looking/
With that range of skills, why don't you learn something more outside your comfort zone, like carpentry or painting, or any of hundreds of other skills that have little to do with your field.
At some point, all languages are the same and you'll get scant benefit from learning another.
Whereas, with something totally different, you will become a much more well-rounded individual. I, for one, like painting and golf, even though I'm not that good at either of them - when I asked my golf instructor what my handicap was, he said it was an inability to hit the ball straight :-)
I find that I enjoy doing stuff I'm not accustomed to since it's a genuinely new experience. Learning another computer skill is a easy thing to do after a while and hence the pleasure from doing it is reduced.
Don't get me wrong, I like to keep up with developments in the field but, for the most part, the brand new technologies give nothing to my career since most work I do is on stable technologies. You may be in a different situation.
Haskell is pretty popular these days as a mind-bender, though it may not hurt as much for you if you already know Lisp and Scheme. It's purely functional, so there are no side effects to anything. You have to use monads to print text and do other things that require a certain order. It's also completely lazily evaluated, so you can make infinite lists in Haskell and not have to worry about memory consumption.
The Haskell Platform may not be fully complete, but is intended to be a portable set of libraries for Haskell. It's list of packages includes some for CGI handling and (X)HTML generation.
Sounds like you're into web programming, so smalltalk/seaside is a great one. IMO everyone should learn smalltalk even if they never use it, and seaside is a really different web framework than what you are used to. Django, fer instance, is all about REST, while the seaside philosophy basically says "to hell with REST."
And if you've never coded in an image based environment there's just something about it that seems... natural, magical even. Lots of IDE functionality that originated in smalltalk have been implemented in file based language IDE's, but it always feels like an unnatural grafting, where those same features feel as if they simply belong there in smalltalk.
Check out Pharo. Give it enough time to get used to the fact that there's no menu bar and see if it doesn't grab you.
I do suggest Java. When I was looking for a job, I noticed lots of openings for Java developers, so there's a lot of it out there, and you might someday have a chance to use your Java skills.
And then you should try out Scala. Scala is a sort of Python-ish language that uses functional programming to make very scalable programs. Unlike Python, in Scala you do need to declare types of things. Scala runs on the Java Virtual Machine so it can be used in Java shops.
http://www.scala-lang.org/
It's possible I'm just giving you this answer because these are the next two languages I intend to learn, myself.
You probably should also spend a little time playing around with Javascript. Javascript was sort of intended to be a "stealth Lisp" and I imagine you would pick it right up.
http://www.crockford.com/javascript/javascript.html
http://bc.tech.coop/blog/030920.html
And heck, have some fun with it. Write a game or something!
From your list I'd say you are due for a completely object oriented language.
You could check out Ruby, but I'd recommend JavaScript since it offers a lot of interesting things you probably wouldn't expect, like support for closures, higher-order functions and prototypical inheritance - plus it's kinda fun and becoming very popular.
I'd need a web framework and database access library to go along with it though.
If all your programming is based on web frameworks and SQL databases, you will only be solving the same problems with different syntax if you switch languages.
Build something using a different data model - Prolog, Conceptual Graphs, RDF, Linda/JavaSpaces, XQuery, HDF5, ASN.1, or a different network model - XMPP pub-sub, SNMP, a zero-config mesh or a swarm of ZigBee enabled Arduinos.
Maybe look at languages like Oz, Io or Erlang/OTP, which are distributed rather than primarily monolithic like the ones you mention.
What about the Java Spring framework?
http://www.springsource.org/
Or maybe NHibernate?
http://en.wikipedia.org/wiki/NHibernate
At the end of the day its up to you. As I only listed two out of many. When I am programming a static language professonally... I try to learn a dynamic or scripting language. And vice versa.
Also, I try to learn something totally different or outside my realm... maybe even Powershell or Korn shell or ActionScript.
What's the most well respected web framework for deploying Java web apps?
There is no single web framework more respected than others. Struts2, Spring MVC, Stripes or Wicket (which is event based) are all good candidates (I personally like Stripes). But you'll need a bit more for the persistence (Hibernate or JPA) and for the glue (Spring).
Grails (Groovy on Rails) is another good option.
Alternatively, does anyone think I should take a look at seaside/smalltalk? Can anyone explain why I should?
Well, I guess that learning Smalltalk can't hurt but I don't see a good reason to choose Smalltalk over a moderner language like Java. Regarding tooling, I don't know anything in this field except VisualAge for Smalltalk but, personally, I'd really stay far away from it.
Haskell is something I'll consider if anyone can make a good argument for it. [...]
Looks like I'm not the right guy for that.
I'd consider factor/forth if I wasn't so accustomed to the stack paradigm via x86/asm. I'd be willing to hear any counter-arguments to this as well.
Same as above.
I would have suggested mastering Lisp (in some relevant dialect) so even if you have Lisp and Scheme on your resume, it might be worthwhile to REALLY learn deeply. See http://www.paulgraham.com/avg.html for reasons why.
Otherwise Prolog might interest you. It is related to SQL but for programming instead of communicating with an organised set of data tables.
If you want to target web technologies I only have experience with Java. Here the newest Java Server Faces (JSF) allow for using Ajax to update pages, and Google Web Toolkit allow for very rich component based web pages. These might be juicy enough to interest you enough to learn enough Java to find them fun :)
I don’t see C# and the .NET platform on your list. And I am surprised no one mentioned it yet.
I have worked in C# for 5 years. I have looked at some Java code but I have never coded in it. I believe that Java is somewhat similar to C# enough so that if you become proficient in one I think you could pick up the other is a matter of a few days.
One idea might be to create your own language / compiler. The one I would like to create (or see created) would be an Assembly Language level compiler with an object oriented syntax that would be very much like Python… but make it typed language. You could start with the basic raw binary types db, dw, dd, and then add on to these … The functions and methods could have assembly language freely mixed in the high-level code. Now, that would be a fun project, I think ?
Definitely try Haskell or Smalltalk or Forth.
I would say Smalltalk would be most useful while Forth would get you away from the x86 asm and C bullshit. There's more than one way to code close-to-the-hardware stuff.
Why don't you try OCaml? And if you ever happen (sadly) to return to .NET world - you will have knowledge of F# in your baggage.

Does a Java to C++ converter/tool exist? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I always asked myself if it would be possible to make a Java to C++ converter.
Maybe a tool that converts the Java syntax to the C++ syntax?
I am aware that the languages differ, but simple things like loops where the semantics match 1 to 1.
Is there such a tool? Or is it possible to make one?
It's possible to do anything given enough time, money and resources. Is it practical? Beyond trivial examples not really. Or rather it depends on what constitutes an acceptable error rate.
The real problem is that the idioms are different in Java to C++. Java to C# for example would actually be far easier (because the idioms are much more similar). The biggest of course is that C++ has destructors and manually managed memory. Java uses finally blocks for this kind of behaviour and has garbage collection.
Also Java has a common Object supertype. C++ doesn't.
The generics to templates would be nigh on impossible I would imagine.
The Firefox HTML5 parser is written in Java and converted to C++. But I think the converter used there is quite specific for this project. Interestingly, it turned out the resulting C++ parser was faster than the old parser written in C++.
I'm also writing a converter as part of the H2 database, under src/tools/org/h2/java. The idea is to allow converting a subset of the H2 database to C++, so this is also not a general purpose translater.
And there is the open source project J2C.
So there are ways to convert Java to C++. But don't expect the translator support all features, and don't expect the resulting code to be any faster than a good Java JVM.
Is is possible, no question, but it won't be so simple. It would be a Java compiler which generates C++.
If you want to do that from scratch, it will be very hard, you have to do all the work javac and the JVM do for you (e.g. garbage collection).
Btw. Google has a Java to JavaScript compiler (included in GWT)
There is one, bit I am not sure if it actually works.
Java to C++ Converter-Tangible Software Soulutions.
It is weird how there are c++ to java converters, but only 1 java to c++ converter.
As said it would be tough to convert Java to C++ but we can have an applicaiton or tool that generates code in Java and equivalnet C++ code.
I know one applicaiton which generates code in C++/Java/C# given a model which has its own way to deifine it.
That tool belongs to CA and name is CA Plex.
Search on www.ca.com
There are programs out there that claim they can do this, but none have gained enough popularity to be frequently mentioned, so we'll leave them at "attempts". Making a converter would require a lot of AI built into your program. The difficulty is increased tenfold when swing is involved because GTK/wxWidgets/Qt/win32 API all differ greatly from swing. But it is possible. Not that the code quality will be great, and no guarantees your program won't crash due to separate memory handling methods, but it's possible.
The main issue is that java is a language that is written and designed to talk to a VM. I suppose it would be possible, but all you would be left is a very poorly optimized application with a self translating layer doing what the VM already does. I mean, sure, it is possible, it still wouldn't be a solution for anything i could think of. If your looking to make your sluggish java app native, maybe your thinking too hard, just use an application like JET, its actually quite good, and will give you the benefits a native app would bring. Of course if the VM is already doing what the app is asking it to do just as well as native code could(it happens.. sometimes :P) it might change nothing.
Java to c#, tho, sounds more reasonable, as both the languages are written in similar ways, talking to a framework as such, but this would still leave code very much unoptimized as code written from scratch for a particular framework can not be bested.
http://www.tangiblesoftwaresolutions.com/Order/Order_Upgrade_Instant_CPlus_Java_Edition.htm
Depends on the domain of where the code will be used, from a learning perspective perhaps it might be interesting.
i just found this via a google as I remembered seeing one in Univeristy that created code based on uml.
Java to C would actually be the easiest. Remember you need to convert the language, If you do that, the required libraries can be converted by your new compiler. In other words Swing and AWT should not be a big problem...
I would start by taking a good look at the Java Native Interface (JNI). The JNI is a part of java which allows it to be used with C and C++. The reason I would start here is that it becomes fairly obvious how parts of Java may be implemented in C. Once I had a grasp on basic structures, like how Java Objects can be mapped onto C structures (struct) and how pretty much everything in Java is an Object including arrays, I might peek at the Open JDK source code.
The actual converter would have to convert all the imported Java libraries (and their imported libraries and so on...) which means you would need the source code for everything. This conversion no small task since the Java libraries are large.
The process would be time consuming, but no AI should be required. However, I see no reason to perform a conversion like this. It looses the portability of Java and would not gain the efficiency of C (except that it would be compiled to native code, but it would be better to compile the machine code directly from the Java).
Something neat would be a tool , that translate java to "C++ using Java API" (like GNU GCJ CNI), one problem remain is to manage array.length (array not vector) ...

What is a MUST COVER in my Groovy presentation? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm working on getting an Introduction to Groovy presentation ready for my local Java User's Group and I've pretty much got it together. What I'd like to see is what you all think I just have to cover.
Remember, this is an introductory presentation. Most of the people are experienced Java developers, but I'm pretty sure they have little to no Groovy knowledge. I won't poison the well by mentioning what I've already got down to cover as I want to see what the community has to offer.
What are the best things I can cover (in a 1 hour time frame) that will help me effectively communicate to these Java developers how useful Groovy could be to them?
p.s. I'll share my presentation here later for anyone interested.
as promised now that my presentation has been presented here it is
I don't know anything about groovy so in a sense I've qualified to answer this...
I would want you to:
Tell me why I would want to use Scripting (in general) as opposed to Java-- what does it let me do quicker (as in development time), what does it make more readable. Give tantalising examples of ways I can use chunks of scripting in my mostly Java app. You want to make this relevant to Java devs moreso than tech-junkies.
With that out of the way, why Groovy? Why not Ruby, Python or whatever (which are all runnable on the JVM).
Don't show me syntax that Java can already do (if statements, loops etc) or if you do make it quick. It's as boring as hell to watch someone walk through language syntax 101 for 20min.
For syntax that has a comparible feature in Java maybe show them side by side quickly.
For syntax that is not in Java (closures etc) you can talk to them in a bit more detail.
Remember those examples from the first point. Show me one, fully working (or at least looking like it is).
At the end have question time. That is crazy important, and with that comes a burden on you to be a psuedo-guru :P.
I'm not sure about how the Java6 scripting support works but I'm fairly sure it can be made secure. I remember something about defining the API the script can use before it's run.
If this is the case then an example you could show would be some thick-client application (e.g. a music player) where users can write their own scripts with an API you provide them in Groovy which allows them to script their app in interesting and secure ways (e.g. creating custom columns in the playlist)
I'd go for:
Closures
Duck typing
Builders (XML builder and slurper)
GStrings
Grails
I'd mention the following things in addition to what has already been stated:
GDK - extensions/additions to existing JDK classes
Interaction between Groovy and Java code (basically a non-issue)
Compiling Groovy code to Java .class files
XML parsing and mechanisms for accessing document content
One thing I like doing with Groovy is implementing an interface defined in Java as a map from method names to closures. It's a cool thing you can do with Groovy, but probably well beyond an introductory presentation though.
Include an example of how making Java code more groovy takes away soooo much code. Wait for them to pick their jaws up off of the floor before continuing. Scott Davis has a simple example at the beginning of Groovy Recipes that takes 35 lines of Java or 3 lines of Groovy.
You should definitely show them how to create a quick Grails application. Two domain classes that are related. Build a basic CRUD app. Explain that tables are being created behind the scenes using GORM(Hibernate). Then explain that you can create a war file and deploy it as you would any other Java war file. You can also add Grails/Groovy to an existing Java/JSP project so it doesn't require a huge commitment or paradigm change.
Groovy/Grails is simply Ruby/Rails for Java people. I'd cover the plugins for Netbeans/Eclipse too. Groovy/Grails are just now getting full support in the major IDE's.
Finally, if you can find a good diagram that shows how Grails is built on top of Spring, Hibernate, Quartz, Sitemesh and Groovy, I think people will understand that there is a treasure chest waiting to be unlocked.

Categories

Resources