Archive for the ‘intellij’ tag
IntelliJ: Adding resources with unusual extensions onto the classpath
We’re making use of MarkLogic and therefore xquery on the project I’m currently working on and recently wanted to add our xquery setup files onto the classpath so they could be used in a test.
We added them into ‘src/main/resources’ and set that as a source path in IntelliJk assuming that was all we needed to do.
Despite doing that our test kept failing because it couldn’t locate the files on the classpath.
Charles eventually came across the compiler resource patterns settings which are accessible from the Preferences > Compiler menu:

We had to add “*.xqy” to the end of the list of patterns to get our files picked up.
We came across another file extension that we needed to be on the classpath about 10 minutes later and obviously solved it much quicker that time!
IntelliJ style item tracking in Visual Studio
One of my favourite features of IntelliJ is that it tracks the item that you currently have open on your Solution Explorer.
I thought this wasn’t possible in Visual Studio and had resigned myself to trying to remember which project each file was in. Luckily for me a colleague pointed out that it is in fact possible but is just turned off by default.
Tools > Options > Projects and Solutions > Check ‘Track Active Item in Solution Explorer’

Job done!
Do IDEs encourage bad code?
Although modern day IDEs (Eclipse, IntelliJ, Resharper etc) undoubtedly provide a lot of benefits when writing code, I am starting to wonder if the ease at which they make things possible actually encourages bad habits.
Useful features such as creating and initialising member variables from the definition of a constructor are quickly nullified by the ease at which one is able to create getters/setters/properties for these same member variables. All hopes of encapsulation gone with a few clicks of the mouse.
The counter argument is that you need to work responsibly when given a powerful tool, but it just seems to me that it’s hard enough to write good OO code (too hard maybe?) – anything which makes it harder is not a good thing!
I am convinced that IDEs need to provide an Office paper clip style Martin Fowler which pops up whenever you do something questionable (such as creating getters for every field on a class) and asks whether you really want to do what you’re doing.
Or maybe there is too much cranking out of the code and not enough thinking about the design of what we’re coding that’s the real problem…