View Full Version : Who wants my code?
krycek
11-08-2002, 01:57 PM
Well all my scripts are coded by my humble self, and I try to keep them secret - at least while I am developing them.
The final version will be parsed and compressed, and maybe obfuscated if I can, but I am seriously thinking about publishing them with some tutorials of how I did the stuff. I know people would learn from it, the only thing is, you have to finish the stuff before you can publish it :D
At the moment, I have a number of APIs:
- Array extensions
- Dynamic layers
- Animation plugin for the dynamic layers (multi-threaded!)
- Core functions including mouse handling and drag-drop support, and keychecking/validation
The above are virtually finished. I continue to develop them as I create my widgets:
- Scrollbar (finished)
- Slider (almost finished)
- Scrollbox (finished)
...and the ones I will be doing after that include combo boxes, checklist boxes, rich text boxes etc. :)
This is part of the latest project I am working on, which I started two weeks ago and had to create this stuff from scratch. (I also had a week off for my birthday :D) Within the next month, all the widgets will be finished, and I will start work on a dynamic data object, and then build my application. So I guess I will be ready to publish this stuff at around xmas, but will have no time to write tutorials until about March at least.
This all depends on whether people would be interested or not. (IE 5.5+ only, btw!)
...would you? Let me know if so.
::] krycek [::
Membie
11-08-2002, 02:13 PM
You 'should' consider help / feedback possibilities. Not?
(Just voted ;) )
krycek
11-08-2002, 02:16 PM
Well, there would be help in the form of code comments - and full instructions on how to use the code, of course! But no tutorials about how I built the stuff until I got time.
As for feedback... um, email?
::] krycek [::
Borgtex
11-08-2002, 07:12 PM
I suppose that you're creating something similar to the DynAPI DHTML Library.
Why compress and obfuscate it? maybe you are going to buy it? you don't want people to be able to improve it?
krycek
11-08-2002, 11:48 PM
Originally posted by Borgtex
I suppose that you're creating something similar to the DynAPI DHTML Library.
Why compress and obfuscate it? maybe you are going to buy it? you don't want people to be able to improve it?
If I publish it, then of course the published version will be 'proper' code, with comments etc. (read my previous posts :)) But for my clients etc. they will receive the compressed version - why should users download all the extra too? You get my point...
DynAPI library, well I guess sort of, but (pardon my pride, arrogance, inflated ego and so forth) a lot better. Except, not cross-browser. I don't see the point.
I never really got too deep into DynAPI though, because it doesn;t do what I want. My APIs act quite a bit differently in some respects, esp. animation.
I am thinking along the lines of, if I publish, maybe I can get this popular enough to be properly open source, with people writing extensions etc. The APIs are built with that in mind, but I am not sure exactly what I will do yet. If anyone feels they can contribute something, please contact me and tell me what you are good at, and we may be able to work out some form of code-sharing :) You will of course get mentioned if you have contributed to anything that I decide to publish in the future.
::] krycek [::
chrismiceli
11-08-2002, 11:51 PM
voted for the cross browser, i run mozilla.
Why trying to encrypt it.. ? all you have to do is to save a webpage (file, saveas in MSIE) and the saved pages will be 'uncrypted').
Why not share the code with people without the 'hubla' ?? :thumbsup:
If code is not cross browser then what makes it so special ?
krycek
11-09-2002, 12:11 AM
Originally posted by kdj2
Why trying to encrypt it.. ? all you have to do is to save a webpage (file, saveas in MSIE) and the saved pages will be 'uncrypted').
Why not share the code with people without the 'hubla' ?? :thumbsup:
If code is not cross browser then what makes it so special ?
Um... I think you missed the point entirely...!
I am not trying to encrypt it.
I am trying to make sure that, when released as working code on a website, the files will be as small as possible. This means stripping out the comments and extra whitespace. Hopefully obfuscating it too, because that helps to get the size down. (And saving the file will not change that one bit!)
I am not keen on the thought of my clients trying to mess with the code themselves if I have built a site, because that causes problems for me, you see. So, this way they are less likely to fiddle - a definite advantage :)
If I decide to publish my work publically, I would do so on my own website, with tutorials, commented code, instructions etc. and hopefully make it an open source project that people can contribute to. The public code would NOT be compressed.
Are you with me now? :) Two entirely separate things...
::] krycek [::
PS - cross-browser? Why? Why bother? I code for IE 5+ and DOM2. Anything else, forget about it.
Borgtex
11-09-2002, 12:12 AM
DynAPI library, well I guess sort of, but (pardon my pride, arrogance, inflated ego and so forth) a lot better. Except, not cross-browser. I don't see the point.
Pardoned ;)
Somehing that I hate of libraries in general, and of DynAPI in particular is that even for the smaller thing you need to use the entire js library because everything is interconnected, so I usually prefer to code the animation (or whatever) myself in a compact and nice looking script :)
krycek
11-09-2002, 12:17 AM
Originally posted by Borgtex
Pardoned ;)
Somehing that I hate of libraries in general, and of DynAPI in particular is that even for the smaller thing you need to use the entire js library because everything is interconnected, so I usually prefer to code the animation (or whatever) myself in a compact and nice looking script :)
Very true... but it depends how much you want to do, and how good you are at coding. My APIs are designed to be used almost like plugins - pick the ones you want. Some need core functions but, at the moment, the whole of my code for the APIs (not including the widgets I am making) weighs in at under 20kb compressed. If you choose just the core stuff then it's even smaller. And, that's without obfuscation - I got it down to 12kb but it didn;t work, I need more work on my parsing script :D
Now, < 20kb is not too bad. But, your choice :)
::] krycek [::
Hmm,
Another API.
I like to collect JS api's for reference and to learn new stuff.
A lot of API's claim to be OO but miss on one main aspect of OO - polymorphism.
All of them (API's) are encapsulated (in that they encapsulate the functionality into objects)
but nearly all miss out on polymorphism.
JavaScript IS capable of polymorphism and it should definetly be used for speeding up animations.
( See the API at http://www.javascript-games.org )
As for compressing,
Doesn't TCP/IP compress ASCII text anyway?
Try downloading a GIF file thats 200k and a text file thats 200k (as reported by checking the properties on your PC)
Also
If you put the script in an external ".js" it will be cached so size is only a problem on the initial download.
As for having to include a lot of "core" script to get basic functionality - just search the number of times visitors of this forum want to either, combine scripts, or use more than one script of the same type on a page and are having problems. Encapsulated API's and OO scripting should overcome this problem.
If you don't want to write a lot of doc - don't. Those who understand advanced JavaScript will read the code and understand it, those who don't will wait for the tutorials.
I would say just publish the code.
joh6nn
11-09-2002, 06:22 AM
i don't see how polymorphism could be used to speed up animation, unless i'm confusing polymorphism with something else? can you give me an example of what you're talking about with that?
Consider this animation loop
aniLoop()
{
if( myob.x > Browser.getWidth() )
{
//myObj has hit the right of the window
//Do stuff.....
}
myObj.x++;
//Do stuff......
setTimeout("aniLoop()", 40);
}
The loop doesn't need to know which browser it is running in and the "Browser.getWidth()"
will return the correct width for the correct browser.
=
Now suppose getWidth() is implemented as follows
JSFX.Browser = new Object();
Browser.getWidth = function()
{
if(isNetscape)
return innerWidth;
else
return document.body.clientWidth;
}
Then for every loop of the animation the if(Netscape) condition will be checked.
That is 25 checks per second. Imagine if every method was implemented that way.
Hundres of checks for "if(isNetscape)" or "if(isIE)".
=
The following code is an example of polymorphism in javascript (as I understand it).
Here we make sure the correct method is installed for the correct browser
JSFX.Browser = new Object();
if(isNetscape)
Browser.getWidth = function()
{
return innerWidth;
}
else
Browser.getWidth = function()
{
return document.body.clientWidth;
}
Here the "if(Netscape)" is only executed as the page loads.
Now, the animation loop will be faster.
=
=
=
This is like doing the following
(This is my understanding of polymorphism, it could be I am mistaking it or something else
I always get my buzzword terms mixed)
Interface Browser{
int getWidth();
int getHeight();
}
Class NSBrowser Implements Browser{
int getWidth(){
return innerWidth;
}
int getHeight(){
return innerHeight;
}
}
Class IEBrowser Implements Browser{
int getWidth(){
return document.body.clientWidth;
}
int getHeight(){
return document.body.clientHeight;
}
}
And then when you create the object
Browser myBrowser;
if(isNetscape)
myBrowser = new NSBrowser()
else
myBrowser = new IEBrowser()
myBrowser.getWidth()
Does this make any sense?
Or have I just confused the issue more? (I usally do)
krycek
11-10-2002, 12:09 AM
...I understand your point perfectly, although I honestly don't know if 'polymorphism' is the right term for it or not... I have not heard that term used before :)
It doesn't really apply to my coding, though, does it... because I made it clear I do not code cross-browser. IE 5+ only :D
Now, on another point...
Could anyone voting for 'what a load of rubbish' in the poll please post a comment as to why? That would be much appreciated! :)
Don't worry, I am not going to flame anyone for their opinions. Just, this code has been a lot of work on my part, and it will be more work (and this time, unprofitable!) if I am to write tutorials, a site, and publish this code on the web. So, I am simply trying to gauge interest before wasting my time. Feedback is valuable, and I would prefer people to be honest in their voting but also to give a reason if the feedback is negative (also, saying why it is a good idea might help too! :D) because without feedback this is all pointless.
::] krycek [::
krycek
11-10-2002, 12:11 AM
Also, I would not really call polymorphism one of the "main aspects" of OO... and, I doubt that a few extra checks per loop would affect modern computers much. Bad coding, perhaps, but understandable. :)
::] krycek [::
joh6nn
11-10-2002, 05:15 AM
Roy, i'm not sure if that would be considered polymorphism or not. in one sense, it definitely is, but in another, it's only vaguely related. however, i can see your point about how that would speed things up, and i'll think that's a technique i'll turn to from now on.
krycek, polymorphism is one of the defining aspects of OOP. http://www.webopedia.com/TERM/P/polymorphism.html
krycek
11-10-2002, 06:23 AM
Well they say you learn a new thing every day...! :) To be honest, I am surprised I have not come across the term before - well, not so that I would remember. And that is odd, seeing as I have lectured in various OO languages - C++, Java, VB, JavaScript...
However it is a term that I will bear in mind for future reference ;)
::] krycek [::
glenngv
11-12-2002, 06:05 AM
if you really want a cool API, it has to be cross-browser.
at least IE5/NS6/Mozilla :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.