[MT] New Maptool java contributor

Progress reports and musings from the developers on the current gaming tools.

Moderators: Azhrei, dorpond, trevor

Post Reply
d4rkAlf
Cave Troll
Posts: 35
Joined: Thu Apr 16, 2015 9:48 am

[MT] New Maptool java contributor

Post by d4rkAlf »

Hello everyone!

I've only quite recently found out about Maptool and I'm already quite fond of it. I've been on the lookout for an open-soure project that I can contribute towards for quite some time. So it was with great delight that I discovered Maptool!

Short introduction: I'm a 26 year old male from Lund in Sweden. I'm in my final year of acquiring a bachelor's degree in computer science. However, long before I even considered a career in computer science I was having fun with my friends role playing. It started out with Vampire: the Masquerade and GURPS Bunnies & Burrows. Since then I've had the time to try out a lot of different role playing games including D&D4e and a couple of different indie games.

I have snagged task 15.5 (setTokenheight/width) and it's almost complete. I have a couple of questions though:

1. Are there any specific style guides I should follow? I've been looking at the code and trying to follow its example, but it seems to be inconsistent in places.
2. What kind of Object is the method childEvaluate in TokenPropertyFunctions supposed to return? More specifically in this case where the function is a "set-method"?
3. All JUnit test cases don't pass when I try to run them, despite using an unmodified clone of the repository. Is the repo "dirty" or is there something wrong on my end?
4. How do we handle automatic regression testing? I'm trying to write a JUnit test case for task 15.5 but I keep getting errors/exceptions.

d4rkAlf
Cave Troll
Posts: 35
Joined: Thu Apr 16, 2015 9:48 am

Re: [MT] New Maptool java contributor

Post by d4rkAlf »

I think I've found the answer to question 2 at least. Most "setters/set-methods" in childEvaluate simply return an empty string upon completion. The notable exception being setSize which returns the new size.

Also, I'd like to apologize in case I have posted this to the wrong sub-forum. As a newly registered user I don't have access to all forums and this was the one that seemed the most appropriate.

User avatar
RPTroll
TheBard
Posts: 3148
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: [MT] New Maptool java contributor

Post by RPTroll »

Awesome to have you on board.

No worries on the wrong subforum. One of the moderators will straighten it out at some point. :)

Craig is our lead developer. I'll make sure he knows you're here. Jamz has been contributing quite a bit and may be able to answer questions as well. Jagged is yet another that might be able to help. Az may chime in as well, time permitting.

Thanks for picking up the task. I'll mark it in the spreadsheet as snagged.

Cheers,
Troll
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
Azhrei
Site Admin
Posts: 12050
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [MT] New Maptool java contributor

Post by Azhrei »

d4rkAlf wrote:Hello everyone!

Welcome, Dark. :)

1. Are there any specific style guides I should follow? I've been looking at the code and trying to follow its example, but it seems to be inconsistent in places.

Yeah, it's a little bit of a mess. When I inherited it there were two or three different indentation styles and a few things I didn't like (like a line length of 200 chars!) so I gradually changed the styles as I worked on a particular file and checked it in.

There is a preferences file floating around somewhere that when imported into Eclipse will supposedly set the formatting configuration in a way that you should be able to highlight an entire file and choose "Format", but I've had reports that it doesn't do anything when imported by others. Don't know what to say about that; it works for me and I just exported what I have...

2. What kind of Object is the method childEvaluate in TokenPropertyFunctions supposed to return? More specifically in this case where the function is a "set-method"?

Sounds like you've got this one.

There's not a lot of JavaDoc for some modules; that's another thing I was trying to correct. When I had to edit a module, I'd try to go back and add JavaDoc for the class itself and the public methods in the class. But again, I didn't get through all of it.

3. All JUnit test cases don't pass when I try to run them, despite using an unmodified clone of the repository. Is the repo "dirty" or is there something wrong on my end?

As far as I can remember, the unit tests never worked for me. And to be honest, most of the parts I worked on were UI pieces and those are hard to unit test so they didn't get much love. I was planning to implement a bunch of unit tests for the UPNP stuff but ran into a snag because the lower level library (sbbi-upnp) didn't have any techniques for dependency injection. :(

4. How do we handle automatic regression testing? I'm trying to write a JUnit test case for task 15.5 but I keep getting errors/exceptions.

First of all, let me say I'm glad you're interested in writing tests! It hasn't really been a priority on this project and it would be nice to be a little stricter about it in the future. I've pretty much stepped to the side and it's been Craig pushing things forward so he'll be the person setting the rules for that stuff.

I seem to recall that much of the code base is difficult or impossible to test because of the lack of DI interfaces. We're always looking for improvements!

There are, for example, still many areas that need to be localized. We had a user who was going through and extracting the strings for placement in a .properties file (which is automated in Eclipse) but it's a long and hard road so only 10-20% of it was completed, IIRC.

Anyway, welcome to RPTools! Thanks for pitching in!

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [MT] New Maptool java contributor

Post by JamzTheMan »

Welcome aboard!

It truly is a project of done by many developers over many years so 'style' will eb and flow. For formatting code, like Az said, it's a pain to keep in sync and personally think near impossible to enforce, everyone has a style they like. I'm looking into a Gravin plugin that can at least reformat the code on checkin so the git compare will be better.

As for general style, I try and keep things coded like existing if possible and made since but otherwise was more concerned with working code. :)

regarding docs and unit tests, ya, I'm bad with that to. I try and note new functions or line comment hear and there but never bothered with ūnit tests. If someone leads that effort and sets standards I'll try and follow em. ;)
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: [MT] New Maptool java contributor

Post by Jagged »

Welcome. Always nice to log in to my email and see a Pull Request merged :)

d4rkAlf
Cave Troll
Posts: 35
Joined: Thu Apr 16, 2015 9:48 am

Re: [MT] New Maptool java contributor

Post by d4rkAlf »

JamzTheMan wrote:Welcome aboard!

It truly is a project of done by many developers over many years so 'style' will eb and flow. For formatting code, like Az said, it's a pain to keep in sync and personally think near impossible to enforce, everyone has a style they like. I'm looking into a Gravin plugin that can at least reformat the code on checkin so the git compare will be better.

As for general style, I try and keep things coded like existing if possible and made since but otherwise was more concerned with working code. :)

regarding docs and unit tests, ya, I'm bad with that to. I try and note new functions or line comment hear and there but never bothered with ūnit tests. If someone leads that effort and sets standards I'll try and follow em. ;)
Yeah, I totally understand that the style will vary wildly. I was mostly worried that a new standard had possibly been set recently and I would come in like the new kid on the block and make a fool out of myself.

I also totally get that people prefer to write functional code rather than tests and documentation. While I like having automatic tests and documentation I'm not really committed enough at this moment to lead any effort in that area. :roll:

Nota bene: The one "style" thing I've found useful so far is to remove trailing whitespace. It makes it easier to read the output from 'git diff' since you won't get any lines where "nothing" has changed. (E.g. there was a space or tab on an "empty" line that since got removed) In Eclipse it's easy to automate by going into the preferences and then: Java -> Editor -> Save Actions -> Make sure "Additional actions" is ticked -> Click "Configure..." -> Tick "Remove trailing whitespace" and select "All lines". After that Eclipse will remove any pesky whitespace every time you save.

Jagged wrote:Welcome. Always nice to log in to my email and see a Pull Request merged :)
Haha, good to hear! :D

Post Reply

Return to “Developer Notes”