Wednesday, February 29, 2012

On My Own Programming Today

Following the intense spirit of "GETERDONE", I decided to take some initiative and start to implement some interfaces on my own, rather than wait for my pair programming sessions to occur.

So far, I've implemented two things:

BasicTemplateableString(implements TemplateableString)
I felt like this interface was lacking some setters, so I decided to add those
since it made sense to me to be able to reset a component's default string,
even after creation.

I tested for basic functionality, and that when something was null that null pointer exceptions were being thrown.

I also tested the behavior correctness when the "hasReplacement" boolean was set to false.


BasicGameSession (implements GameSession)
This class proved trickier than I thought.

For starters, the test for this class is only one test (which makes me kind of nervous). All it does it test that when the addAction(GameAction ga) method receives a null value, a NPE will be thrown.

I had no idea how to test for correct behavior, since there are no getters and setters to see what the undo and redo stack for a game session will be.

When I first looked at the interface, all it had was getGame() and getGameActions(), which returned a list.

I felt like the GameSession should handle undoing and redoing actions on it's own, rather than leaving that to some other component.

And now that I'm writing about it, I Feel like game action should have way of storing all the actions ever performed, in order to be able to retrieve them easily for the ActionEvent log which will be returned to the Designer. But anywho....

I changed the GameSession interface to have a undoAction, redoAction and addAction(GameAction) methods.

I had never done a undo/redo stack, and since I had no way of testing it, I made a scratch file in another package, in which I had an undo stack, redo stack, and add method. These took strings, and they would print after every step. Below, I'll attempt to explain how things came to be.

Initialized to empty

[U]: THE UNDOABLE STACK
[R]: THE REDOABLE STACK


Added strings (one,two,three)
[U]: one 
[R]:
[U]: one two 
[R]:
[U]: one two three 
[R]:


Undid 2 actions.
[U]: one two 
[R]:three 
[U]: one 
[R]:three two 

Redid 3 actions, the third one did not have any effect
[U]: one two 
[R]:three 
[U]: one two three 
[R]:

Undid another action
[U]: one two 
[R]:three 

ADDED AN ACTION (four) which, in my mind, should reset the redo queue
[U]: one two four 
[R]:

Undid 3 actions
[U]: one two 
[R]:four 
[U]: one 
[R]:four two 
[U]: 
[R]:four two one 

Since the correct behavior of undo/redo stacks wasn't clear to me, I played around in eclipse by typing, then undoing the typing of 3 lines, and redoing them 3 times (then I noticed the 4th call wouldn't let me redo anything). Then I undid 2 of them, and typed a new line. I noticed the REDO option wouldn't do anything after I added a new thing, which coincides with how my scratch program worked.


Pair Programming Sesh #8


GOAL:
To implement the Game interface and write tests

What Happened:
We were able to create a BasicGame. We also changed a little bit of the interface,
since we felt that Game had to also be able to set some stuff, which wasn't previously defined.

Problems
No problems at all.

What's next?
To reach our goal of having something cool to show off for monday! and not die in the process!

Thursday, February 23, 2012

Pear Brogramming Sesh SEIS

Planned:


Joe and I had planned to work on the Multiple Views / Join multiple views Spike.

Happened:



After looking at the previous spike, we decided that spike already did what we wanted. We felt like, for play testing, you could be able to look at both Public and Private views. You could select which private views you would want to look at, by just going through the tab and selecting which views to look at (just like in the old spike). We felt like the play test environment had to be an "honesty" kind of thing, so the Designer could check that the cards were being placed in public/private correctly (by looking at all the private views). So, after considering this, we decided that spike was done. 

We proceeded to work on the Ordered Decks / Searchable decks. We changed part of the RandomDeckSpike so that it allows us to do more things. We added a takeTop button, takeBottom button, take ALL (which is how we envisioned searching through the deck). We made it so that clicking on a penguin, after taking it from the deck (when taken out, it is placed outside the deck panel), will replace it in the deck, in that order. 



We also made a bunch of superhero versions of our penguins, so now the PenguinFactory will return a different version of penguin, when called to build a penguin.


Problems:


None really, we even made a cool thing that lets you see how things are getting placed and taken out. Slightly animated.


ptr.next


Nothing on the horizon. Maybe I'll have a better version of the views spike, where you can select from the list of all views, and check the ones you'd like to see on the root panel (or an individual player panel). In addition, rightclick option so that you can make the penguin move to the desired private view.

We might make the new PenguinFactory be able to deliver penguins of a single style or not.

Wednesday, February 22, 2012

Pear Brogramming sesh #5


