sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ๐Ÿ›ฃ๏ธ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Word of warning to developers

    Scheduled Pinned Locked Moved Developers' Forum
    25 Posts 17 Posters 16.0k Views 17 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      RickW
      last edited by

      The Pragmatic Programmer's Guide has some good information on modules.

      Hope that helps,

      RickW
      [www.smustard.com](http://www.smustard.com)

      1 Reply Last reply Reply Quote 0
      • M Offline
        Matt666
        last edited by

        Thank you !

        Frenglish at its best !
        My scripts

        1 Reply Last reply Reply Quote 0
        • C Offline
          CPhillips
          last edited by

          Come on. Spill it. What plugin did you find a conflict with? ๐Ÿ˜„

          1 Reply Last reply Reply Quote 0
          • T Offline
            todd burch
            last edited by

            One of my paid scripts was broken by a free script. Names are being withheld until notification of next of kin. ๐Ÿ˜†

            1 Reply Last reply Reply Quote 0
            • Didier BurD Offline
              Didier Bur
              last edited by

              ๐Ÿ˜ณ ๐Ÿ˜ณ ๐Ÿ˜ณ

              DB

              1 Reply Last reply Reply Quote 0
              • GaieusG Offline
                Gaieus
                last edited by

                ๐Ÿ˜„ ๐Ÿคฃ ๐Ÿ˜†

                Gai...

                1 Reply Last reply Reply Quote 0
                • scottliningerS Offline
                  scottlininger
                  last edited by

                  Another broad area of "wishlisting" is how we can best handle the problem of our scripts accidentally clobbering other people's. It's great that Ruby is such a flexible language, but we've all seen situations where two of us choose the same name for something and everybody loses.

                  RickW has suggested to me that we form some sort of "official" policy and/or repository for handling this problem, and for reducing code rewriting, so that we all benefit from the collective knowledge of the group, but as of yet I haven't pulled together a proposal for the community. What are your ideas?

                  Some possibilities:

                  Create an "official" means for extending Sketchup.rb, along with a versioning system, so that we can extend the base API.
                  Create some kind of name-spacing convention that we can publicize and encourage folks to use.

                  I'm sure these are things you've all been talking about (I'm still catching up on back-messages.) I want something that's easy for people to use, from novice ruby programmer to expert. If it's too hard for people to understand and adopt, then we're wasting our time... What do you think? I'm all ears.

                  • Scott Lininger
                    SketchUp Software Engineer
                    Have you visited the Ruby API Docs?
                  1 Reply Last reply Reply Quote 0
                  • soloS Offline
                    solo
                    last edited by

                    I am no coder so my opion is worthless however .... how about having all ruby's include the authors initials? IE adjust_textures_PJS.rb (hypothetical ruby)

                    http://www.solos-art.com

                    If you see a toilet in your dreams do not use it.

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      Dik Harrison
                      last edited by

                      Formally, I worked for a large government agency that developed their software internally, with development taking not only at development centers, but also at individual sites (170+), at least that is how it worked a number of years ago, now there is not much development going on now. Any way, back when everybody was developing or at least customizing for local use, each site was given a short code 3-4 letters that made their variables and routines unique. Using initials or some such would work in this situation, but a list of initials would need to be maintained, so that duplicated would not occur. Then a coder would simply add their code as a prefix or sub-fix to their routines and variables. For example, I would write a routine called something-wrh.rb, with a variable x-wrh. It would be up to me not to step on my own code.

                      Have fun...

                      Dik

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        @unknownuser said:

                        The precepts of the law are these: To live honourably, not to injure another, to give each his due.

                        As Gaeius's strap-line says [in pig Latin]...

                        i.e. Remember: Be nice to others. Don't mess others up. Give others due credit...

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • GaieusG Offline
                          Gaieus
                          last edited by

                          Hi TIG - yes, a bit off-topic but hey... ๐Ÿ˜„

                          It's Institutiones Iustiniani 1.1.3

                          (I wrote my thesis in Roman Law at the Law School ๐Ÿ˜‰ )

                          Gai...

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            Jim
                            last edited by

                            I have been using my initials as a module name to encapsulate everything I release, although I think sometimes little things slip through the cracks.

                            Would a shared Google Docs spreadsheet be good enough to claim and register namespaces?

                            
                                    Name        |        Email        | Registered Namespace
                            Carl Coder          | ccoder@gmail.com    | Ccoder
                            
                            

                            Hi

                            1 Reply Last reply Reply Quote 0
                            • scottliningerS Offline
                              scottlininger
                              last edited by

                              Have people seen any errors from other ways that scripts mess with each other besides naming overlaps? For example, observers from script A are messing with the model before my observers from script B fire off?

                              • Scott Lininger
                                SketchUp Software Engineer
                                Have you visited the Ruby API Docs?
                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                todd burch
                                last edited by

                                There have been right-click context menu issues with validation routines. The classic issue here is HouseBuilder causing a beep if installed whenever any right click was done. Not so much a conflict as an annoyance.

                                I remember an issue one time with some script extending a base class of Ruby (like NullClass) and it causing issues. Don't remember the specifics.

                                What should probably be promoted is script authors subclassing Sketchup classes to extend them, as opposed to just extending them.

                                1 Reply Last reply Reply Quote 0
                                • T Offline
                                  tomasz
                                  last edited by

                                  @unknownuser said:

                                  Have people seen any errors from other ways that scripts mess with each other besides naming overlaps?

                                  I've got two scripts on my black list.
                                  1st place : Matchbox Plugin 1.1 by antantantant
                                  Population.rb

                                  class Array
                                    def * (n)
                                      temp = Array.new()
                                      i = 0
                                      if n.kind_of? Float
                                        each {|v| temp[i] = v*n
                                              i = i + 1}
                                      end
                                      return temp
                                    end
                                    
                                    def + (n)
                                      if n.kind_of? Array
                                        i = 0
                                        temp = Array.new()
                                        while i < [self.length, n.length].max
                                          temp.push(self[i] + n[i])
                                          i = i + 1
                                        end
                                      return temp
                                      elsif n.kind_of? Float
                                        each {|v| v = v + n}
                                      end
                                    end
                                  end
                                  

                                  Arrrrgggghhhhhhh..... !! Do NOT modify built-in Ruby methods, please!!

                                  2nd place: Train Simulator 1.2 exporter by Paul Gausden
                                  mstsx.rb

                                  class Sketchup;;Color
                                  	 def ==(c)
                                  		 return (c.alpha==self.alpha and c.red==self.red and c.green==self.green and c.blue==self.blue)
                                  	 end
                                   end
                                  

                                  Modification of original SU method, which can : 1st - give different results than other Ruby programmers expect, 2nd - prevents != method to work correctly.

                                  Those bugs makes my life and users of my exporter harder. ๐Ÿ˜ž

                                  Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    sepo
                                    last edited by

                                    Matchbox is also on the Podium NO NO list.

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      deerwood
                                      last edited by

                                      Hi all,

                                      though I not yet had any name clash problem, may I suggest a rule adopted from the Java world? The essential idea is to qualify/prefix "packages" with something unique in our internet world. Namely the domain of the author, reversed, optionally followed by some more specific info.

                                      So e.g. Jim's "jitter.rb" is qualified by "com_blogspot_sketchuptips" and the specific info beeing "jitter".

                                      And Ricks "GoldenGauge" is qualified by "com_smustard" (or maybe "com_smustard_wilson_rick") and the specific info beeing "golden_gauge".

                                      Following that idea the plugins working code would not reside any longer directly inside the "plugins" directory (unless it is an essential thing/library) but in some directory named after the domain inside "plugins".

                                      E.g. Jim's plugins ALL reside in "plugins/com_blogspot_sketchuptips" and ALL of the Smustard ones are present under the "plugins/com_smustard" directory, optionally further down in a dir named after the author ("..../wilson_rick") or a project ("..../common" or "..../utils").

                                      And, please, all other excellent plugin writers here around: I apologize to not have named you. But you'll get the idea, hopefully.

                                      To call/activate such a plugin on startup of SU there must be a minimal Ruby script directly in the "plugins" dir, requiering the real code. These would be one liners, but then named after the complete path to the plugins code. E.g. "jitter" would have this Ruby in the "plugins" dir (named "com_blogspot_sketchuptips_jitter.rb"):

                                      
                                      require 'com_blogspot_sketchuptips/jitter.rb'
                                      
                                      

                                      But it should be easy to just call a script common to a domain, that does advanced handling of (sub)scripts to be included. That script then just requires, what the final user wants to have. These require scripts (down to any level of the dir hierarchy) could easily be tweaked by users, by just commenting out "require" statements.

                                      Packaging of plugins into this hierarchie/concept is easy for every developer of plugins.

                                      Every plugin's author is known/can be reached (as long as his domain is existent).

                                      Cluttering of the plugins directory is reduced greatly, especially when the feature of just require'ing subdirs reqire scripts is used.

                                      What do YOU think?

                                      Best regards, deerwood

                                      1 Reply Last reply Reply Quote 0
                                      • R Offline
                                        RickW
                                        last edited by

                                        Interesting concept, and for creating Module names, it could work. However, locating files in subfolders by organization/author name conflicts with Organizer.rb.

                                        Currently, Organzier allows users to create subfolders in the Plugins folder that then become submenus in the Plugins menu, with the scripts located in those subfolders likewise having menu items in the respective submenus. For example, you could create a "Draw-Create" subfolder, then move all scripts that draw or create geometry in that subfolder. In the Plugins menu, there would be a Draw-Create submenu, and each file in that subdirectory would be represented in the submenu. It's a fast way for users to clean up both their Plugins menu and Plugins folder at the same time, while grouping scripts by like function.

                                        I think that a script that parses the new template file and can display the pertinent script information in a webDialog will go a long way towards helping users who want or need to know the author/contact information or version number to check for updates.

                                        RickW
                                        [www.smustard.com](http://www.smustard.com)

                                        1 Reply Last reply Reply Quote 0
                                        • D Offline
                                          deerwood
                                          last edited by

                                          Dear Rick, all,

                                          @rickw said:

                                          Interesting concept, and for creating Module names, it could work. However, locating files in subfolders by organization/author name conflicts with Organizer.rb.

                                          sorry, I wasn't aware of the organizer.rb. Hmm. Still not giving up on the subfolder idea ๐Ÿ˜‰ , what about more closely mimic that Java concept by having under "plugins" max 2..4 letter folders named after the top level domains, e.g. "com", "edu", "org", "net", "tv", "de" or "co"? Isn't the length of TLD's restricted?

                                          The organizer then could just ignore short folder names directly under "plugins", or, if neccessary, have a list of (additional) TLD names to ignore.

                                          Under the TLD folders there would be the appropriate domain name folders of the authors. So someones/Jims/yours/mine plugins would reside in

                                          • plugins

                                          • co

                                          • uk

                                          • someone

                                          • someone-else

                                          • com

                                          • blogspot

                                          • sketchuptips* smustard

                                          • de

                                          • georg-rehfeld

                                          For the module/class names I'm not any longer really happy with my proposal, because the names would be so exceptionally long/unusabale. Or did I miss some Ruby feature?

                                          Just brainstorming, not more.

                                          Best regards, Georg (aka deerwood)

                                          1 Reply Last reply Reply Quote 0
                                          • Chris FullmerC Offline
                                            Chris Fullmer
                                            last edited by

                                            I think I'm not seeing what the problem is with having plugins just placed in the root plugins folder?

                                            Lately you've been tan, suspicious for the winter.
                                            All my Plugins I've written

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement