• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Bear Bibeault
  • paul wheaton
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Mikalai Zaikin
  • Piet Souris
Bartenders:

For fun - a poor man's code beautifier

 
Saloon Keeper
Posts: 10481
83
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27
1
IBM DB2 Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 10481
83
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27276
193
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 10481
83
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Downloads section of the link you provided gives a 404 error.
 
Tim Holloway
Saloon Keeper
Posts: 27276
193
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I am not young enough to know everything. - Oscar Wilde This tiny ad thinks it knows more than Oscar:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic