- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: Scala Ladybug
Tue, 2009-01-27, 23:44
>>>>> "Samuel" == Samuel Robert Reid writes:
Samuel> I was hoping someone would give constructive criticism about
Samuel> how to improve my Scala style; some of my code feels like it's
Samuel> a bit like Java in Scala syntax. Also, I'm not sure I'm taking
Samuel> advantage of all of Scala's abilities to help me produce
Samuel> concise, robust, legible code (or whether I'm abusing any of
Samuel> the language features). I posted my code here with a syntax
Samuel> highlighter:
Samuel> http://www.colorado.edu/physics/phet/dev/moving-man/1.20.17/source/
This is a very cool little app! It's a little too much source code in
too many little files for me to sort through all of it... are there any
particular places in the code that you suspect could be improved?
I did look through LadybugModel.scala and I notice a lot of methods
like:
def setUpdateModePosition = updateMode = positionMode
def setUpdateModeVelocity = updateMode = velocityMode
def isPlayback() = !record
def isRecord() = record
and so on. Maybe you could just get rid of all that? It doesn't seem
to really add anything.
If you need getters and setters in order to interact with some Java
code, you can put a @BeanProperty annotation on a val or var and the
Scala compiler will generate them for you.
If I have any other more specific questions, I'll let you know.
Thanks again,
Sam Reid
Seth Tisue wrote: