Jack1590
Reel Rookie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2020
06:38 AM
Builder pattern in brightscript
Hi
i'm planing to create a library which received a config to enable or disable features. this config object has several fields so I wonder if it is useful to have a builder pattern as scenegraph objects have default values for its fields maybe it's not needed to have a builder
for instance
Builder Implementation
configBuilder = createObject("roSGNode", "ConfigBuilder")
configBuilder.callFunc("withAppId", "rew4324123")
configBuilder.callFunc("withAds", true)
config = configBuilder.callFunc("build")
myLib = createObject("roSGNode", "MyLib")
myLib.callFunc("start", config)
Plain Object Implementation
config = createObject("roSGNode", "Config")
config.appId = "rew4324123"
config.adsEnabled = true
myLib = createObject("roSGNode", "MyLib")
myLib.callFunc("start", config)
Which approach do you think it's better for br?
1 REPLY 1

atc98092
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2020
07:33 AM
Re: Builder pattern in brightscript
You need to post this on the developer's side of the forum. This area is for end users, and very few people here will have any idea what you're talking about. 🙂
Dan
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee, just another user.
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee, just another user.