Forums > MaxMSP

Max and Javscript Programming Best Practices – Max style question

March 27, 2014 | 9:09 am

Hi Max community,

I am a programmer by profession and so I know Javascript and other scripting languages well, it’s definitely a style of programming that I’m used to. Anytime I’m presented with a problem or something I want to do in Max my immediate response is to just create an JS object and bypass any need for understanding the way Max logic or data-structures "work" or using a pure Max solution. Is this good practice or is it best to use Javascript sparingly for some tasks? Sometimes I feel like I’m "cheating" by just going straight to the Javascript solution…

What do you think?? How could I better approach Max to get away from this default behavior of going straight to Javascript?? What did you do?

Thanks



Lee
March 27, 2014 | 9:49 am

As with anything, you should use the tools at your disposal – I mix and match – I tend to write complex logic and datastructure stuff in JS (or even Java) as that’s what I’m used to – but if there’s no need for that I stay in MAX, e.g. I use coll and dict for simple stuff without feeling the need to recode this stuff in js (not that dict can’t handle complex data structures – it can, it’s just i can get my head round operating on them easier when I have lines of code in front of me). That’s the great thing about the environment, you can just plug all these things together very easily.


March 27, 2014 | 1:29 pm

Thanks Lee, I will have to look into those objects. I definitely understand feeling more comfortable operating on those data structures with lines of code. Simple operations like conditionals & switches, pushing and popping of arrays, etc etc are much easier in JS and doing logic like that in Max seems difficult. Maybe I just need to learn to "think Max" and forget about all this block programming stuff… though I just can’t think of how else I would get anything done! Thanks for your feedback



Lee
March 27, 2014 | 3:06 pm

I think there is something to what you say and "thinking in MAX" does take some time, moreso I think sometimes if you’ve come from a more text based rather than visual language… It took me a while to make the shift. It does all fall into place after time tho and becomes more comfortable.. Like most programming envs or languages, there is also something new to learn or a new way of doing things… :)


Viewing 4 posts - 1 through 4 (of 4 total)