Our Goal: To get a working copy of a chat client that users would be able to use when they are on one of the webpages. The chat client would need to allow one user to enter a string in their text box, press enter, and then show up in a common "chat box" that would hold the entire conversation. 

What Happened: We were about to start running the complete wrong way before we got a hold of Joe and he was able to show us the correct way to do this using GWT. Since Joe had worked previously on a spike that allowed multiple users a connection to the same penguin on a webpage, he knew how to correctly communicate with a created servlet and what "black magic" was needed to achieve this. Originally, we thought that we would be able to use some sort of socket solution to achieve this communication between the client and the server; however, even though this was the only way we had done it in the past, we were looking at hitting a dead end when trying to do this while working with GWT.

Here's what we learned with Joe on how the client must talk to the server and vice-versa:

According to Brady "
First, we must realize that every type of communication with the server as the client must be done through a service interface. Since we were working on a chat spike, we needed to create an interface called a ChatService, which extends a RemoteService (the built in service interface that GWT provides), that would have the method stubs in which we needed to have the client and server talk. In this case, these methods included a sendMessage(String) and a getUpdates(). The sendMessage() would be called when a string needed to be sent by the client to the server, and the getUpdates() method would be called when the client would ask the server if it has a response to send back to the client. Now, here's where the magic comes in - in order to make the client asynchronous and not stall when waiting for a response from the server, we need to create another interface with the same name as the ChatService except it must have Async appended to it. This ChatServiceAsync interface would also contain the method stubs but would take a new parameter for each - an AsyncCallback<oforiginalreturntype> callback. This AsyncCallback is the interface that must be implemented to receive a response from the remote procedure call (RPC). The AsyncCallback essentially gives the server a means to contact the client that contact itself, a response. I will talk a bit more about the implemented methods in just a bit.

There is one last class we must create for all of this to work and that's the implementation of the ChatService interface, which we call ChatServiceImpl. This class implements ChatService and extends RemotServiceServlet and is the actual server that the client communicates with. Both sendMessage(String) and getUpdates() would be implemented here. Their bodies would just contain what we wanted the server to do when each method is called. For example, the sendMessage(String) could take the passed in String and place it in a queue of some sort. Then, when the getUpdates() method is called, it could return whatever is waiting in the queue. The main thing to notice here is the ChatServiceImpl is the server side; the method's would do what the server should do when the client calls each method.

Now, after all this is setup we have to learn how to use it all correctly. Joe also made this very clear and explained it wonderfully. In our entry point, we need to make 3 objects: 
  1. A ChatServiceAsync chatService - this would be the service that the client would call when we want to send something to the server. The magic is when the chatService = GWT.create(ChatService.class); This declaration links up all of the setup we did and allows the asynchronous service to connect the client to the server. Quite awesome
  2. An AsyncCallback<returntypeoforiginalmethod> sendMessageCallback - this is just a callback object that is an instance of a private class GetMessageCallback which implements AsyncCallback. The point of this is to override the two methods that an AsyncCallback object must implement: onFailure() and onSuccess(). These methods are what is called when an asynchronous call fails to complete or completes successfully, respectively. In other words, they receive what the server sends back to the client.
  3. An  AsyncCallback<returntypeoforiginalmethod> getUpdatesCallback - same as #2, but for the other method in the ChatService interface.
We now have the ability to send a message from the client to a server using a ChatServiceAsync, have the server decide what to do with the message in the ChatServiceImpl methods, and receive the the response of the server through the AsyncCallback onFailure() and onSuccess() methods.

WOW! Pretty dang cool if you ask me."

Problems: No problems so far, considering we haven't dealt with actually getting text to and from. We are also going to want a list of all the updates, and we have to keep track of the current version of the chat for each user, and then forward the strings that user is missing. 

What Still Needs To Be Done: Have the chat client actually do something useful! Since all of the time programming today was learning how the client connects to a server, we didn't get a chance to actually implement some sort of "chat" window that would allow two users to talk on a webpage. However, this should be trivial because it's basic GWT panel work.

All in all, We learned a whole bunch today. 

PS: +5 Raccoon Hugs for MoJoeJoeJoeJoe
PSS: You can change the font size Brady.

Sunday, February 19, 2012

Pear Brogramming Sesh 4

I did some pair brogramming with Stephen L

Here's what happened:


Our Goals:
Were to create something that could show the different views of each player.

What Happened:
We were able to create something which reflected the different views, it is located at

Basically, you can click the penguins (left or right click) and they will go to different views!

We settled for a system in which the user can see the public view and private view, the public view is on top, and the private view is on the bottom. It's the only way we could figure out how to display both things, without duplicating penguins. 

