My current interest is Android development. I've put all of my other projects on hold for this too! This isn't the first time I've done Java, in fact I have done a lot of Java before. The thing is though, that I don't remember the last time I had to use sooo much XML! Maybe never. JSON has been apart of my development life for years now, and it's always given me a feeling of resentment towards XML. It's too clunky and bulky, like a rusty old machine.
Maybe I'm just looking at it with the wrong set of eyes. As a web developer, XML means extra overhead, no built-in data types, large file sizes, extra parsing, and non-native support (in most cases). So beginning my first serious Android project, I'm hating XML before I get the chance to understand it's true potential. Truth be told, I'm starting to see how great it can be for certain instances.
Is it just me, or do Java developers love them some XML??? They may be the only ones keeping it alive; they're also keeping Java from getting buried, so they may be used to it. (jk)
I will say that it is very cool to be able to create an entire layout in one XML file! It's extremely versatile, and super flexible. One can change the Look & Feel without having to go into any code. Great! The major headache with this though, is the learning curve. For instance; the widgets, their attributes, layout types, and all of the different pieces used to put these applications together. Like; activities, intents, providers, services, and adapters. Mamma mia!!
Okay, these concepts are not completely foreign to me, having done Java before, but I guess it's been awhile. The structure and elegant design patterns have always intrigued me. In fact, I apply a lot of those patterns within my web applications. Though, sometimes enough is enough. Don't make it complex for the sake of being complex.
So far though, I do prefer iPhone development over Android. The tools that Apple gives you are insanely easy to use. I'm not a designer, so I don't want to spend all of my time on the UI, and using the interface builder, I can easily get most of the Look & Feel taken care of, so that I spend my time where it matters...coding!
Also, one can harness the power of C/Objective-C for their apps. Mmmmmm, speed. While going through Android tutorials, I was a bit discouraged when I saw articles titled, "How to optimize your Android loops", or "How to design for performance". Seriously?!?! I haven't even started yet, and I have to worry about that? I already optimize the hell out of anything that I make, but telling me off the bat that the application is going to need to be optimized is a bit sad. Oh well, it's Java, so what should I have expected?
I'll keep updating this as the project progresses. Perhaps my opinions will change!
PS - I'm aware that Android !== Java, so don't waste your time.
Showing posts with label java. Show all posts
Showing posts with label java. Show all posts
Monday, October 26, 2009
My First Android Experience...meh.
Labels:
android,
canvas,
development,
iphone,
java,
json,
objective-c,
xml
Monday, September 14, 2009
Facebook Puzzles
Programming is like an art. If you don't practice you cannot evolve. I've been doing web applications for a few years now, with a little bit of actual software development in between. So, it was nice to have a challenge and try out a Facebook Puzzle. You can find them here. They're available in all different flavors, with a hierarchy of difficulty levels. I chose to try out dinoisland. Why not, right? Let's get into the good stuff, no need for the hors d'oeuvres.
To get setup, I had to install Thrift. That way, the actual code library could be compiled in, pretty much, whichever language I desire. Initially, I started with PHP, because that's what I've been using a lot lately, and I feel as if I've close to mastered it ;) I found difficulty with it because it seemed as though it lacked power, especially for a client that I knew would need to be threaded. After a day with PHP, I gave up, and switched over to Java. What a relief! Aside from the AI part of this puzzle, it felt like this project was meant to be programmed in Java. If I knew LISP, then I would have used that, but...meh, I'm busy right now with the puppy and work.
My approach for the Java application was to divide the solution up into different portions;
As it turns out though!! None of that was necessary. While still testing, brute force, and strength in numbers seemed to be adequate enough. I had my dino's grow to level 2 instantly. This way, they could eat more plants, gain more calories, and be less susceptible to getting beat up. The only logical pieces implemented were;
To get setup, I had to install Thrift. That way, the actual code library could be compiled in, pretty much, whichever language I desire. Initially, I started with PHP, because that's what I've been using a lot lately, and I feel as if I've close to mastered it ;) I found difficulty with it because it seemed as though it lacked power, especially for a client that I knew would need to be threaded. After a day with PHP, I gave up, and switched over to Java. What a relief! Aside from the AI part of this puzzle, it felt like this project was meant to be programmed in Java. If I knew LISP, then I would have used that, but...meh, I'm busy right now with the puppy and work.
My approach for the Java application was to divide the solution up into different portions;
- Client - connects to the server and creates an instance of our dinosaur, then threads it off to do it's own thing.
- NPC - This would be our dinosaur, a non-player character. This guy handles it's own state, communicates with the server directly, and decides it's next moves. There is also a history object which contains all of it's recent actions, and path history.
- ActionFactory - We are allowed 4 different actions in this puzzle; move, grow, look, and egg. Their is a handler for each of those actions, and the AF abstracts the process of handling those, and determining a result.
- Action Handlers - The handler analyzes the result from the server, and returns the current state. It also determines a suggested next action, based on the results it receives.
- ResultAction - a simple class created in order to store valuable info about the dino's actions.
- Directions - Methods were added to help with navigation. For example, if my dino needed to turnLeft, turnRight, turnAround, or even go in a random direction.
- History - keep track of our actions, and our movement history.
As it turns out though!! None of that was necessary. While still testing, brute force, and strength in numbers seemed to be adequate enough. I had my dino's grow to level 2 instantly. This way, they could eat more plants, gain more calories, and be less susceptible to getting beat up. The only logical pieces implemented were;
- if your movement returns false, turn to the right (if we hit a rock or big plant)
- if we have n number of calories and are a size s, we should grow
- if we have n number of calories, let's lay an egg
Labels:
client,
dinoisland,
Facebook,
java,
npc,
php,
puzzles,
software engineering,
threading
Subscribe to:
Posts (Atom)