Can someone help me unimprove this code?



  • I don't think it has enough problems yet.



  •  Well, for starters, it doesn't punish the garbage collector as much as it could.

    String logName = new String();
    logName = new String( new String( logName ) + new String( String.format( new String( "%s-" ), new String( "log" ) ) ) );
    logName = new String( new String( logName ) + new String( String.format( new String( "%tF" ), new Long( System.currentTimeMillis() ).longValue() ) ) );
    logName = new String( new String( logName ) + new String( String.format( new String( ".%s" ), new String( "log" ) ) ) );
    FileOutputStream file = new FileOutputStream( new File( new String( logdir ), new String( logName ) ), new Boolean( new String( "true" ).booleanValue() );

    String toWrite = new String();
    toWrite = new String( new String( toWrite ) + new String( String.format( new String( "%tF" ), new Long( System.currentTimeMillis() ).longValue() ) ) );
    toWrite = new String( new String( toWrite ) + new String( String.format( new String( "%s" ), new String( " " ) ) ) ) );
    toWrite = new String( new String( toWrite ) + new String( String.format( new String( "%tT" ), new Long( System.nanoTime() ).longValue() ) ) ) );
    toWrite = new String( new String( toWrite ) + new String( String.format( new String( " " ), new String( " " ) ) ) ) );
    toWrite = new String( new String( toWrite ) + new String( String.format( new String( "%s" ), new String( message ), args ) ) ) );
     
    for ( byte b : new String( toWrite ).getBytes() ) {
    file.write( new Byte(b).byteValue() );
    }


  • Java Programming 101: How to frak up a simple logger.

    What is this pile of smelly code anyway? Why does it need its own logger? Why doesn't it have a README.md? What are Llama slayers? Why is it 12 levels deep? Why should time and space be known a priori? O wait, we know the answer to that.



  • @TGV said:

    Java Programming 101: How to frak up a simple logger.

    What is this pile of smelly code anyway? Why does it need its own logger? Why doesn't it have a README.md? What are Llama slayers? Why is it 12 levels deep? Why should time and space be known a priori? O wait, we know the answer to that.

    You must be new here.



  • Llama slayers? Must be someone hates SimCity...



  • @ekolis said:

    Llama slayers? Must be someone hates SimCity...

    LlamaS layers. I own several apartment buildings specifically for llama housing. It's actually quite humane to the llamas.


Log in to reply