SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    660
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Building own Library

    Hey,

    I'm looking at creating my own JS library. Your probably thinking, why? Experience/Show employer, and I want 100% control over my websites. Anyways, I'm a huge fan of JS, yes, I said that, and I'm asking people who have done it, what are the major pitfalls and what should I look out for during the process? Experiences will vary, but trying to get some incite before moving forward.

    Thanks guys.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    I'm about to hit the hay, but here's something that should help to get the ball rolling.
    Roll out your own JavaScript Interfaces
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    660
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    I'm about to hit the hay, but here's something that should help to get the ball rolling.
    Roll out your own JavaScript Interfaces
    Thanks for that link, it's given me a good foundation and idea of how to go forward. I might take a look at the jQuery library to see how the code is structured and functions. But of course make my library unique to everything that is currently out there. Not an easy task, I know. Like you, I am also a fan on JS.

  4. #4
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    660
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Code JavaScript:
    var CookieController = {
     
    name: "Jason";
    SportsTeam: "Chiefs";
     
    addCookie: function()
               {
               //La de da;
               };
     
    deleteCookie: function()
                 {
                 //Word Life;
                 };
     
    };

    How can I prove upon this framework? Is their a more efficient way?

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by USPaperchaser View Post
    How can I prove upon this framework?
    How can you prove? As in, how can you prove that it's working as you expect it to be, by applying some tests to it?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #6
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    660
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    How can you prove? As in, how can you prove that it's working as you expect it to be, by applying some tests to it?
    Oops, I mean can I improve the code. Is their a better archetucture? Design Pattern?

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by USPaperchaser View Post
    Oops, I mean can I improve the code. Is their a better archetucture? Design Pattern?
    You are mixing data and methods together, which tends to be a no-no.

    You also have a function to read a cookie value, as well as a storage location from which the value can be read. That's two different ways to obtain the same information, which can be a design issue too.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #8
    SitePoint Guru Jason__C's Avatar
    Join Date
    Oct 2009
    Location
    Racoon City
    Posts
    660
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    You are mixing data and methods together, which tends to be a no-no.

    You also have a function to read a cookie value, as well as a storage location from which the value can be read. That's two different ways to obtain the same information, which can be a design issue too.
    So, basically my design pattern sucks. Do you have a recommendation of a library design pattern? The link you sent me was interesting, I might just design something similar.

  9. #9
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    The techniques that jQuery use seem to be solid and stable. Other ones such as YUI can be worth looking at too, in terms of how they do things.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  10. #10
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by USPaperchaser View Post
    So, basically my design pattern sucks. Do you have a recommendation of a library design pattern? The link you sent me was interesting, I might just design something similar.
    Pro JavaScript Design Patterns - Google Books

  11. #11
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Here's something that will be useful. It's a weekly blog called Let's make a Framework, which goes in to the issues and details of what's involved throughout the whole process.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  12. #12
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    Here's something that will be useful. It's a weekly blog called Let's make a Framework, which goes in to the issues and details of what's involved throughout the whole process.
    very interesting


Bookmarks

Posting Permissions

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