Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming IT Technology

When a CGI Script is the Most Elegant Solution 256

An anonymous reader writes "Writing local Web applications can be quick, easy, and efficient for solving specific Intranet problems. Learn why a Web browser is sometimes a better interface than a GUI application and why experienced Web developers find themselves struggling to learn a GUI toolkit, and descover that a simple CGI script would serve their needs perfectly well, if not better."
This discussion has been archived. No new comments can be posted.

When a CGI Script is the Most Elegant Solution

Comments Filter:
  • by AmazingRuss ( 555076 ) on Sunday March 04, 2007 @01:15PM (#18227402)
    I don't buy the distribution thing...you have to distribute a link, and you could just as easily distribute a small downloader/installer, and build an auto updater into the app. With a web app, you also download your code with every single page. Graphics. HTML. Javascript. Every single time.

    Then there is the joy of browser compatiblility. You start out saying, oh, we will only support browser X...but it never sticks...and your regression testing grows geometrically with each browser and version of browser you support.

    If you have a simple form/submit application, or you don't control the workstations you will be deploying the app on, then a web app makes sense. Otherwise, a high level language running directly against an SQL server is the way to go. It's no harder than writing a web app, and you get much better response time and control.

  • by Shados ( 741919 ) on Sunday March 04, 2007 @01:25PM (#18227484)
    things like Java Web Start or .NET's ClickOnce solve the distribution issue. The advantages of the web are more lightweight UIs, easier to distribute to -third partys-, and better cross platform compatibility (even compared to Java). Easier update and maintenance, not so much.

    Im working for an (extremely large) company that decided on web apps for the deployement thing alone, without needing (or -wanting-) any of the other advantages. So we have slow, bloated, IE6-only web apps. Hey, its easy to deploy. Has the users cursing non-stop and wanting us dead. But its easy to deploy!
  • by skoaldipper ( 752281 ) on Sunday March 04, 2007 @02:05PM (#18227856)

    Why not just use the command line? I didn't see anything in this article that would exclude its usage...
    There's nothing necessarily wrong with that approach. However, as a practical example, I worked for Insurance companies and we developed software initially using nothing but DOS. However, even for simple form processing, it was quite a task (especially when each vendor had their own specific designs for their property and casualty policies). Just to rearange those items even from a given template (or using a suite of library tools like curses) it was an ordeal at times fitting (for example) UMBI (Uninsured Motorist Bodily Injury) with UMPD (...Property Damage) across a FIXED 80 column screen. And some companies would insist it be that way. It was like squeezing a small child out of a birth canal at times. Even when migrating to a full blown OO GUI, the design requirements and scope was not all that much different (or resource conserving).

    IBM said it best wrt scaling,

    When you add in the possibility of needing to rework the application for a larger (plural!) audience, it pays off even more.
    at least for our specific requirements it did.
  • Re:Ugh (Score:3, Informative)

    by 93 Escort Wagon ( 326346 ) on Sunday March 04, 2007 @02:13PM (#18227912)

    If they meet the following restrictions, they *might* be considered equal:

    1) Does not use Java.
    2) Works on multiple browser, including future versions of IE which may have more strict security settings.
    3) Does not require any client-side settings to work. (For instance, lowering security settings, turning off the pop-up blocker, etc.)

    But every web-app I've ever had to maintain in a corporate environment violated every one of these rules.
    A few points:

    1) These are not rules, these are your own biases.
    2) I share bias #2.
    3) We're talking specifically about intranet apps here. In an intelligently-managed workplace, having to customize the client shouldn't be particularly onerous (it's not like the IT folks should have to walk to each computer and do everything by hand anymore, if you're managing things correctly). The particular modified settings you list should be no-nos, in my opinion. But, say, requiring JavaScript should not be considered problematic (that does NOT, of course, require client modification; I mention it because of some /.'ers biases against anything that won't run on Lynx or Netscape 1.0)

    A big part of my job is writing custom web apps whose target audience is just my department's coworkers (or, occasionally, members of the wider university community). In most cases, it's being done to replace an existing paper-based system. In addition to a shorter development period, another advantage to web apps is that almost everyone nowadays is familiar with the web interface. Additionally, if done correctly you remove any OS lock-in. I develop and test for Firefox on my Mac; but many/most of my co-workers are running Windows (and usually Internet Explorer) - THAT'S an advantage writing a full-blown GUI app almost never has.

  • Have a look at SWILL (Score:3, Informative)

    by Diomidis Spinellis ( 661697 ) on Sunday March 04, 2007 @02:30PM (#18228064) Homepage
    If you plan to expose your application's GUI through a web browser, have a look at SWILL [sourceforge.net], the Simple Web Interface Link Library. With a couple of function calls you can add a web front-end to any C/C++ application. I've used it for adding a front end to the CScout [spinellis.gr] source code analyzer and refactoring browser, and for implementing a wizard-like front-end for a stochastic production line optimization toolkit; I also supervised a student who worked on a SWILL-based gdb front end (unfortunatelly he didn't finish it).

    SWILL is great for adding an interface to legacy code, because its impact on the application can be minimal. I wouldn't recommend its use if your GUI requirements are above what can be implemented in a dozen web pages.

  • by Dragonslicer ( 991472 ) on Sunday March 04, 2007 @03:16PM (#18228458)
    I'm gonna have to agree with Opera on this one. onunload is the source of annoying pages and advertisements that can only be closed by killing your browser process.
  • Re:Ugh (Score:5, Informative)

    by pjt33 ( 739471 ) on Sunday March 04, 2007 @03:32PM (#18228578)

    The only solution is to write a new internet protocol (not HTTP) designed specifically to run apps from a server...
    You mean like X?
  • by plams ( 744927 ) on Sunday March 04, 2007 @05:16PM (#18229470) Homepage
    "But which bits of java script are fancy and which are not?"

    This is actually quite easy. Stuff that relates to the DOM often differ from browser to browser while the core language does not. This is somewhat similar to the fact that you can compile and link ANSI-compliant C on virtually any platform as long as you don't do anything platform specific.

    At work I recently developed a JavaScript framework for calculating text length that had to take variable character widths and hyphenation into account. The idea is that the user can type away in a standard TEXTAREA field and know when some predefined text area in a PDF document is full. I think the code ended up as 500+ lines of JavaScript code, but the ONLY browser specific problem I ran into was a subtle difference in the parsing of arrays; Firefox would treat the statement [1,2,3,4,] as an array with the length of 4, while Internet Explorer would say the length was instead 5 (and the last value was "undefined", if I recall). I gather that the reason why browser independence came so painlessly was that 95% of the code was just text processing and number crunching anyway. I doubt I'd have the same luck if I tried to do a WYSIWYG editor since it would have a great more interaction with the DOM.

  • Re:What about PHP? (Score:4, Informative)

    by VGPowerlord ( 621254 ) on Sunday March 04, 2007 @06:38PM (#18230526)
    As another user stated, CGI is a specification. One that PHP uses if it's compiled as a CGI binary [php.net] or emulates if it's installed as a web server module. $_SERVER [php.net], for instance, is populated mostly with CGI Environment variables. $_GET is a processed version of the CGI QUERY_STRING variable. $_COOKIE is a processed version of the the CGI $COOKIE (and possibly $COOKIE2) variables. The $_FILES array is filled with the parts of a multipart/form-data input that have a filename= section. This comes from a POSTed form (which uses STDIN as per the HTML and CGI specs).

    Need I go on?
  • Re:What about PHP? (Score:3, Informative)

    by llefler ( 184847 ) on Sunday March 04, 2007 @08:54PM (#18232024)
    Many servers do not have CGI

    Why would a server NOT have CGI? Unless what you really mean is the developer doesn't have CGI access on the server. I'm not sure you're understanding what CGI is. It is NOT perl. It is NOT PHP. Although both can be used. My cgi-bin is full of custom EXEs.

    In simple terms, here is how CGI works; dynamic information from the client is passed to a process launched by the web server through environment variables and command line. An application runs natively on the machine, such as a script processor like perl/PHP or any appropriately written executable. The output of the application is sent to stdout and that is redirected to the client.

Software production is assumed to be a line function, but it is run like a staff function. -- Paul Licker

Working...