deviant ART

[x]
[x]

Refactor my code!

Journal Entry: Fri Sep 28, 2007, 1:30 AM
~CodeIsArt recognises that code can be art, although doesn't have to be all the time, just as much as asking for a cup of sugar, isn't poetry.

  • :jsenn: View our introduction journal / members list
  •  :thumbsup: See the news article (bump this)
  •  :D Enter the chat room!


  • refactormycode.com is a website where you can get input from other programmers about reducing a piece of code down to a smaller and more elegant solution, exactly what ~CodeIsArt is all about! :w00t:

    For example, this solution in Javascript to return if a given date is a leap year goes from:

    Object.extend(Date.prototype, {
        isLeap: function(){
            var year = this.getFullYear();
            return (year % 4 == 0 && year % 100 != 0) || (year % 100 == 0 && year % 400 == 0);
        }
    });


    To:

    function isLeap(y){return new Date(y, 2, 0).getDate()==29;}

    Through the input of others into the problem. And whilst you're there, you may be able to help others out with your own programming knowledge!

    This website is great for people of all levels looking for the art in programming, and ultimate elegance in problem solving.

    I hope to see some of your improved pieces appearing in ~CodeIsArt's favourites soon :)

    ---
    10 PRINT "There is no place like home"
    20 GOTO 10


    • Mood: Helpful

    Devious Comments

    love 0 0 joy 0 0 wow 0 0 mad 0 0 sad 0 0 fear 0 0 neutral 0 0

    ~kurokikazenootoko:iconkurokikazenootoko: Sep 28, 2007, 2:20:46 AM
    thanks for the link:)

    --
    ...and then i'll pull the trigger.
    ~nexuslite:iconnexuslite: Sep 28, 2007, 2:49:18 AM
    Doesn't seem very popular yet but great idea.
    ~photofroggy:iconphotofroggy: Sep 28, 2007, 4:21:20 PM
    neat.

    --
    I kick, therefore I > #IdleRPG.

    I am a founder of ~dAGamers. Have a look and join if you are a gamer!
    ~Fautzo:iconFautzo: Oct 2, 2007, 10:30:26 AM
    Well howdy ho, Heven't heard from you in a while, that's awsome!!