Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Code needs to develop organically and allowed to form its own flow instead of being hammered into a predefined hole of a certain shape

This definitely resonates with me and the way I tend to create things. I'm not suggesting that I do it the correct or best way but, for better or worse, it is how I usually go about things.

As an example, I've just finished writing an email editor in JavaScript and Perl. The 'spec'1 was that it has to be easy for a non-techie user to assemble components of an email (images and rich text), store those atomically and not in parts as I am using temporal tables. The stored data needs to be able to be edited at a later date and when sent out as an email, render reasonably well on Outlook for desktop and K9 for Android (I find if an email renders OK on both of those it will be reasonably alright on most email clients).

Other than that, the 'how' of the implementation or the 'what' of the appearance I had no idea.

I started off with the bit that I thought would be most difficult - the JavaScript rich text editor. I created something that did the basic formatting but also realised that execCommand is deprecated. I asked ChatGPT for help with what to use instead and it suggested Quill along with other options. So my focus changed from creating my own editor to integrating a pre-existing one. Then I had to solve the problem of adding blocks of rich text along with images and being able to drag and drop them to change order. All very different challenges to those I anticipated when I first took fingers to keyboard.

From there, I found that the HTML output from Quill is unnecessarily verbose. ChatGPT again to find DOMPurify to clean up the HTML before it is passed to Perl and stored in a database - there is still some HTML cleaning needed by Perl before sending out the emails but that differs depending on whether it is going to be a preview in the browser or sent out as an email.

The whole process from first key press to fully functioning system took about 4 days working just a few hours per day. I doubt (but don't know for sure) that I could have completed this in that time if I had written tests first. The only test it seems to need (and I'm open to being persuaded otherwise) is that allows people to create an email and that the email renders OK after being sent out. I certainly didn't envision what it was going to look like or the finer details at the start. It evolved organically.

1 - This 'spec' existed nowhere other than in my head. This post is the first time it has been articulated.

In reply to Re^4: What to test in a new module by Bod
in thread What to test in a new module by Bod

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2023-10-04 04:24 GMT
Find Nodes?
    Voting Booth?

    No recent polls found