We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I think the one thing that discouraged me the most was trying to pinpoint exactly where a certain variable got defined. I went through two or three classes, some that were extensions of others, and finally got bogged down in Smarty and gave it up. Once I can actually trace the process of how an end product actually gets produced I’ll be better able to cope with it. That’s the thing I like about Evolution, it’s very easy to trace processes and variables.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 27708 MODX Staff
      • 2,502 Posts
      Bobray.

      You bring up some interesting points. Having given up on the original SVN I didn’t get into trouble because I didn’t go deep so I never really noticed the issues with the file structure.

      I think that you highlight a key point about any system is that the critical part is the explanation of how to use it to people who are less knowledgeable than you. It is the responsibility of the teacher to match instruction with the current understanding of the student and bring the two together. That doesn’t mean dumb down the information it often means expanding explanation, increasing the length of the learning curve to decrease the gradient at which people get a win.

      I have taught classes to film producers and directors on how to record sound for film and television and you have to start with their knowledge and then build on their understanding. I know all sorts of stuff about sound, sound waves, electronics, projection and filmaking and I can’t assume that they know any of that so I start at the beginning and get a feel for what they already know and set them up for a win using a tutorial and and example of a single part or small subset of the process. Once they have had success with that part I move on to extend that base.

      I feel that it is all our duty to start at the beginning and to have the introduction to revolution at the level of its potential users, most of whom are php knowledgable designers and devs of all levels. Speaking on academic terms may be fine for a small portion of that audience but the others get left behind in confusion and a lack of understanding and the first experience people have with Revolution is one of frustration, confusion and feelings of inadequacy. I feel like I can write or hack my way through pretty much anything but when my eyes start to glaze over at the copious lines of api documentation without any direction or introduction I am left thinking, "I’m not ready for this."

      So what is the solution? My own opinion is that the entire team--no matter what skill level we are at--needs to try out Revolution and develop a "Plain English" version of an intro. Forget about the API, MVC and OOP (as a focus but only as a feature) and help people understand what it is that Revolution can do. As I mentioned in a previous post, we need to encourage its use and adoption even in the alpha 3 state for us to get to GA and a basic tech-lite intro tutorial is a necessary action.

      I also think that the advent of the new website and a IA rationalization will make a huge difference in the adoption rates and migration to Revolution.

      Cheers,

      Jay
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 28215
        • 4,149 Posts
        Quote from: BobRay at Jul 30, 2008, 05:30 AM

        at some point, somebody needs to explicate the MODx directory tree in plain English to explain what these things are and what they do.

        I could work on this.

        In the meantime, I explain what controllers/connectors/models are in this series:
        http://svn.modxcms.com/docs/display/~splittingred/2008/06/25/PHP+Coding+in+MODx+Revolution%2C+Pt.+I

        I’ve wandered around in the mostly uncommented code for hours with no idea what I was looking at or what it did or where to find what I wanted

        I feel the code is pretty darn commented. What’s not, so we can augment it?

        Thanks for the points BobRay.
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 3749
          • 24,544 Posts
          Quote from: splittingred at Jul 30, 2008, 08:47 AM

          Quote from: BobRay at Jul 30, 2008, 05:30 AM

          at some point, somebody needs to explicate the MODx directory tree in plain English to explain what these things are and what they do.

          I could work on this.

          In the meantime, I explain what controllers/connectors/models are in this series:
          http://svn.modxcms.com/docs/display/~splittingred/2008/06/25/PHP+Coding+in+MODx+Revolution%2C+Pt.+I

          Yes, that’s excellent, but as I understand it, it’s mainly about how to do programatically what get’s done in the Manager. What I’d like to see is some more on how Revolution interacts with the user on the front end in the normal course of business with references to the corresponding code.

          As a further example or being lost and frustrated, after posting my comment last night, I thought I’d go take a look at the new parser Jason mentioned. I figured it *had* to be part of the core, but looking at the directories under that (cache, config, docs, error, export, import, lexicon, model, packages, xpdo), none of them seem to be a likely place for it. I looked into all of them briefly, just in case. Then I looked under connecters but nothing there seemed to fit either. It couldn’t possibly be in the manager section or the setup section, I thought, because that wouldn’t make any sense. I looked in assets, but there’s nothing there but snippets. Then I did a search of the whole of Revolution. I found no hits for "class parser" "document parser" or "resource parser" and 413 hits for "parser." That led me to this in the modx class (under core/model/modx) :

              function getParser() {
                  return $this->getService('parser', 'modParser');
              }


          which led to this:

          function getService($name, $class= '', $path= '', $params= array ()) {
                  $service= null;
                  if (!isset ($this->services[$name]) || !is_object($this->services[$name])) {
                      if (empty ($class) && isset ($this->config[$name . '.class'])) {
                          $class= $this->config[$name . '.class'];
                      } elseif (empty ($class)) {
                          $class= $name;
                      }
                      if ($className= $this->loadClass($class, $path, false, true)) {
                          if ($service= & new $className ($this, $params)) {
                              $this->services[$name]= $service;
                              $this->$name= & $this->services[$name];
                          }
                      }
                  }
                  if (isset ($this->services[$name])) {
                      $service= & $this->services[$name];
                  } else {
                      $this->_log(MODX_LOG_LEVEL_ERROR, "Problem getting service {$name}, instance of class {$class}, from path {$path}, with params " . print_r($params, true));
                  }
                  return $service;
              }


          which led me to this:

          var $services= array ();


          which appeared to be a dead end.

          I did see some hints that I might find the parser in the XPDO section, but by that time, I was exhausted. Later, I found the parser grin (with a search for "parser class") back near where I started in core/model/modx modparser.class.php where it appears most of the MODx classes are (calling that directory "modx-classes" might make sense). At any rate, a new user wouldn’t know that he or she was looking for "modparser" or where to find it. I’m sure there’s a point where all this falls into place but I’m not there yet and I’ve spent some time at it.

          I don’t want to be misunderstood, the new Manager is fantastic and finding what I want and doing what I need to do in the Manager has been mostly a breeze.

          I’ve wandered around in the mostly uncommented code for hours with no idea what I was looking at or what it did or where to find what I wanted


          I feel the code is pretty darn commented. What’s not, so we can augment it?

          It is and it isn’t. In retrospect, the code is much better commented overall than I suggested and far better than most code I’ve worked with.
          The purpose of each function or class is usually clear (if a little terse) and the purpose of each argument is almost always commented. There’s often little or nothing, though, on how the code in the section does it’s job, how it’s related to other parts of MODx, and where to find the parts it communicates with.

          These functions in the modparser class are a good example:

            function modParser(&$modx) {
                  $this->__construct($modx);
              }
              function __construct(&$modx) {
                  $this->modx= & $modx;
              }


          function collectElementTags($origContent, & $matches, $prefix= '[[', $suffix= ']]') {
                  $matchCount= 0;
                  if (!empty ($origContent) && is_string($origContent) && strpos($origContent, $prefix) !== false) {
                      $openCount= 0;
                      $offset= 0;
                      $openPos= 0;
                      $closePos= 0;
                      if (($startPos= strpos($origContent, $prefix)) === false) {
                          return $matchCount;
                      }
                      $offset= $startPos +strlen($prefix);
                      if (($stopPos= strrpos($origContent, $suffix)) === false) {
                          return $matchCount;
                      }
                      $stopPos= $stopPos + strlen($suffix);
                      $length= $stopPos - $startPos;
                      $content= $origContent;
                      while ($length > 0) {
                          $openCount= 0;
                          $content= substr($content, $startPos);
                          $openPos= 0;
                          $offset= strlen($prefix);
                          if (($closePos= strpos($content, $suffix, $offset)) === false) {
                              break;
                          }
                          $nextOpenPos= strpos($content, $prefix, $offset);
                          while ($nextOpenPos !== false && $nextOpenPos < $closePos) {
                              $openCount++;
                              $offset= $nextOpenPos + strlen($prefix);
                              $nextOpenPos= strpos($content, $prefix, $offset);
                          }
                          $nextClosePos= strpos($content, $suffix, $closePos + strlen($suffix));
                          while ($openCount > 0 && $nextClosePos !== false) {
                              $openCount--;
                              $closePos= $nextClosePos;
                              $nextOpenPos= strpos($content, $prefix, $offset);
                              while ($nextOpenPos !== false && $nextOpenPos < $closePos) {
                                  $openCount++;
                                  $offset= $nextOpenPos + strlen($prefix);
                                  $nextOpenPos= strpos($content, $prefix, $offset);
                              }
                              $nextClosePos= strpos($content, $suffix, $closePos + strlen($suffix));
                          }
                          $closePos= $closePos +strlen($suffix);
          
                          $outerTagLength= $closePos - $openPos;
                          $innerTagLength= ($closePos -strlen($suffix)) - ($openPos +strlen($prefix));
          
                          $matches[$matchCount][0]= substr($content, $openPos, $outerTagLength);
                          $matches[$matchCount][1]= substr($content, ($openPos +strlen($prefix)), $innerTagLength);
                          $matchCount++;
          
                          if ($nextOpenPos === false) {
                              $nextOpenPos= strpos($content, $prefix, $closePos);
                          }
                          if ($nextOpenPos !== false) {
                              $startPos= $nextOpenPos;
                              $length= $length - $nextOpenPos;
                          } else {
                              $length= 0;
                          }
                      }
                  }
                  if ($this->modx->getDebug() === true && !empty($matches)) {
                      $this->modx->_log(MODX_LOG_LEVEL_DEBUG, "modParser::collectElementTags \$matches = " . print_r($matches, 1) . "\n");
          //            $this->modx->cacheManager->writeFile(MODX_CORE_PATH . 'logs/parser.log', print_r($matches, 1) . "\n", 'a');
                  }
                  return $matchCount;
              }


          This isn’t a very good example because very few people actually need to know how this works, but I happened to have it handy.

          Ok now, everyone who wishes I had put all the time I spent complaining and writing this diatribe into actually contributing to MODx raise his or her hand. wink (mine is up)
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 28215
            • 4,149 Posts
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 28215
              • 4,149 Posts
              Quote from: BobRay at Jul 30, 2008, 03:04 PM

              This isn’t a very good example because very few people actually need to know how this works, but I happened to have it handy.

              Great. I’ll work on adding more inline comments to sections.


              Ok now, everyone who wishes I had put all the time I spent complaining and writing this diatribe into actually contributing to MODx raise his or her hand. wink (mine is up)

              I think it would help the dev team if people would stop saying "This is too difficult to understand!" and do more of what you just did - try it out, and then ask specific questions. We’re definitely eager to answer questions, but if we’re not getting any specific ones, it’s hard to answer.
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 3749
                • 24,544 Posts
                Quote from: splittingred at Jul 30, 2008, 03:14 PM

                http://svn.modxcms.com/docs/display/revolution/Explanation+of+Directory+Structure
                That’s fantastic. It will make a *huge* difference in bringing people onboard, IMO.


                Feel free to edit/augment.

                I don’t appear to have permission for that (am I, as usual, missing something?).
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 28215
                  • 4,149 Posts
                  Quote from: BobRay at Jul 30, 2008, 03:21 PM

                  I don’t appear to have permission for that (am I, as usual, missing something?).

                  Try now.
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 3749
                    • 24,544 Posts
                    Quote from: splittingred at Jul 30, 2008, 03:26 PM

                    Quote from: BobRay at Jul 30, 2008, 03:21 PM

                    I don’t appear to have permission for that (am I, as usual, missing something?).

                    Try now.

                    Works now. Thanks.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 7231
                      • 4,205 Posts
                      I think it would help the dev team if people would stop saying "This is too difficult to understand!" and do more of what you just did - try it out, and then ask specific questions. We’re definitely eager to answer questions, but if we’re not getting any specific ones, it’s hard to answer.
                      I will have a boat load in a bit, give me a few more days of poking around and trying stuff grin

                      By nature I am a documentation reader (a rare breed), so I am not one to ask too many questions. I will make an effort to ask even the dumb ones, so be gentle shocked

                      One more thing; we need to get the wtf loaded with more resources. What needs to be changed in existing snippets to make them Revo compatible? What are the chances that snippets like AjaxSearch or Jot will work as-is in Revo? Is it a mater of changing table names in queries and api calls, or is there more to it?

                      Anyway, I think I am catching a slight Revo feaver. rolleyes
                        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                        Something is happening here, but you don&#39;t know what it is.
                        Do you, Mr. Jones? - [bob dylan]