• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

For fun - a poor man's code beautifier

 
Bartender
Posts: 7050
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Time and time again I see Java beginners not taking the time to clean up their code before posting it so I whipped up this very rudimentary code beautifier "Indentify". My beautifier of choice is the Eclipse IDE but most beginners haven't gotten to the point of using IDEs yet.  Maybe, just maybe, this will help someone out and make our collective lives easier.

 
Greenhorn
Posts: 23
1
IBM DB2 Netbeans IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tend to do something like shown below for the beginning { and ending }...
But the most important question is "Did you use spaces or tabs?"

LOL


 
Carey Brown
Bartender
Posts: 7050
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Michael Billiot wrote:I tend to do something like shown below for the beginning { and ending }...
But the most important question is "Did you use spaces or tabs?"
LOL


Four spaces (not tabs) per indent level. Would be trivial to substitute tabs if you wanted.

Ah, yes. K&R style. Depending on my audience, I've used both. I find the "one brace over the other" style to be helpful to beginners. It was also easier to make a beautifier for.
 
Saloon Keeper
Posts: 21941
149
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I used Jalopy (http://jalopy.sourceforge.net), which actually blows away the built-in IDE beautifiers when it come to customization. It ran stand-alone or as a plug-in to most popular IDEs. Could even be set up to do batch processing to enforce formatting on entire projects.

Originally, and in the SourceForge version, it was free software. It seems to have been converted to commercial software now ($40/seat). And it may be orphaned entirely now, alas - last update seems to have been in 2010.
 
Carey Brown
Bartender
Posts: 7050
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
 
Tim Holloway
Saloon Keeper
Posts: 21941
149
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:The Downloads section of the link you provided gives a 404 error.



He moved it to github - there's a link (jalopy2).

Although I'm not sure exactly what the project builds - most of what I saw in there was interface code, not anything that looked like parsing and formatting.
 
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic