Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
great to see you thinking about this important topic so early in your programming career!

Haha! Thanks eyepopslikeamosquito

I suppose the second part of the original question was the more significant part for me...is there ever a case in the current day to write a module that isn't OOP. The discussion has certainly answered that there is.

To keep writing style consistent across our company, we use a style guide which, among other things, sets a minimum Flesch Kincaid Grade Score. We mostly use Hemingway to check our copy. However, we have internal editors for blogs, emails, etc. so I thought it would be helpful to have a real time Grade Score on these. To that end, I found an existing Javascript Flesch Kincaid module. I wanted Javascript to avoid lots of AJAX calls.

To my surprise, I found that the Grade Score from this was vastly different from Hemingway for the same piece of text. I was surprised because Flesch Kincaid is a well-defined mathematical formula. After some investigation, it seems the difference comes from the difficulties in programatically counting syllables.

So I thought I'd write my own module to obtain a Grade Score. I know there are Text::Info and Lingua::EN::Fathom. The latter I am using to create a copy checker that also includes a ratio of first person to second person pronouns. Both these modules count syllables using Lingua::EN::Syllable which the author notes is not entirely accurate although this is not especially important for my application.

Far more important to me is consistency. I need a Perl module and a Javascript module that function the same way and obtain the same result for a given block of text...any block of text over a dozen or so words. Hence looking at writing my own. That way I can create the syllable counting regexp in Javascript and Perl in a way that should produce consistent results in both languages.

My instincts tell me that this is best not done using an OOP module. But I couldn't explain why. Now, given the helpful and informative discussing, I understand some of why my instincts were right. I guess my judgement was also clouded by having only written OOP modules recently. I also think that the choice was mostly right for those too.


In reply to Re^2: Procedural vs OOP modules by Bod
in thread Procedural vs OOP modules by Bod

Title:
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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-20 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found