jetersu / jsplumb

Automatically exported from code.google.com/p/jsplumb
0 stars 0 forks source link

suggestion: simplify api, add builder classes #340

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
the addEndpoint() method is very dynamic. it can take different ways of params, 
and the return can be a single item or an array. i'd create separate methods 
(method names) for separate input/output params.

also, there are many ways how to configure the look of things, like stroke 
color. i'm overwhelmed by the possibilities and struggle sometimes to just get 
it working.
for example it took me about half an hour to figure out that in connect() i 
need to name it 'paintStyle' what in other cases it's called 'connectorStyle'.

if there were builder classes to create config objects such as paintStyle then 
the builder could directly throw if i tried to set a property that does not 
exist. or warn me if a property was deprecated. this would give me confidence 
and speed of development. and simplify the usage.html manual.

also, it would allow jsPlumb to move forward and change the api when it makes 
sense, because the builder classes could take care of the changes internally. 
userland code would not break (as quickly) when upgrading to a newer jsPlumb 
version. and old syntax could be dropped at some point in the library.

Original issue reported on code.google.com by fabian.k...@optimaize.com on 17 Apr 2013 at 4:48

GoogleCodeExporter commented 8 years ago
i'm not going to do this.  it would just add to the size of what i already 
consider to be a library that is too large.

the documentation covers things like the paintStyle/connectorStyle conundrum 
you experienced.

you mentioned that you are new to jsplumb, so presumably you haven't had to 
upgrade a version yet.  userland code doesn't break when upgrading, because i 
am careful about backwards compatibility.

Original comment by simon.po...@gmail.com on 17 Apr 2013 at 8:29