Style to follow for contributing

i'm having a bit of trouble telling what's intentional style, and just somewhat messy code.

for example, i've noticed that the block category buttons in the main editor and in the block creation window are two completely seperate functions, one in gui.js and the other in byob.js, and i don't know if this is failing to reuse code or kept seperate intentionally to make things easier in some way i wouldn't know yet

similarly i'm not sure about all variable declarations being at the top of functions (even variables like i just used for loops!) and i can't figure out a lot of magic numbers (why is the framerate set to 67, and not just 60?)

if there's reasoning behind these, i'd like to hear it, if it's just getting things done quickly, i won't judge :slight_smile:


why is it set to 200/3?
my main issue with 67 is that most browsers cap the framerate at 60, so i feel like all this would do is make uncapped browsers (like mine) run projects a tiny bit faster

oh ok

Them's fightin' words! But I'll let Jens defend himself. :~)

i really want to be as nice as possible but a ton of stuff is hardcoded and i often have to search through every single file for anything that looks even related to what i'm trying to change, i can't exactly compliment that

i want to just make sure there isn't some good reason for a few things before i try to start rearranging everything, it would be pretty dissapointing if i try to clean some stuff up and then i need to go over all of it again because i didn't follow some styling rule or combined something that shouldn't be

for example i want to make some kind of Spritelike class that Sprite and Stage inherit from (for lots of shared behavior) but i feel like i remember somewhere that there was something about or related to inheritance that some snap devs don't like

you can do what you want in your fork, but don't expect me to pull any "style improvements". Yes, there are reasons for those decisions, and many of them we've discussed thoroughly, others not so much. But, thing is, I'm not really open to discussing coding style with folks outside our dev team. I know that's what many of you crave for, but to be honest, I'm not looking for help with Snap. That said, I do appreciate your recent PR. In this forum, however, I'd like us to discuss CS and learning powerful ideas with Snap!, and I specifically want to discourage discussing "advanced" (NOT) subjects such as why or how certain things are done in JavaScript / Morphic / whatever. Thank you!

that's fully understandable, but if you don't want development discussion in the forum, why is there a "development" category and this description for advanced topics?

This category is for people interested in the inner workings of Snap!: what's inside its implementation, how to extend it, and so on.

or am i misunderstanding what you mean?

also, i'm not just asking about this for code contributions, i want to hear more opinions on coding myself so i can improve (i guess that part would be the computer science category but it would probably just be more confusing to split the topic)

We're fine with people making their own forks. We're fine with people asking implementation questions, as long as that doesn't overwhelm the forum and scare the beginners away. It's just suggestions for changes to Snap! irtself that Jens doesn't want (and insults to Jens, which I don't want).