Sunday, March 18, 2012

Effective Scala video with Josh Suresh

Just saw Josh Sueresh's talk posted on YouTube identifying "Effective Scala" (not a book, just a video) much of which is in his almost released book, "Scala in Depth". Awesome stuff!

In other news, Scala is quickly promoting from Trial to Adopt in the ThoughtWorks industry survey (item 98 in the image to the right). This is a HUGE deal in terms of future development, contract and job opportunities. I couldn't be happier to be riding this wave. It's going to be as good or better than even the Java wave I rode in 1998-2006. Yeeehaaa!

Thursday, March 8, 2012

What draws me to Scala...

I just ran across this article, "Comparing Java and Scala’s Expressiveness". It so succinctly describes how I feel as I learn Scala. It's not just the reduced boilerplate. It's something about feeling like I am doing more real software engineering work as opposed to a huge amount of paperwork (boilerplate) with a tiny amount of actual software engineering!

Sunday, February 26, 2012

A core principle behind functional programming...

I just stumbled upon a Wiki link on twitter about "Persistent data structure". After reading it, I think this is one of the essential implementation points behind any functional programming language, including Scala. Now, I just have to figure out how to think like this for myself as I design and implement my own programs. I'm learning so much as I get deeper and deeper into Scala and functional programming.

Monday, January 23, 2012

Functional Programming, Scala, LWJGL, Space Invader (note the lack of plural) and Programmers Exchange...

I've been mulling on the problem of how one might go about writing a simple video game, like Space Invaders, in Scala (using LWJGL) in as pure a functional programming design approach as possible. I'd planned to write my post shortly after Thanksgiving. However, I let the merrymaking of the holidays get the better of me and postponed writing the post.

Finally, on the way home this evening, I decided to spend at least 5 minutes writing up a question to post on Stack Overflow. Then, when I went to go about generating the post, I realized that Stack Exchange (the parent site of Stack Overflow and many other sites analogous to Stack Overflow) had a site more suited to my general question, Programmers Exchange. I then spent the five minutes writing the start of a post. And now, +2 hours later, I finally hit the submit button.

You can find the resulting post here. I'm looking forward to all the learnin' headed my way. I have the uncomfortable feeling I am going to feel a whole lot stupider around functional programming and Scala before I begin to grow the feeling of confidence emerging from nurturing my growing competence confidence. Or something like that, anyway. {smirk}

Tuesday, November 22, 2011

LWJGL, full screen and Win7 issue...

Summary:
I couldn't get full screen mode to work. The spaceinvaders demo app (provided right in the LWJGL download) would just silently crash straight back to Eclipse. There was no error output at all. It turns out Direct3D doesn't work well with Vista/Win7. And there's a simple VM argument to turn it off, "-Dsun.java2d.d3d=false". 


Details:
Ah, the joys of computer configuration complexity. It ensures I spend lots of time on damn near useless tangents. After a nice time burn like this, I so can see why developing for only one specific platform can be quite desirable. Anywho...

So, in my quest towards writing a space invaders clone in Scala, I decided to first get the space invaders Java application supplied as a demo in the main LWJGL download's demo folder. I was able to get all the .java files copied into the proper path. And then was happy when it worked first time with almost no editing. I did go and clean up several warnings that were shown by the compiler.

And then I decided to try and turn on full screen mode (as opposed to the windowed mode that was the default). The application would clearly start, appear to get close to running (full screen of black would appear) and then it just sat there until I clicked with the mouse. Then it would crash right back to Eclipse with no error output whatsoever. Quite frustrating.

After spending several hours slowly going through the code placing copious amounts of System.out.println() statements and lots of try{...} catch (Throwable t) {t.printStackTrace()}, I finally narrowed the intermittent failures down to a line in LWJGL itself, Display.sync(60). I have the LWJGL source attached so I can examine the related source code easily.

After examining the code for sync() and then evaluating whether I wanted to go to the trouble of making the LWJGL source editable, I decided to stop and see if I could Google and see if anyone else was having the issue. It only took 5 minutes using the starting search terms of "LWJGL full screen crash" to discover a possible answer on a forum message thread (related StackOverflow topic). For Vista/Win7, I must pass a VM argument of "-Dsun.java2d.d3d=false" to turn off Direct3D. Of course, as soon as I did that, everything sprang up and worked like a charm.

Lesson Learned:
Google with simplest set of key words as soon as possible. It might save a whole bunch of time attempting to isolate an intermittent issue.

Sunday, November 6, 2011

I'm back from my gaming hiatus...

I've been away enjoying my personal time. I have not done anything related to coding other than my standard JavaEE stuff at work. I've kept studying all the Scala blogs and have been following the Scala tag on StackOverflow and CodeReview sites. I've continued to want to dive right in and just start coding. It is so obvious to me that I would find designing and writing code very enjoyable in Scala. And I am slowly finding it more and more laborious to produce all the boilerplate necessary when I coding in Java, even with the assistance of code completion and code generation tools in Eclipse.

As I am returning to creating time to play directly with Scala again, I am not finding myself all that motivated to continue on the Life project. I don't want to code a little and then blog alot. It just feels too much like doing Java boilerplate; a huge amount of writing with a very small portion that actually does the interesting work. So, for now I am postponing my Scala Life project. I will very likely return to it.

I am finding myself interested in playing around with Scala and creating a simple retro style video game (from the early 80s); Asteroids, Space Invaders, PacMan Missile Command, Defender, etc. These are the games I initially reproduced when I started learning to program on the TI99/4a 30 years ago. And I don't care that there are hundreds of variations of these games. I am not writing it to be consumed by anyone else. I am writing it to feel the delight of achievement, the thrill of viceral learning, the joy of being playful yet inquisitive while minimize the occurrences of and duration of breakdowns, frustrations (configuration challenges, deployment errors, etc.) and technical challenges.

I have spent about 8 hours researching how to go about writing an OpenGL game using Scala. I looked at a number of possible game engines. And it turns out there is an interesting project called LWJGL (LightWeight Java Game Library) which ties together all sorts of C++/C libraries and APIs such that Java programs can utilize them. And anything Java can utilize, Scala can also. So, I am going to do a Scala + LWJGL project. And for now, I am planning to write a very simple version of Space Invaders. Whoohoo!

Wednesday, July 27, 2011

Odersky talk (16 minutes) at OSCON...

Typesafe and Martin Odersky are working very hard on the parallel and concurrency problems. And all in Scala. This talk is so exciting as it shows how wide and deep they are approaching the problem. And how Scala's unique OO + FP approach to software engineering is ideal for this problem domain.