<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160804</link>
    <title>MATLAB Central Newsreader - WTF good are editor cells?</title>
    <description>Feed for thread: WTF good are editor cells?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 12 Dec 2007 15:15:59 -0500</pubDate>
      <title>WTF good are editor cells?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160804#405899</link>
      <author>Peter Meilstrup</author>
      <description>The editor keeps bugging me about &quot;Cell mode&quot; so I looked at the&lt;br&gt;
documentation and the video. Great, it is something that makes&lt;br&gt;
software engineers vomit. A tool to &quot;help&quot; people to write godawful&lt;br&gt;
specialized long M-files with polluted namespaces when they could&lt;br&gt;
write short reusable functions instead.&lt;br&gt;
&lt;br&gt;
But sometimes you have some particular data you need to analyze in a&lt;br&gt;
particular way as a one-off, so when I had such a need, I gave it a&lt;br&gt;
try.&lt;br&gt;
&lt;br&gt;
I created an M-file and made a cell with a double %% and put some&lt;br&gt;
commands in it to load some data from a file. Then I executed the&lt;br&gt;
cell. No errors were reported, so far so good, so I went on to write&lt;br&gt;
the next step of the analysis in another cell. That step was supposed&lt;br&gt;
to plot something in a figure, but it told me that variables were not&lt;br&gt;
defined. The same variables that I HAD just defined in the previous&lt;br&gt;
cell!&lt;br&gt;
&lt;br&gt;
So I ran the previous cell AGAIN. Again, no errors reported. But the&lt;br&gt;
variables did not show up in my workspace! WTF. Instead of Cmd+Enter,&lt;br&gt;
I copied the contents of the  cell manually and pasted them into the&lt;br&gt;
command window. This time it reported a syntax error.&lt;br&gt;
&lt;br&gt;
Um. So it is a feature of cell mode that when a you execute a cell&lt;br&gt;
with a syntax problem they entire cell is silently disregarded and no&lt;br&gt;
indication is made to the user?&lt;br&gt;
&lt;br&gt;
dsfargeg WHAT!?&lt;br&gt;
&lt;br&gt;
Okay, so then after correcting that problem I went to the second cell&lt;br&gt;
where I had written about ten lines. No syntax errors, so when I ran&lt;br&gt;
it it actually produced some output... an error message, which was&lt;br&gt;
unsurprising. Um, except there was absolutely no indication of which&lt;br&gt;
of the ten lines generated the error.&lt;br&gt;
&lt;br&gt;
If I were executing a script file from the command line, the line&lt;br&gt;
number would be front and center in the error message. Here, no such&lt;br&gt;
indication. How does it help &quot;rapid code iteration&quot; to purposefully&lt;br&gt;
conceal from the user exactly the information they need in order to&lt;br&gt;
fix their code, I wonder?  Now I have to manually execute each line to&lt;br&gt;
find out the problem. Time saved by Cell mode so far: a negative&lt;br&gt;
number.&lt;br&gt;
&lt;br&gt;
Two strikes so far, but I'm stubborn, so I went on to the next cell.&lt;br&gt;
This step of the analysis called for a for-loop. I wrote the cell,&lt;br&gt;
executed it, and came upon an error message inside the for loop (which&lt;br&gt;
I could only tell was inside the loop because the message was returned&lt;br&gt;
by a builtin function that was only called inside the loop -- not as&lt;br&gt;
though the error message contained any information about which line&lt;br&gt;
the execution stopped or anything.)&lt;br&gt;
&lt;br&gt;
So I have an error that happens at some iteration of a loop. The&lt;br&gt;
typical diagnostic here when debugging an M-file would be to set&lt;br&gt;
'dbstop if error' and inspect the workspace to see what about the data&lt;br&gt;
is causing the error. I do this and re-run the cell.&lt;br&gt;
&lt;br&gt;
The error message is produced; the debugger does not stop. Um, but I&lt;br&gt;
told it to 'dbstop if error.' Never mind, I will set the breakpoint&lt;br&gt;
manually by clicking in the left margin of the editor and hope that&lt;br&gt;
the error manifests on the first dozen or so times it stops. I click,&lt;br&gt;
it produces a red dot indicating the breakpoint; I execute the cell;&lt;br&gt;
the debugger never stops.&lt;br&gt;
&lt;br&gt;
Wonderful. It is a feature of this &quot;rapid development&quot; tool that you&lt;br&gt;
CAN'T USE THE DEBUGGER FGSFDS FAIL.&lt;br&gt;
&lt;br&gt;
In summary, we have a new feature of a development environment that in&lt;br&gt;
the name of &quot;rapid code iteration&quot;, swallows errors silently (which&lt;br&gt;
prevents you from rapidly iterating your code), fails to report useful&lt;br&gt;
information about the errors it does let through (which prevents you&lt;br&gt;
from rapidly iterating your code,) and prevents you from using&lt;br&gt;
debugging tools (which in turn prevents you from rapidly iterating&lt;br&gt;
your code.)&lt;br&gt;
&lt;br&gt;
F------, would not use again.</description>
    </item>
    <item>
      <pubDate>Wed, 12 Dec 2007 16:52:25 -0500</pubDate>
      <title>Re: WTF good are editor cells?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160804#405910</link>
      <author>Joseph </author>
      <description>Peter,&lt;br&gt;