Problems:
The hardest part was doing what we wanted. We had to compromise, since we found out that you can only have 1 instance of a widget on a panel, if we wanted to have copies, we would have had to copy stuff over, and that gets pretty messy.

We also got stuck using SimplePanel, I changed everything to a FlowPanel, which lets you stack things onto each other in a nice way!

Future Work:
More spikes.

Improvement on views. Hopefully I'll figure out a way to have player unique views, without having to do the trick we did where we display both public view and private view, under a tab for each user. 

In retrospect though, that doesn't seem that bad.


PS: I guess in regard to the designer



ã…œ━ã…œ︵/ (°□°/)

I'm all chill now.

GWT Designer

Is Stupid so far.

It's hard to use, and it won't show up on the browser page...

In short:


(/°□°)/︵ ┻━┻

Yup. 

Thursday, February 16, 2012

Peer Brogramming Sesh 2



Our Goals:
Our first goal was to get the presentation stuff sorted out, we did some practice runs through our presentation as well, and we'll be ready to talk about stuff tomorrow

Joe had a bunch of experience with GWT, I did not. We decided to work on a simple aspect of the designer, which was to be able to click on a component and be able to get some info shown about that component on one of the sides. This is our spke!

What Happened:
We changed a few things about the original presentation, and changed our name... SURPRISE. 

It came out really good actually! We hard coded it so we could only change between two components, but I guess that's the point of hard coding stuff. 

Problems:
The hardest part was figuring out how to make a new entry point again, there's like 8 things that all have to be changed which require the new class name... and we forgot to change the classname/classname.cache.nsense or something like that, which didn't allow us to launch the thing for a little bit. Another problem we encountered, was that the workspace panel was being jealous and pushing the info panel below it, so we had to change the way those aligned. 

Future Work:
Make more spikes and get all of us familiarized with GWT and how stuff is done through it. 


Overall, great evening!

Wednesday, February 15, 2012

Pair Brogramming Session 1

I did some pair programming alongside my valentine, Brady Key. 


We messed around with Jigloo, in order to figure out how it works and what we could do with it.


We discovered that creating GUIS with it is very simple and easy, however the code for the gui gets long pretty quick and is uncommented. Therefore, when we're using this in a real thing, instead of a spike, we're going to have to comment a bunch of what we did. 


We worked on making a Jframe have a menu bar, and have an icon button on one half of the screen, while containing a jpanel with 2 anchored buttons on the other. After that, we worked on adding a mouse listener and a key listener to the whole thing. 


We discovered that Jigloo adds AbstractAction to components, and declares them anonymously. 


Today, we did a bunch of proof of concepts and feel more comfortable with how jigloo works. We talked a bit about how we would like the designer to look, but we didn't come to a consensus. 

Tuesday, February 14, 2012

Post Doom Day

After spending tons of time hugging and talking to my raccoon (CJ in the picture), and letting the shock of what happened yesterday settle in, I feel like I can talk about it here. 


For the first part, it sucked. My friend Brian is not in our team, which we were all so eager and yearning to have. However, it's a part of living, and like an old ex-gf, the best thing to do is to have a week full of liquor and bar-strange and just move on. We don't even have a week, we have 2 days. Since we must start strong and heavy, and holding a grudge against some member in our team isn't professional nor will it help us accomplish anything. I guess this is my outlet. 


I know Brian is a great addition to the other team, so in part, I feel like we're missing a crucial piece of our puzzle. Knowing his experience and having worked prior with him, I'm sure he is one of the most fantastic programmers. During our time in 351, whenever I had no idea how to do something, I knew I could count on Brian to help me out. He would not only help me, but he would teach me and be patient and explain what he did when I didn't understand it. I know both him and Joe are great programmers, and they are also great leaders. When the 3 of us worked in our individual Java Tower Defense game, they were the ones who had most of the creative process as well as experience to know what had to be done. I know he would have been a great complement to our team, sadly, he is not. From my experience with him in SC2, I know he's not going to give up and let the other team collide just because he's not with us. So that doesn't worry me at all, I know he'll be a great addition to the other team and he'll gain great amounts of XP points. 


Looking at the positive, I'm in a group with 3 of my friends. I may not know Stephen L personally, and he may not be my bro (yet), so I'll have to be slightly professional with him; which will be interesting since I was getting used to the idea of being able to joke around with everyone in the group. Humor is pretty important to me, and someone who can't take a joke when everyone is being goofy, is a person that I clash against. 


I do not know of his experience, but I know that if I give it my best, the 5 of us can create the baby that joe had designed and it will be as beautiful as he pictured it in his mind. I know that after the 12 weeks, if we have a successful project, Brian Kraus will come back and join us for the more serious part of development and will get to jump in our ship and help us row again. 


