To be fair - SS1 nlapiSearchRecord is way nicer th...
# suitescript
c
To be fair - SS1 nlapiSearchRecord is way nicer than searching in NS2 as I don't like callbacks.
s
Nice work. I built a few last year, and was sad that I had to revert back to SS1 as well. I was informed by a NetSuite developer that the Financial team maintains the GL plug-in API, so it's up to them to build support for SS 2.x, and they don't see the point in it yet. Strangely, I actually prefer the callbacks, so even in my SS1 scripts I use
nlapiCreateSearch().runSearch().forEachResult(callback)
. It's nice to have multiple options, though.
c
Coming from a Java background, I never really 'got' callbacks. I need to sit down and learn the concept in more depth.
JS people seem more aware of the concept.
s
That's my story as well. I came from a long background doing object-oriented programming (Java, C++, C#, Groovy) and for most of my career thought of JavaScript as just a language for web page scripting. For the longest time closures and callbacks seemed alien to me. But, I find that I am fighting less against the language when I try to embrace functional programming, and I feel like my JS code is gradually improving as I do. It is hard to unlearn old ways, but sometimes rewarding. It helps to have a good JavaScript mentor, and thankfully there are some long time JS experts here at my company that have guided me through it.
✔️ 1
😍 1
e
Upon reflection, the happiest day of my programming career was the day I abandoned the
class
keyword
s
When I first got started, one of the more seasoned Python + JS programmers here shared this with me (good for a laugh):
c
@erictgrubaugh It would be interesting to read why you feel that. I might learn something...
e
Yes, I think everyone should try to learn new ways of expressing ideas and solving problems. I'm neither a purist functional programmer nor an expert one, but learning some functional paradigms has taught me a lot of new ways of thinking about programming and solving problems. Classes are a construct designed to make code look and sound like natural language - the classic "properties are nouns, methods are verbs". That has some serious advantages, but then it also necessarily limits your coding to the structures of natural language as well, which is by its nature very procedural and often verbose. The focus is on building constructs that mimic a strict single instance of "a thing" - describing the thing's nouns and verbs. Functional programming shifts the focus to data structures and mathematical relationships between them - "design your data first, and the code will follow" - which can be more difficult to read and carry a steep learning curve, but can more often express more complicated ideas in more concise language. I try to incorporate patterns and ideas from both schools of thought to make readable yet concise code.
c
Thanks, I'm glad I asked. You've inspired me to read more on this subject