Results 1 to 14 of 14
  1. #1
    uncommon is offline Member
    Join Date
    Dec 2008
    Posts
    30
    Rep Power
    0

    Default Interesting Experiment

    I just got finished trying out the "Rules Roundup" game @ javaranch.com and it got me and my colleagues thinking.

    I think a lot of us take our IDEs for granted over time, so we have a competition to see who can write the most complex application in notepad and get it to compile on the first try. This includes no Java books, no Google searches, and no help from friends.

    Start with hello world and I'd be interested to hear the results.

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    6

    Default

    Whats included/excuded? What would define complex? Would say converting Roman Numerals to base 11 be more complex then a java program that translates c code into pascal?

    I like the idea and would love to see the attempts(I personally would fail horribly. Doubt I could even get hello world to work properly through notepad lol)

  3. #3
    uncommon is offline Member
    Join Date
    Dec 2008
    Posts
    30
    Rep Power
    0

    Default

    We don't really need to rate the complexity level, just describe the application, maybe post the source code.

    Here was my first botched attempt, I was a bit ashamed

    Java Code:
    public class HellWorld {
    
    	/**
    	 * @param args
    	 */
    	public static void main(args[]) {
    		System.out.println("Hello World!");
    
    	}
    
    }
    -The class was named improperly (Eclipse fixes typos)
    -The arguments parameter was wrong

  4. #4
    DevzAbhi's Avatar
    DevzAbhi is offline Member
    Join Date
    Jul 2008
    Posts
    67
    Rep Power
    0

    Default

    till date i have never used any ide .. i use textpad because darn eclipse is too slow to code..

    my application is big and j2ee compliant ..

    but i still fancy people who use ide.. they have cool features in that..
    DevZ;)

  5. #5
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    6

    Default

    I just tried it and I wasn't in the right file directory to compile/run. Not technically a coding error but if you can't compile your code it doesn't matter how well it is written.

  6. #6
    uncommon is offline Member
    Join Date
    Dec 2008
    Posts
    30
    Rep Power
    0

    Default

    Quote Originally Posted by DevzAbhi View Post
    till date i have never used any ide .. i use textpad because darn eclipse is too slow to code..
    that..
    Eclipse (my IDE) is memory intensive if you have less then 1GB of memory (and can be slow with 1GB). But I can't say it's slow to code. In fact it's been proven that using an IDE drastically decreases development time.

    Two words:
    Code Completion

  7. #7
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by uncommon View Post
    In fact it's been proven that using an IDE drastically decreases development time.
    All IDEs take more computer resources than vi and the compiler. But they are much more efficient in programmer time, which is the expensive part of any development.

    Read Fred Brook's "no silver bullet". In it, he says that the IDE with integrated debugger is one of the most important improvements in programmer productivity in the history of computers.

    Memory is nearly free. Consider 2GB a minimum, and realistically a dual core system with 4GB is a realistic minimum.

    On topic: I write a lot of HTML using vi, but have been using IDEs for 30 years, and I'm not sure I can do hello world without one.

  8. #8
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    Does it have to be Notepad? Can we use a text-only tool ( code coloring ) I have several ide's and do not use them as they choke the machine to nothing. When I fire one up, it is just like firing one up, except it is down. The counter-example of not finding errors due to incapacity of the human mind to do code path tracing and so on leads to an inefficient waste of time.

    If I may suggest, any true text editor, not an ide test builds alllowed, day or two limit so one does not get challenged by people with nothing better to do than waste things. I find Notepad's 4k buffer to be the limiting factor - and do we get to use the copy paste buffer?....I think it's IDE v TE on that I can win ( relatively ) due to IDE's relentless insistence on preconcieved notions of what code is supposed to format to. Granted, things like XML and deployment descriptors eventually become necessary.
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  9. #9
    Stu_328 is offline Member
    Join Date
    Dec 2008
    Posts
    3
    Rep Power
    0

    Default

    1st post :P

    Java Code:
    public class HelloWorld{
    
    public static void main(String[] args){
    System.out.println("Hello World");
    }
    }
    Lets raise the bar a little.

    An attempt at an app that turns an upper class string to a lowercase one without the String.toLowerCase() method:

    Java Code:
    public class MakeItLittle{
    
    public static void main(String[] args){
    String str = "";
    
    try{
    str = args[0];
    }catch(Exception e){
    System.out.println("You gots to give me a String!!!");
    }
    
    String newStr = "";
    //32 is a guess, might be 33 can't remember :S
    for(int x=0;x<str.length;x++){
    newStr = newStr+(str.charAt(x)+32);
    }
    
    System.out.println(newStr);
    
    }
    }
    I'll go compile it now and see.

    Oh and I think the stipulation should be that you HAVE to write it in the message reply box. That way everyones in the same boat. :)

  10. #10
    Stu_328 is offline Member
    Join Date
    Dec 2008
    Posts
    3
    Rep Power
    0

    Default

    Well my MakeItLittle class doesnt compile. And then it just prints out the numbers. :(

  11. #11
    uncommon is offline Member
    Join Date
    Dec 2008
    Posts
    30
    Rep Power
    0

    Default

    Writing it in the reply box seems like a good standard.

  12. #12
    uncommon is offline Member
    Join Date
    Dec 2008
    Posts
    30
    Rep Power
    0

    Default

    okay, I'm going to try a funny little piece that simply puts junk in the trunk
    Java Code:
    public class JunkintheTrunk {
    
    public static void main(String[] args) {
    Junk junk = new Junk();
    junk.setDesc("Alot of Junk");
    
    Trunk trunk = new Trunk();
    trunk.addToTrunk(junk);
    trunk.someJunk.print();
    }
    
    public class Trunk {
    Junk someJunk;
    
    public void addToTrunk(Junk someJunk) {
    this.someJunk = someJunk;
    }
    }
    
    public class Junk {
    String desc;
    
    public void setDesc(String desc) {
    this.desc = desc;
    }
    
    public void print() {
    System.out.println("Junk: " + this.desc);
    }
    }
    
    }

  13. #13
    uncommon is offline Member
    Join Date
    Dec 2008
    Posts
    30
    Rep Power
    0

    Default

    blah.. it didn't compile. I needed to create an instance on JunkintheTrunk and apply it to the new keyword. The proper main method:

    Java Code:
        public static void main(String[] args) {
            JunkintheTrunk app = new JunkintheTrunk();
            Junk junk = app.new Junk();
            junk.setDesc("Alot of Junk");
    
            Trunk trunk = app.new Trunk();
            trunk.addToTrunk(junk);
            trunk.someJunk.print();
        }

  14. #14
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Cool Code Warriors Conference has been postponed awaiting perfect code.

    Four builds, four changes, no internet, no ide's.....

    Compiler:
    MainClass.java:313: class, interface, or enum expected
    This code was compiled in Eclipse. I can't attach the output files because they are too large for the attachment mechanism, even when I compress them.
    ^
    MainClass.java:313: unclosed character literal
    This code was compiled in Eclipse. I can't attach the output files because they are too large for the attachment mechanism, even when I compress them.
    ^
    2 errors

    Tool completed with exit code 1
    C:\Documents and Settings\Owner\My Documents\UncommonCodeChallenge.java
    Java Code:
    /**
    * Comment goes here.
    * Saturday, December 20, 2008
    * need something to take my mind away from: ( font line help speaking ),
    * ....... as mentioned earlier I would request you to please contact phone support for further assistance regarding .....
    * what I was talking about was to elminate some sales hooks from my shell so I could do some TWAIN from Java work......
    */
    
    public class UncommonCodeChallenge
    {
        private static final java.lang.Integer maximumLineLength = new java.lang.Integer(noncetest.B64.LINE_LEN); // Maximum output line length made to reflect ftr's range checking in B64.java
        //
        private static final java.lang.String aStringToTwing = new java.lang.String("blah.. it didn't compile. I needed to create an instance on JunkintheTrunk and apply it to the new keyword. The proper main method:");//
        //
        private static final java.lang.String anotherString = new java.lang.String("An attempt at an app that turns an upper class string to a lowercase one without the String.toLowerCase() method:");//
        //
        java.util.Set<java.lang.String> c6cc9c6cc9c6cc9c6cc9c6cc9 = new java.util.Set<java.lang.String>();
        //
        UncommonCodeChallenge(String[] a4158d7)
        {
            try
            {
                try
                {
                    int integerLoopIndex = a4158d7.length;//
                    do
                    {
                        String SmittenKitten = a4158d7[--integerLoopIndex];
                        if(SmittenKitten.length() < maximumLineLength.intValue())
                        {
                            //
                            KangarooKeySpec e5f = new KangarooKeySpec();
                            javax.crypto.Cipher trofee = javax.crypto.Cipher.getInstance( new String("Rijndael"));// Jaculum Prudentia - jackal beware
                            trofee.init(javax.crypto.Cipher.ENCRYPT_MODE,e5f);
                            //
                            byte[] d274959 = trofee.doFinal(SmittenKitten.getBytes());// byte[] doFinal(byte[] input)
                            String a9019   = noncetest.B64.encode(d274959);//
                            c6cc9c6cc9c6cc9c6cc9c6cc9.add(a9019);//
                        }
                        else
                        {
                            ExCertatoriNatura exPectorant = new ExCertatoriNatura();//
                            throw exPectorant;//
                        }
                    }
                    while(integerLoopIndex > 0);
                    java.util.Iterator iterator = c6cc9c6cc9c6cc9c6cc9c6cc9.iterator();//
                    if(iterator.hasNext())
                    {
                        try
                        {
                            // this is to avoid thinking about what file name to use, replace this with filename appropriate to your coding knowledge and skills.............
                            java.io.File file = new java.io.File(java.io.File.getCurrentDirectory());
                            StringBuffer buffy = new StringBuffer("STU_1964_MODEL_NUMBER_007");
                            //
                            buffy.append("file.toString()");
                            buffy.append(".dat");
                            java.io.BufferedWriter bw = new java.io.BufferedWriter(buffy.toString());
                            do
                            {
                                String a27b0 = (String) iterator.next();
                                bw.write(a27b0,0x00000000,a27b0.length());
                            }
                            while(iterator.hasNext());
                            bw.flush();bw.close();
                            System.out.println("Your file is ready, but I don't know where the keys are.......");//
                            return;
                        }
                        catch(java.io.IOException yowie)
                        {
                            System.out.println("Secure Telephone Units are usefull in class 0 and class 1 transmission events.");//
                            System.exit(-1);//
                            // What are you looking here for.
                        }
                    }
                }//
                catch(java.security.NoSuchPaddingException javaRules)
                {
                    // Okay, so you weak-willed will not have to look it up - I just replaced the dot with a space....
                    System.out.println(javaRules.getMessage());//
                }
                catch(java.security.NoSuchAlgorithmException java)
                {
                    // Okay, so you weak-willed will not have to look it up - I just replaced the dot with a space....
                    System.out.println(java.getMessage());//
                }
                catch(Exception e)
                {
                    return;
                }
            }
            catch(java.lang.Throwable t)
            {
                System.out.println(t.getMessage());
            }
        }
        public static void main(String[] args)
        {
            UncommonCodeChallenge uc = new UncommonCodeChallenge(args);//
            return;
        }
    }
    class ExCertatorNatura extends java.lang.Exception
    {
        // default string.
        private static final java.lang.String aStringToTwing = new java.lang.String("okay, I'm going to try a funny little piece that simply puts junk in the trunk");//
        //
        private ExCertatorNatura()
        {
            super(new java.lang.String("Oh and I think the stipulation should be that you HAVE to write it in the message reply box."));//
        }
        public ExCertatorNatura(String message)
        {
            this();//
            System.out.println(super.getMessage());
        }
        //
        private static final java.lang.String[] source =
        {
            "public static void main(String[] args) {",
            "   JunkintheTrunk app = new JunkintheTrunk();",
            "   Junk junk = app.new Junk();",
            "   junk.setDesc(\"Alot of Junk\");",
            "    Trunk trunk = app.new Trunk();",
            "    trunk.addToTrunk(junk);",
            "    trunk.someJunk.print();"
        };
    
        boolean report()
        {
            try
            {
                super.printStackTrace();
            }
            catch(java.lang.Throwable throwAfit)
            {
                String[] someStuff =
                {
                    //
                    "Quick Links",
                    "Today's Posts",
                    "Mark Forums Read",
                    "Open Buddy List",
                    "User Control Panel",
                    "Edit Signature",
                    "Edit Profile",
                    "Edit Options",
                    "Miscellaneous",
                    "Private Messages",
                    "Subscribed Threads",
                    "My Profile",
                    "Miscellaneous",
                    "Who's Online"
                };
                System.out.println(throwAfit.getMessage());//
                System.out.println(someStuff[0]);//
                System.out.println(someStuff[1]);//
                System.out.println(someStuff[2]);//
                System.out.println(someStuff[3]);//
                System.out.println(someStuff[4]);//
                System.out.println(someStuff[5]);//
                System.out.println(someStuff[6]);//
                System.out.println(someStuff[7]);//
                System.out.println(someStuff[8]);//
                System.out.println(someStuff[9]);//
                System.out.println(someStuff[10]);//
                System.out.println(someStuff[11]);//
                System.out.println(someStuff[12]);//
                System.out.println(someStuff[13]);// Uh, oh. Thirteen souls adrift in Code Bloat.
            }
        }
    }
    class KangarooKeySpec extends javax.crypto.spec.SecretKeySpec
    {
        byte[] pademelon = new byte[16];
        KangarooKeySpec()
        {
            super( new byte[16],"Rijndael");
            int Petrogale = pademelon.length;//
            do
            {
                double marsupial = Math.random();//  Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
                double penicillata = ((marsupial * 256) - 128);//
                Byte Tasmaniabyte = new Byte(new Double(penicillata).byteValue());
                pademelon[--Petrogale]=(byte)Tasmaniabyte.byteValue();//Returns the value of this Byte as a byte.
            }
            while(Petrogale > 0);
            return;//
        }
        KangarooKeySpec(byte[] Teratornithidae)
        {
            super(Teratornithidae,"Rijndael");
            return;//
        }
        //
        byte[] Caracara()
        {
            java.io.ByteArrayOutputStream Frigatebird = new java.io.ByteArrayOutputStream(16);
            Frigatebird.write(pademelon,0,16);//
            return Frigatebird.toByteArray();
        }
        static KangarooKeySpec newKeySpec()
        {
            return new KangarooKeySpec();
        }
    }
    // eof
    Code in about an hour, call me if you need me.
    MainClass.java is some posters code in the same directory,....
    IDE's consult the following:
    Java Code:
        //
        // Are we coming or going.
        //
        /**
         * Train Scheduling Problem from School of Business at
         * Green Bucks Institute for Institutional Toot-Toots.
         *
         *                  /    \
         *                 /      \
         *                /        \
         *       ___       | train |
     ___ ___ ___ | |___    |station|
     o-o+o-o+o-o+|OO--oo>                   $$$$$$ <- profits ahead
         * ================================================<-train tracks
         * Will the train stop if you are at the station and have ticket?
         */
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Similar Threads

  1. Interesting topic in JComboBox
    By success21061985 in forum NetBeans
    Replies: 0
    Last Post: 08-21-2008, 12:43 PM
  2. Tricky but very interesting problem
    By ravjot28 in forum New To Java
    Replies: 4
    Last Post: 06-26-2008, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •