Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NIO prohibited for SCJD project? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NIO prohibited for SCJD project?" Watch "NIO prohibited for SCJD project?" New topic
Author

NIO prohibited for SCJD project?

George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi all,
Originally posted by Colin Richardson:
I've only just started looking at SCJD certification (I'm just finishing my preparation for SCBCD). However, I have bought Max's book and seen that it deals with NIO. But I also looked at Sun's Certification web site for SCJD, which lists the following restrictions.
The following APIs and facilities may not be used:
Enterprise JavaBeans
Servlets, JSP technology, or any other web-oriented APIs
NIO, the New IO facilities
Java DataBase Connectivity (JDBC) and SQL
Java IDL API and CORBA
Third party software libraries or tools (such as browsers)
Is this now out of date? Do you get instructions that allow NIO when you download the assignment?

Good catch. It's good that someone actually read the information posted at Sun (here's the link: http://suned.sun.com/US/catalog/courses/CX-310-252A.html). I guess now I'm not sorry I didn't use NIO.
The assignment instructions don't mention NIO one way or the other. I suspect many people aren't aware of this restriction (including the people grading the exam).
Thanks for pointing this out.
Any comments?
-George


Regards, George
SCJP, SCJD, SCWCD, SCBCD
Jacques Bosch
Ranch Hand

Joined: Dec 18, 2003
Posts: 319
Feeeeeeeuuuuuuuu.
Also glad I didn't use nio.


Jacques<br />*******<br />MCP, SCJP, SCJD, SCWCD
YungSheng Chang
Ranch Hand

Joined: Jul 28, 2003
Posts: 44
really?
Is there anyone who uses nio and passes?
I wouldn't like to make such a major change before submission, indeed.


I play Java for fun.<br /> <br />SCJP / SCJD / SCWCD / SCBCD
George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi YungSheng,
Originally posted by YungSheng Chang:
Is there anyone who uses nio and passes?
I wouldn't like to make such a major change before submission, indeed.

I think there have been people in the past who have used NIO and passed. This raises a number of questions:
1) Is this a new restriction?
2) When did the restriction become effective?
3) Is the restriction being enforced?
4) Why didn't anyone on the forum know about the restriction?
If you're already using NIO I would wait a little while, before either submitting or removing NIO from the code, until we have some answers to these questions. If you're just planning to use NIO, then I would seriously re-think those plans. Even if NIO is not strictly prohibited (although it seems to be) I think it's pretty clear that it's not recommended for the assignment.
Hope this helps,
George
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Hm..this is new to me. I'll drop Steve a note and see about it.
M


Java Regular Expressions
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Holy crap. Im about to submit and I used NIO. If it isnt allowed it SHOULD have been on the specs. This will totally naff me off if its confirmed


Morgan
SCJP (1.4), SCJD (1.4), SCWCD (1.3), SCBCD (1.3)
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Hey Morgan,
What NIO bits are you using? I remember a conversation with Steve about a year ago in which he indicated that the graders had no guidelines for using NIO sockets and such, but I don't believe that they were ever banned.
M
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Im using FileChannels and ByteBuffers
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
As a FYI, so did I, and I had no problems whatsoever. I'll check ASAP.
M
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
The NIO restriction was certainly added since I read that information last May (2003)!


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Im sorry but its outrageous to NOT list restricted APIs in the assignment itself. They specify what RMI you must use, they specify you must use SWING components rather than AWT components. Ill be bloody livid if I have to alter my code at this stage. I though i had the coding out of the way. Im busy making the javadoc comments look sexy!
Satish Avadhanam
Ranch Hand

Joined: Aug 12, 2003
Posts: 697
Hi all,
Is the java.nio package alone is restricted or all other packages that starts with java.nio.channels, java.nio.charset etc are prohibited?
If all are restricted, then we cannot use FileChannel right?
Please clarify me. Thanks.
George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi Satish,
Originally posted by Satish Avadhanam:
Hi all,
Is the java.nio package alone is restricted or all other packages that starts with java.nio.channels, java.nio.charset etc are prohibited?
If all are restricted, then we cannot use FileChannel right?
Please clarify me.

