The Artima Developer Community
Sponsored Link

Java Buzz Forum
Imagine if Java got rid of semi-colons; and those {brackets} ?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Russell Beattie

Posts: 727
Nickname: rbeattie
Registered: Aug, 2003

Russell Beattie is a Mobile Internet Developer
Imagine if Java got rid of semi-colons; and those {brackets} ? Posted: Mar 18, 2004 6:51 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Russell Beattie.
Original Post: Imagine if Java got rid of semi-colons; and those {brackets} ?
Feed Title: Russell Beattie Notebook
Feed URL: http://www.russellbeattie.com/notebook/rss.jsp?q=java,code,mobile
Feed Description: My online notebook with thoughts, comments, links and more.
Latest Java Buzz Posts
Latest Java Buzz Posts by Russell Beattie
Latest Posts From Russell Beattie Notebook

Advertisement
I ran across Joel-on-software's comments on Python (boils down to "I don't know jack about the language, but the indentation thing is cool!") and I thought about Java doing the same exact thing. Change nothing else but make indentation count. Suddenly Java looks really clean!

Here's a Java Servlet with indentation:


import java.io.*
import javax.servlet.*
import javax.servlet.http.*

public class HelloWorldServlet extends HttpServlet 

	String content = ""
	
	public void init(ServletConfig servletConfig) 
		throws ServletException 
	
		content = "This is some content"

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException

		response.setContentType("text/html")
		PrintWriter out = response.getWriter()
		
		out.println("<html>")
		out.println("<head>")
		out.println("<title>Hello World</title>")
		out.println("</head>")
		out.println("<body>")
		
		out.println(content)
		
		for(int x = 1; x < 10; x++)
		
			out.println("Testing!")
				
		out.println("</body>")
		out.println("</html>")
	

	public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
		
		content = request.getParameter("content")
		doGet()
		
	
Damn, that looks pretty clean! Notice I didn't get rid of *all* semi-colons, just the ones at the end of statements and it's pretty cool. I actually grabbed a much bigger class file that I have and formatted it, then got rid of the {}'s and ;'s and it too was very clean.

Not that this would ever happen, but it'd be cool.

-Russ

Read: Imagine if Java got rid of semi-colons; and those {brackets} ?

Topic: Open Source Treasure Previous Topic   Next Topic Topic: MySQL Tips and Thoughts

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use