I'm going to go out on a limb and say you haven't found your&lt;br&gt;
&quot;inner peace.&quot;  Green Tea might help.&lt;br&gt;
&lt;br&gt;
Now, I've used the &quot;cell mode&quot; many times and found it has&lt;br&gt;
been pretty useful.  I don't remember watching a video, but&lt;br&gt;
there are some pretty useful help pages written for it.  I&lt;br&gt;
also don't believe anyone at Mathworks has ever suggested&lt;br&gt;
utilizing long Mfiles.  I utilize the cells to document&lt;br&gt;
every 4 or 5 lines of code if possible.  Or to explain my&lt;br&gt;
custom-written functions.  &lt;br&gt;
&lt;br&gt;
I can't imagine how your errors are popping up.  As far as I&lt;br&gt;
understand it, the cell-function is just a &quot;pretty&lt;br&gt;
function.&quot;  It cleans up your m-file and that's it.  It's&lt;br&gt;
kinda like claiming your comments are messing your results up.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Peter Meilstrup &amp;lt;peter.meilstrup@gmail.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;75c78475-9345-4fc5-933e-12a73465e8ad@s19g2000prg.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; The editor keeps bugging me about &quot;Cell mode&quot; so I looked&lt;br&gt;
at the&lt;br&gt;
&amp;gt; documentation and the video. Great, it is something that makes&lt;br&gt;
&amp;gt; software engineers vomit. A tool to &quot;help&quot; people to write&lt;br&gt;
godawful&lt;br&gt;
&amp;gt; specialized long M-files with polluted namespaces when&lt;br&gt;
they could&lt;br&gt;
&amp;gt; write short reusable functions instead.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; But sometimes you have some particular data you need to&lt;br&gt;
analyze in a&lt;br&gt;
&amp;gt; particular way as a one-off, so when I had such a need, I&lt;br&gt;
gave it a&lt;br&gt;
&amp;gt; try.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I created an M-file and made a cell with a double %% and&lt;br&gt;
put some&lt;br&gt;
&amp;gt; commands in it to load some data from a file. Then I&lt;br&gt;
executed the&lt;br&gt;
&amp;gt; cell. No errors were reported, so far so good, so I went&lt;br&gt;
on to write&lt;br&gt;
&amp;gt; the next step of the analysis in another cell. That step&lt;br&gt;
was supposed&lt;br&gt;
&amp;gt; to plot something in a figure, but it told me that&lt;br&gt;
variables were not&lt;br&gt;
&amp;gt; defined. The same variables that I HAD just defined in the&lt;br&gt;
previous&lt;br&gt;
&amp;gt; cell!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So I ran the previous cell AGAIN. Again, no errors&lt;br&gt;
reported. But the&lt;br&gt;
&amp;gt; variables did not show up in my workspace! WTF. Instead of&lt;br&gt;
Cmd+Enter,&lt;br&gt;
&amp;gt; I copied the contents of the  cell manually and pasted&lt;br&gt;
them into the&lt;br&gt;
&amp;gt; command window. This time it reported a syntax error.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Um. So it is a feature of cell mode that when a you&lt;br&gt;
execute a cell&lt;br&gt;
&amp;gt; with a syntax problem they entire cell is silently&lt;br&gt;
disregarded and no&lt;br&gt;
&amp;gt; indication is made to the user?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; dsfargeg WHAT!?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Okay, so then after correcting that problem I went to the&lt;br&gt;
second cell&lt;br&gt;
&amp;gt; where I had written about ten lines. No syntax errors, so&lt;br&gt;
when I ran&lt;br&gt;
&amp;gt; it it actually produced some output... an error message,&lt;br&gt;
which was&lt;br&gt;
&amp;gt; unsurprising. Um, except there was absolutely no&lt;br&gt;
indication of which&lt;br&gt;
&amp;gt; of the ten lines generated the error.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If I were executing a script file from the command line,&lt;br&gt;
the line&lt;br&gt;
&amp;gt; number would be front and center in the error message.&lt;br&gt;
Here, no such&lt;br&gt;
&amp;gt; indication. How does it help &quot;rapid code iteration&quot; to&lt;br&gt;
purposefully&lt;br&gt;
&amp;gt; conceal from the user exactly the information they need in&lt;br&gt;
order to&lt;br&gt;
&amp;gt; fix their code, I wonder?  Now I have to manually execute&lt;br&gt;
each line to&lt;br&gt;
&amp;gt; find out the problem. Time saved by Cell mode so far: a&lt;br&gt;
negative&lt;br&gt;
&amp;gt; number.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Two strikes so far, but I'm stubborn, so I went on to the&lt;br&gt;
next cell.&lt;br&gt;
&amp;gt; This step of the analysis called for a for-loop. I wrote&lt;br&gt;
the cell,&lt;br&gt;
&amp;gt; executed it, and came upon an error message inside the for&lt;br&gt;
loop (which&lt;br&gt;
&amp;gt; I could only tell was inside the loop because the message&lt;br&gt;
was returned&lt;br&gt;
&amp;gt; by a builtin function that was only called inside the loop&lt;br&gt;
-- not as&lt;br&gt;
&amp;gt; though the error message contained any information about&lt;br&gt;
which line&lt;br&gt;
&amp;gt; the execution stopped or anything.)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So I have an error that happens at some iteration of a&lt;br&gt;
loop. The&lt;br&gt;
&amp;gt; typical diagnostic here when debugging an M-file would be&lt;br&gt;
to set&lt;br&gt;
&amp;gt; 'dbstop if error' and inspect the workspace to see what&lt;br&gt;
about the data&lt;br&gt;
&amp;gt; is causing the error. I do this and re-run the cell.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The error message is produced; the debugger does not stop.&lt;br&gt;
Um, but I&lt;br&gt;
&amp;gt; told it to 'dbstop if error.' Never mind, I will set the&lt;br&gt;
breakpoint&lt;br&gt;
&amp;gt; manually by clicking in the left margin of the editor and&lt;br&gt;
hope that&lt;br&gt;
&amp;gt; the error manifests on the first dozen or so times it&lt;br&gt;
stops. I click,&lt;br&gt;
&amp;gt; it produces a red dot indicating the breakpoint; I execute&lt;br&gt;
the cell;&lt;br&gt;
&amp;gt; the debugger never stops.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Wonderful. It is a feature of this &quot;rapid development&quot;&lt;br&gt;
tool that you&lt;br&gt;
&amp;gt; CAN'T USE THE DEBUGGER FGSFDS FAIL.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In summary, we have a new feature of a development&lt;br&gt;
environment that in&lt;br&gt;
&amp;gt; the name of &quot;rapid code iteration&quot;, swallows errors&lt;br&gt;
silently (which&lt;br&gt;
&amp;gt; prevents you from rapidly iterating your code), fails to&lt;br&gt;
report useful&lt;br&gt;
&amp;gt; information about the errors it does let through (which&lt;br&gt;
prevents you&lt;br&gt;
&amp;gt; from rapidly iterating your code,) and prevents you from using&lt;br&gt;
&amp;gt; debugging tools (which in turn prevents you from rapidly&lt;br&gt;
iterating&lt;br&gt;
&amp;gt; your code.)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; F------, would not use again.</description>
    </item>
    <item>
      <pubDate>Wed, 12 Dec 2007 21:13:27 -0500</pubDate>
      <title>Re: WTF good are editor cells?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/160804#405949</link>
      <author>Matthew Simoneau</author>
      <description>Not showing the line number for the error can be a real&lt;br&gt;
drag.  I run into this myself.  I don't miss breakpointing&lt;br&gt;
much in the way I tend to use cells, but I can see how you'd&lt;br&gt;
expect it to be there.&lt;br&gt;
&lt;br&gt;
As far as swallowing the error, this just shouldn't happen.&lt;br&gt;
&amp;nbsp;I'd appreciate it if you could send me your code and&lt;br&gt;
version number.  I know we had some problems in earlier&lt;br&gt;
releases, but I want to be sure we've got this fixed.&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
Matthew Simoneau&lt;br&gt;
The MathWorks</description>
    </item>
  </channel>
</rss>