If you accept that these restrictions posted on the Sun site are accurate (and if they're not accurate they should be removed):

The following APIs and facilities may not be used:
Enterprise JavaBeans
Servlets, JSP technology, or any other web-oriented APIs
NIO, the New IO facilities
Java DataBase Connectivity (JDBC) and SQL
Java IDL API and CORBA
Third party software libraries or tools (such as browsers)

then it seems to me that anything related to the NIO (that is any package starting with java.nio) is prohibited and that would include the FileChannel class.
If you have your heart set on using FileChannel I wouldn't abandon that hope until we hear some confirmation from Sun. However, I think it's true to state that NIO is not required for the assignment, and if the document quoted above is to be believed, it's certainly not recommended either.
Hope this helps,
George
Satish Avadhanam
Ranch Hand

Joined: Aug 12, 2003
Posts: 697
Thanks George. Appreciate your help.
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Originally posted by George Marinkovich:
Hi Satish,
If you have your heart set on using FileChannel I wouldn't abandon that hope until we hear some confirmation from Sun. However, I think it's true to state that NIO is not required for the assignment, and if the document quoted above is to be believed, it's certainly not recommended either.
Hope this helps,
George

Its more an issue of already done it and was in the final stages of submission I used NIO partly because its supposed to be more efficient, partly because its probably one day supposed to replace IO, but mostly so I could say that id used them. I saw this assignment as a good place to add that particular package to my own list of things "Im experienced with".

Now i cant motivate myself to finish the documentation because I havnt even started considering how and if it affects my design at all.
Jay Bromley
Ranch Hand

Joined: Aug 09, 2003
Posts: 48
Aaargh!
I'm using NIO and I thought I was within a couple of weeks of submitting. Now, I'm not so sure. I have to agree with Morgan and say that it's crazy that they don't tell you about such restrictions in the assignment itself. My assignment (Bodgitt & Scarper 2.1.2) says :

Use of Standard Elements
Use of functionality provided by the core Java classes will be preferred to your own implementation of that functionality, unless there is a specific advantage to providing your own implementation.

and

Restrictions on RMI
To avoid unnecessary complexity in the marking environment certain restrictions are placed on solutions that use RMI. Specifically:
# You must not require the use of an HTTP server.
# You must not require the installation of a security manager.
# You must provide all classes pre-installed so that no dynamic class downloading occurs.
# You must use RMI over JRMP (do not use IIOP)

and

The user interface for this assignment must satisfy the following criteria:
* It must be composed exclusively with components from the Java Foundation Classes (Swing components).

but nothing at all about what I can use for I/O. I thought core Java packges meant packages java.*, so my reading was that java.nio is part of the core Java classes and so should be good. I thought that the other things mentioned (EJB, Servlets, JSP, etc.) are all part of the javax.* package hierarchy and so naturally are excluded by the first quote. The fact that the exception for JFC (javax.swing.*) was explicitly made seems to support the idea that anything in java.* is fair game.
So I guess it comes down to what takes precedence, the info on Sun's website or the assignment itself. I'm going to try to get some info from Sun about this. I'll report back.
Regards,
jb
George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi everyone,
Someone (with a stake in the answer) should email Sun and get some guidance about whether NIO can be used on the project. Something along the lines of:

Dear Sun,
Can I use NIO (the new Java IO facilities) in coding my SCJD project?
My assignment instructions do not explicitly prohibit using NIO, but I noticed the following posted at the Sun site (http://suned.sun.com/US/catalog/courses/CX-310-252A.html) that seems to prohibit using NIO:
Can I use NIO or not?
Thanks for your assistance.
signed Anxious Candidate

Hope this helps,
George
[ February 12, 2004: Message edited by: George Marinkovich ]
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Big M said he would go talk to a friend. I think we are waiting to hear from him. None of us specifically want to recieve the crappy news via email. We want someone to announce it here so we can explode for a few days before finally contacting Sun and giving them our constructive feedback. You know like: please run your own dropDead(System.currentTimeMillis) method please!
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
"Big M?",
yeesh, a guy puts on a few pounds...
M
George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi Morgan,
Originally posted by Morgan Bath:
Big M said he would go talk to a friend. I think we are waiting to hear from him. None of us specifically want to recieve the crappy news via email. We want someone to announce it here so we can explode for a few days before finally contacting Sun and giving them our constructive feedback. You know like: please run your own dropDead(System.currentTimeMillis) method please!

I share your frustration (and that of others) over the fact that this information wasn't included in the assignment instructions. There are a number of things that are a bit frustrating about the assignment. For instance, the assignment instructions don't say what name to use when you submit your project jar file. The assignment instructions don't say that you have to ask for permission to perform the upload. The fact that Sun don't notify you be email when you project has been graded. If I was grading Sun on General Consideration I would have to deduct 65 points out of a possible 100.
However, it's possible that the reason for this restriction (if it's really an enforced restriction) is to reduce the complexity of the assignment, similar to the restriction on using a security manager for RMI. I think the project is supposed to be simpler than many of us are making it. After all, it's only supposed to take two weeks to finish the assignment. :roll:
Hope this helps (but I realize it probably doesn't)
George
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
The FileChannel part of NIO is bog simple. Not just the method use etc, but the mentality behind it. The only thing I can imagine is the graders dont know NIO .... and then I have to say they really should not be there grading Java 1.4 developer assignments
Werner Joerling
Ranch Hand

Joined: Mar 23, 2003
Posts: 35
Hello
during my tests I could observe that NIO does not work correctly when the database file resides on a network drive. In some constellations changes do not get persistent.
Maybe that is the reason to exclude NIO. But I will use it anyway.
Werner
[ February 13, 2004: Message edited by: Werner Joerling ]
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
NIO doesnt work?? Seemed to work just fine for me
Werner Joerling
Ranch Hand

Joined: Mar 23, 2003
Posts: 35
Originally posted by Morgan Bath:
NIO doesnt work?? Seemed to work just fine for me

Please see:
http://developer.java.sun.com/developer/bugParade/bugs/4938372.html
My solution seems to work similar. I do not access overlapping regions
and I could observe it only with samba/Windows network drives and Windows as client.
The IO exception only appears on WinXP (together with an OS popup). With Win2K there is neither an exception, nor a popup, but changes aren't persistent.
Werner
[ February 13, 2004: Message edited by: Werner Joerling ]
Jay Bromley
Ranch Hand

Joined: Aug 09, 2003
Posts: 48
Hello all,
On Thursday I sent an e-mail to Sun along the lines suggested by Mr. Marinkovich (but perhaps a little bit more verbose) and I have yet to hear anything. I know it's only been a day and they're busy, I'm just a little bit concerned, I used NIO and was quite pleased with my efforts until I saw this thread. Many thanks to Colin and George for starting this thread, conceivably it could save some of us who used NIO from disaster.
In any case, as soon as I hear back I'll post back here with the news.In the meantime, I'm just chilling and going on with the business of finishing this thing.
Regards,
jb
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
This restriction, if it really exists, has other ramifications. For example from the 1.4.2 API JavaDocs:


The Charset class is in java.nio !!
[ February 14, 2004: Message edited by: Barry Gaunt ]
[ February 14, 2004: Message edited by: Barry Gaunt ]
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Barry ... how the hell did that little gem stick in your mind? You read the 1.4.2 specs before bed or something?
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Barry,
As you state yourself, it's possible to support charsets without using the java.nio.charset.Charset class:
Through the String constructor String(byte[] bytes, String charsetName) and the String method byte[] getBytes(String charsetName).
Both are available from JDK 1.1 while java.nio.charset.Charset is only available since JDK 1.4. So, IMO, using them instead of the Charset class doesn't break the "don't use NIO" requirement, if any.
Regards,
Phil.
Lance Ewing
Greenhorn

Joined: Feb 15, 2004
Posts: 5
Thought this statement from the top of that Sun web page might be of interest:
"These notes do not form any part of the actual assignment, and if you find a contradiction between these notes and the actual assignment instructions, you must adhere to the instructions in the assignment documents."
My assignment says that the application should have no dependencies on any libraries other than those of the Java 2 Platform. I assume they mean the J2SE, in which case things like EJBs, JavaMail, JSPs, servets, etc. are automatically ruled out. So I was planning to use the new logging functionality in 1.4, mostly for my own debugging, and also whatever I could from NIO. That was until now. I am already using SocketChannels, but I'll have that switched back to Sockets by the end of tonight I'd imagine.
I just can't believe that they would place a restriction on NIO. I was wanting to use it for the same reason already mentioned here, that it is valuable experience in using the new APIs. They encourage use of the JDK over re-inventing the wheel, so why have a specific restriction on a part of the JDK?
I am eager to hear what you find out.
Werner Joerling
Ranch Hand

Joined: Mar 23, 2003
Posts: 35
Originally posted by Werner Joerling:

... there is neither an exception, nor a popup, but changes aren't persistent ...


I modified my NIO solution and now changes are made persistant on smbfs network drives, too.
But I made another observation. W2K does not update the last-modified-date/time of the database file on local drives.

Werner
Jay Bromley
Ranch Hand

Joined: Aug 09, 2003
Posts: 48
Lance,
Good eye! For me that resolves the issue. My assignment says nothing about not using NIO. Still, it will be interesting to note what Sun says, though after reading this little bit (I don't know how I missed it before ) I don't see that Sun could say don't use NIO.
I'm breathing easier.
Thanks,
jb
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Ive emailed them. But if they say I cant use NIO im gonna have a hard time not getting anal with them. Ill wait till AFTER Ive been graded though ...
Morgan Bath
Ranch Hand

Joined: Jan 16, 2004
Posts: 196
Recieved a reply:

The prohibition against using NIO is very recent. If it was issued after
you downloaded your assignment instructions, you are free to use NIO. If it
was issued before you downloaded your assignment instructions,
you'll know because the prohibition will be explicitly mentioned in your
instructions. Search the HTML document for "NIO".
As a general rule, no matter what you read on the web:
1) If it's in your instructions, you have to do it.
2) If it's not in your instructions, you don't have to do it.

Woohooo!
Satish Avadhanam
Ranch Hand

Joined: Aug 12, 2003
Posts: 697
Hey Morgan, that's great news. I downloaded the assignment a couple of weeks ago only and there is no such restriction. Anyway, I already did some part without using NIO.
But, thanks for the information, just in case I change my mind I still can use it .
George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi Morgan,
I think this settles the issue very nicely. You can use NIO unless your assignment instructions explicitly prohibit it. Thanks for asking the question.
I've opened a new topic that features the response Morgan received from Sun: Topic: We are allowed to use NIO
Please make any additional comments in the new thread.
Maybe a moderator or an administrator will see fit to close this thread, so that it doesn't cause any confusion.
[ February 17, 2004: Message edited by: George Marinkovich ]
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
I wonder why it will be prohibited in future?
George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi Marlene,
Originally posted by Marlene Miller:
I wonder why it will be prohibited in future?

I don't know the real reason, but if I were to speculate I would say it might be to force the designs to be more similar which therefore may make them easier to grade fairly in a standardized way. If NIO is prohibited it also means that the examiners don't have to be very knowledgable about NIO. Maybe the restriction makes it easier to find examiners. I don't think it's because NIO is somehow a bad thing to use.
Gytis Jakutonis
Ranch Hand

Joined: Feb 02, 2004
Posts: 76
I've downloaded assignment 3 weeks ago. I was not sure about that NIO restriction so I've wrote to SUN and they've answered that NIO restriction is quite new, and if it is not included in assignment instructions document, than I'm free to use it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NIO prohibited for SCJD project?
 
Similar Threads
want to Take SCJD
IO or NIO?
end of file and new IO
Use of NIO
java.nio