If I've learned something from playing SC2 sooooo much, is to never give up or let things affect the way I play (in this sense, interact with my teammates). Whenever I used to let my personal life get in the way of my thoughts, everything came down and I would end up 0-10 for the day, which is a really crappy streak. So, I must take that knowledge, and do what I've struggled with so hardly in regards to my romantic self, which is to move on and quick.


While watching Harry Potter 1, a quote came up which reminds me of this moment.


"It does not do well to dwell on dreams and forget to live"


So, it's time to put it all in the past, and like in StarCraft, make a GG out of this instead of ragequitting. 


Friday, February 10, 2012

Sales Pitch

I decided to throw a slide together about my sales pitch. Something funny, and to which people can relate. Maybe they can tell my motivation by the two pictures that I put.

I'll talk about what MOBS is, and describe some of the features of the Pit-Boss.

Maybe throw in :

"Only the chosen ones, the few, the special, will make this idea come true. The team will be gosu due to its composition"



That's probably everything I can say in 90 seconds.

It'll be more of a tease, to make people interested and read my proposal first, than to actually recruit team members today.


PS: I'm kinda nervous.

Tuesday, February 7, 2012

Sunday, February 5, 2012

Proposal Revisions Notes

Dear future and non lazy me:


Here's some things you need to revise:


Timeline (make it more realistic)


Stakeholders
Besides Committed Player and Developer
Server runner could place ads on the page and such for revenue


Redesign things so that server list is STATIC so people can see what games are going on.


Game should be able to be played with 2 players or up to 10.


Don't assume users magically exist and they have public ip addresses and permission to run servers.


Don't make dumb assumptions.

Design Patterns

Dear Raccoon Lovers!


I just read the software design patterns wiki!


Wikipedia defines a design pattern as just that, a pattern and not a step by step guide of how to solve a problem. It is simply a template to solve a specific problem, with a specific pattern. 


Design patterns are helpful for cleaner code, and they are easier to read for those who have architectural experience. In addition, they help deal with problems that may have not been considered before the implementation by the programmer, but the pattern's designer came up with this pattern after many considerations and through his own experience. 


Patterns are just a micro-architecture design that a programmer should take and adapt to their current work. 


One of my favorite patterns, would be the Builder. 


The Builder pattern is used to separate a complex building into simpler steps. 


The pattern requires 4 things:
A builder (constructs the object step by step)
A concrete builder (builds objects),
A director (someone who guides the way things are built)
A product (something that is returned)




Basically, the builder sets all the paramaters required for construction. 


In java, the Product takes a reference to the ProductBuilder.
Then, the product sets its parameters by calling the ProductBuilder's get parameters. 


The ProductBuilder also has a method Product build(). Which returns a Product object. The build method simply returns Product(this). Where this is a reference to itself, which is how the Product acquires all the parameters. 


PS: I hope this Super Bowl is full of cheddar, potatoes and bacon soup!

Thursday, February 2, 2012

My Ideal Team

The 3 Words that would describe my team are :

Professional. Creative. Persistent.


Professional:
I want someone who can put away their personal life and be able to interact without letting their emotions affect them too much. If someone is professional, despite not liking somebody in the team, they will always be respectful towards then no matter what and if they have to collaborate in the same piece of code; I want them to work efficiently together and not spend the whole time bickering and fighting. 


Creative:
I first thought of using skilled, because it's always important to have someone who knows how to solve things. However, I think it's more important to have someone who can think out of the box and come up with a solution rather than knowing it and assuming it is something trivial. In addition, I want someone who can be creative enough to think outside the box and think about corner and edge cases and maybe even cases that weren't ever considered but that are good to test for.


Persistent:
Persistence is a great skill in life. I want someone who wouldn't give up after the first obstacle. Someone who can get up after being defeated and getting up and being ready to give another stab at whatever defeated them. Persistence is very important when working as a team, since if one side of the project falls apart due to challenges not being able to be defeated, then the whole project falls apart. 




The other 3 words I would have used, but weren't as important would be:


Skilled
Its always good to have someone who knows a lot and has seen a bunch of stuff and has past experience who can guide others. 


Hardworking
Its great for a team to have someone who's always involved and always giving 100%. If people don't bring in their fullest to do their 70% of the work of carrying the weight, then the whole project's 100% cannot be carried and everything falls apart.


Involved
It's great to have everyone know what everyone else is doing, at least a small idea of what other people doing. I want a teammember who either knows what he's doing, or what he's supposed to be doing or what he can do at all points in time. Finishing your task for the week, doesn't imply that you're done working. Someone who's involved can utilize the time to run some tests or do some prototype work in order to gain some insight on a part that is supposed to be worked on in the future.