Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why is scripting Bad  RSS feed

 
James Winfrey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers

Scripting is considered bad and we go for EL, JSTL, Custom tags?

Is there any other reason apart from web designers not knowing java?

Thanks
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I don't think this is a point to do with web designers not being able to do Java. I can know Java and even then if I'm styling a web page I would rather not be scrolling down pages and pages of code, trying to find where I put some option tag in so I can choose it's class [that's HTML class not java class].

If you are using the MVC pattern this this is your View and you are using it to display the data from your Model objects on the page. You don't want to have business logic built into your JSPs.

I'd say it also makes the code more difficult to maintain and reuse.

Sean
 
James Winfrey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sean
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this article will help.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another Big Deal, at least for me, is that by keeping the Java code isolated in Java files it's *substantially* easier to test, refactor, modify, etc. Plus it gives the developer(s) one less place to look for behavior.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Minor language point:

You probably meant to say "Why are scriptlets bad?"

Scripting is good. Unix admins script solutions all the time to automate tasks that need to be performed a lot.
Many great programs started as prototypes written in scripting languages.

I would argue as well that scriptlets themselves aren't bad. It's the misuse of them that makes large projects unmaintainable.


 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Although I'd add the caveat that almost any usage of them is a mis-use--I can't think of very many usecases where they're a good idea.)
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll never find a scriptlet in a production app of mine, ever.

They are useful for diagnostics, and some maintenance tasks though.
I have a folder full of small JSPs that dump memory usage, session info for the current app, etc. to the screen.

I treat them the same way I treat shell scripts.
They're also useful as a learning tool. Obviously not for learning how to write production JSP code but if you want to demonstrate a concept to someone it's nice to be able to show the whole thing in a single page.

The Post-Return-Get example that's been in our JSP FAQ for years is a good example.
 
James Winfrey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear, Ben and David for your inputs
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!