is Perl used in the Java middle-tier

Discussion in 'Perl Misc' started by andrew_nuss@yahoo.com, Jan 5, 2007.

  1. Guest

    Hi,

    I'm a newbie at regexes and a professional java programmer. I've ready
    Friedl's book and see that
    java.util.regex is missing code assertions and overall can't solve the
    complexity of matching, transformation
    problems that Perl can solve. Therefore, I'm wondering if there are
    companies that are integrating Perl
    solutions into their enterprise java applications. Or do they just
    struggle with java.util.regex.

    Andy
    , Jan 5, 2007
    #1
    1. Advertising

  2. >>>>> "an" == andrew nuss <> writes:

    an> Therefore, I'm wondering if there are companies that are
    an> integrating Perl solutions into their enterprise java
    an> applications. Or do they just struggle with java.util.regex.

    I don't know of any; generally, any company that's smart enough to
    comprehend that Perl can be more expressive than Java generally isn't
    using Java for enterprise applications.

    Charlton



    --
    Charlton Wilbur
    Charlton Wilbur, Jan 5, 2007
    #2
    1. Advertising

  3. Am 5 Jan 2007 06:49:02 -0800 schrieb :

    > Hi,
    >
    > I'm a newbie at regexes and a professional java programmer. I've ready
    > Friedl's book and see that
    > java.util.regex is missing code assertions and overall can't solve the
    > complexity of matching, transformation
    > problems that Perl can solve. Therefore, I'm wondering if there are
    > companies that are integrating Perl
    > solutions into their enterprise java applications. Or do they just
    > struggle with java.util.regex.
    >
    > Andy


    Use C#. Then you have regexes with Perl's complexity (of course
    without Perl's elegance, but you're used to that being a Java
    programmer).

    Joachim
    Joachim Pense, Jan 5, 2007
    #3
  4. Guest


    >
    > Use C#. Then you have regexes with Perl's complexity (of course
    > without Perl's elegance, but you're used to that being a Java
    > programmer).
    >


    Does C# have code assertions?
    , Jan 5, 2007
    #4
  5. Am 5 Jan 2007 09:42:27 -0800 schrieb :

    >>
    >> Use C#. Then you have regexes with Perl's complexity (of course
    >> without Perl's elegance, but you're used to that being a Java
    >> programmer).
    >>

    >
    > Does C# have code assertions?


    I'm not an expert, but googling leads me to the answer "yes".
    Joachim Pense, Jan 5, 2007
    #5
  6. brian d foy Guest

    In article <>,
    <> wrote:


    > I'm a newbie at regexes and a professional java programmer. I've ready
    > Friedl's book and see that
    > java.util.regex is missing code assertions and overall can't solve the
    > complexity of matching, transformation
    > problems that Perl can solve.


    Have you run into a situation where you needed the missing features?
    Perl's regex engine has a lot of nifty tools, but if you don't need
    them it doesn't really matter if they are missing from Java. :)

    --
    Posted via a free Usenet account from http://www.teranews.com
    brian d foy, Jan 6, 2007
    #6
  7. wrote:
    <snip>
    > Therefore, I'm wondering if there are
    > companies that are integrating Perl
    > solutions into their enterprise java applications. Or do they just
    > struggle with java.util.regex.

    <snip>

    I started out using Perl as my language of choice and switched to
    Java about 2 years ago. Partly to obtain a programming position in
    the company I work for and partly because Java is more accepted in
    the field today (think Oracle applications).

    Anyway ...

    A more senior programmer in my department at work and I had a
    discussion on the use of regular expressions in Java. He didn't
    really see a need to use regular expressions in Java as it is used
    in Perl. Why? Because there are other ways to parse Strings in
    Java that have been included in the language since version 1.0. For
    example, the String methods startsWith, endsWith, substring or the
    StringTokenizer class.

    However ...

    Since this is a Perl newsgroup :), this question may be better
    asked in a Java newsgroup.

    OTOH ...

    I think, after using Java for a while now, that there can be over
    use of regular expressions in any language that supports them. For
    example, in Perl, there are other ways to parse data (ex. split,
    pack, unpack, substr, etc). Yet, I see scripts that will use a
    regex versus a function to split up a line. Of course, since Perl
    doesn't have a "startsWith" method, you're stuck using a regex to
    find something at the start of a line or scalar value.

    In the end, if you see you're using a lot of regular expressions to
    accomplish a task in any language, get someone else to look over
    your code ... someone who is unfamiliar with regular expressions (or
    hates using them). You'll find that there's a happy medium between
    the regular expressions being used and alternative approaches to the
    problem(s) at hand.

    HTH
    James Willmore, Jan 6, 2007
    #7
  8. Uri Guttman Guest

    >>>>> "JW" == James Willmore <> writes:

    JW> I think, after using Java for a while now, that there can be over use
    JW> of regular expressions in any language that supports them. For
    JW> example, in Perl, there are other ways to parse data (ex. split, pack,
    JW> unpack, substr, etc). Yet, I see scripts that will use a regex versus
    JW> a function to split up a line. Of course, since Perl doesn't have a
    JW> "startsWith" method, you're stuck using a regex to find something at
    JW> the start of a line or scalar value.

    you are not using perl if you only use regexes to do string
    stuff. startswith can be done like this:

    substr( $string, 0, length $begin ) eq $begin ;

    but why would you if

    $string =~ /^$begin/ ;

    does the job?

    the issue with java vs perl is more than regexes, it is the verbosity of
    java to get anything done. i don't want to type all those extra methods
    and lines and whatnot to get the job done. and i do fine in the work
    environment with just perl. you just need to not work for stupid large
    corps that have no clue. and there are plenty of large shops that do
    perl. check out jobs.perl.org for many perl jobs from all over the world
    and in all sorts of companies.

    JW> In the end, if you see you're using a lot of regular expressions to
    JW> accomplish a task in any language, get someone else to look over your
    JW> code ... someone who is unfamiliar with regular expressions (or hates
    JW> using them). You'll find that there's a happy medium between the
    JW> regular expressions being used and alternative approaches to the
    JW> problem(s) at hand.

    not likely unless they are using regexes for absolutely everything.

    and btw, split IS a regex function in perl. so using split on a line is
    still using a regex.

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
    Uri Guttman, Jan 6, 2007
    #8
  9. James Willmore <> wrote:

    > Of course, since Perl
    > doesn't have a "startsWith" method,



    .... then you can just write one:

    sub startsWith {
    my($str, $search) = @_;

    return 1 if substr($str, 0, length $search) eq $search;
    return 0;
    }

    > you're stuck using a regex to
    > find something at the start of a line or scalar value.



    No you're not.

    Somebody recently said people think of regexes too often, to the
    exclusion of alternatives.

    Oh, that somebody was you! :)


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Jan 6, 2007
    #9
  10. On Fri, 2007-01-05 at 17:22 +0100, Joachim Pense wrote:
    > Am 5 Jan 2007 06:49:02 -0800 schrieb :
    > > [...] that
    > > java.util.regex is missing code assertions and overall can't solve the
    > > complexity of matching, transformation
    > > problems that Perl can solve. Therefore, I'm wondering if there are
    > > companies that are integrating Perl
    > > solutions into their enterprise java applications. Or do they just
    > > struggle with java.util.regex.


    > Use C#. Then you have regexes with Perl's complexity (of course
    > without Perl's elegance, but you're used to that being a Java
    > programmer).


    Speaking of that, I recently wrote J# code to expose the .NET regex
    engine as java.util.regex-compatible classes:

    http://www.lmert.com/bb/modcp.php?mode=split&t=613

    On a more serious note, I doubt anyone "struggles" with
    java.util.regex; the missing features are so obscure that they can
    easily be worked around in code. However, it's really easy to spawn a
    perl interpreter in Java; something like

    Process p = System.getRuntime().exec("perl", new String[] { "-e",
    "exit((" + perlquote(arg) +
    ")=~/really(wierd)pattern/ ? 0 : 1 ) " });
    p.waitFor();
    boolean matches = (p.exitValue()==0);

    where perlquote() quotes its argument appropriately.
    David Lee Lambert, Jan 6, 2007
    #10
  11. <> wrote in message
    news:...
    >
    >>
    >> Use C#. Then you have regexes with Perl's complexity (of course
    >> without Perl's elegance, but you're used to that being a Java
    >> programmer).

    >
    > Does C# have code assertions?


    Most languages do (sort of), if you can duplicate the effect of an assert
    using native constructs. Frequently, "if" statements (or their equivalent)
    are the same thing: "if" something is true/not true, then barf/don't barf.

    Asserts do have value in that they can be more easily divorced from your
    real code.

    AFAIK, C# has asserts, through Debug.Assert.

    AHS
    Arved Sandstrom, Jan 6, 2007
    #11
  12. Dr.Ruud Guest

    Uri Guttman schreef:

    > $string =~ /^$begin/ ;


    Often better expressed as

    $string =~ /^\Q$begin/ and ...

    --
    Affijn, Ruud

    "Gewoon is een tijger."
    Dr.Ruud, Jan 6, 2007
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Craig Buchanan

    Middle-tier equivalent to server.mappath?

    Craig Buchanan, Jan 26, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,572
    martin
    Jan 27, 2004
  2. Guadala Harry

    ADO.NET DataReaders and the Middle Tier

    Guadala Harry, Feb 21, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    784
    Guadala Harry
    Feb 21, 2004
  3. =?Utf-8?B?SWFuIFdpbGxpYW1zb24=?=

    Retrieving state information from a middle tier

    =?Utf-8?B?SWFuIFdpbGxpYW1zb24=?=, Feb 25, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    1,256
    =?Utf-8?B?aW5ldG11Zw==?=
    Feb 25, 2005
  4. Joe
    Replies:
    71
    Views:
    1,395
    JEDIDIAH
    Jun 24, 2004
  5. John
    Replies:
    7
    Views:
    1,011
    Alex Hunsley
    Apr 7, 2006
Loading...

Share This Page