Sunday, September 27, 2009
Concept Camp 2009 Review
Sunday, September 20, 2009
The XX Files
Hello all, hope your machines are treating you well. Just wanted to blag about some news as it relates to Sara.
Tickets to Concept Camp will be sold up until Weds 9/23. Get them while you still can. We recently got sponsors for Concept Camp as well as some great new speakers. News will be going up on the Concept Camp site. You can also follow ConceptCamp2009 on Twitter.
On October 3rd Microsoft in NY is doing a MVC Firestarter and I've been given the great opportunity to present. This is my largest event to date and I'm really looking forward to sharing some of the MVC goodness. It's at the Grand Hyatt New York and you can register to attend here, also it will be broadcast on the web for you at home. You can learn more about Firestarters in Steve Bohlen's great post here.
I'm Beta testing my latest personal web project. It's a URL Aggregator built in ASP.NET MVC. If you would like an invitation shoot me a line, if you are waiting on one you will see it in your inbox shortly.
This weekend I had the awesome opportunity to go to the xkcd book signing party here in NY. I got to meet Randall Munroe and he signed my netbook. It was nerdtastic and I giggled like a 5th grader the entire time. The book is great, you can buy your copy here.
Sunday, September 13, 2009
ASP.NET MVC Translated for the Web Forms Programmer (4 in a series)
Ok, so, do you remember learning about HTTP Get and HTTP Post in school? Ok, do you remember when you started building Web Forms and you just chalked that up to another thing that you learned in school that's not applicable in the real world? Well, guess what. MVC is 100% get and post. Never fear, it's an easy concept. Once you get it you will realize it's truly awesome to be working with the web at its root.
Now, for those of you who's memory is a bit fuzzy http stands for Hyper Text Transfer Protocol. It's the way things are sent from your computer to the server and then back. It's an integral part of what we do, and I appreciate that MVC brings us closer to the action.
Today we shall create one page that does both things, a Get AND a Post. We're going to create a new project for a restaurant named TGIW (this place seriously loves Wednesdays, weird). We've already learned about Views so I went ahead and built that myself. Today we're going to learn about two big things: Rest and populating our views with data.
REST stands for Representational State Transfer and it was actually created by one of the inventors of HTTP. In REST calls individual requests are made using URIs like hypertext links. You can make GET or POST requests by using URLs. This is how MVC performs its actions.
Now, what we want to do is have our daily specials loaded as the form comes up, and then send back our order. Our application is using LINQ to SQL and we have two tables, “Specials” that contain our daily specials, and “Orders.” which is where our orders go.
What we're going to do first is create a ViewModel. MVC is very good at simple CRUD behavior with data objects, however, when our application requires data that is more complex the best way to pass this data into our View is through a ViewModel. Since our view needs to be able to manipulate multiple classes we're going to aggregate them in a ViewModel.
Our ViewModel is called OrdersViewModel, and it includes a constructor that gets our special of the day via by creating a special and passing the day of the week.
Now we come to the “Get,” we're going to build an action that returns an ActionResult that populates our page. Inside our action we're calling a method called that accepts a string “day” and returns our special. When we return our View, we're going to pass in that special. We reference the special on our page.
In our view we're going to make sure that the type passed into “System.Web.Mvc.ViewPage” is our “OrderOnlineViewModel” class, because that's what we're binding our page to. This allows us to reference any of the values in that class. We will display today's special, I'm going to throw it in a div. We use Model.PropertyRefrenced as the syntax.
So, next we're going to do our Post. We have our text boxes, where we can input how many meals we want to order (this place has a very limited selection). We're going to create our Post action the same way we did our Get, except this time we will be passing IN a our Order to be saved. Within our post we put all the data we grab all the data collected in our form. There are a few ways to do this. The first step, however, is to make sure all our html controls are named in a way that we can reference in our controller.
This brings us to an excellent point that we need to go over, the concept of “Convention Over Configuration.” I don't know if you've noticed but this has been floating around a lot recently. It basically means that it's better to agree on a way that things should be set up and make that the way you do things, than it is to manually configure each time. This concept is exhibited in ASP.NET MVC in the way that controllers have to be named after the folder where the views are contained, and how the values on the view are referenced why whatever the controls are named.
For this project we're going to use simple text boxes right now, we'll move onto more involved controls. All we need to do is create a textbox to enter our data, then on our controller we're going to name our action the same thing as our “get,” this time however we're going to specify that it is a post. We did this in our last edition, and now we're doing it the same way. Don't forget to specify that your form has a default action of “Post” and you'll be set, your most method will automatically submit after your click event.
Next up: the HTML Helper, and ways you can use it.
I apologize for the code images, will embedd code in the future. For now you can download the source here.
Thursday, September 3, 2009
More details about Concept Camp
So, ch-check it out: http://ConceptCamp2009.com
I really hope to catch some of you out there. I love camping, and this is a great opportunity to get to know people. More exciting speakers to be announced soon.
I've been extremely busy lately, and my blog has been suffering. I apoligize for that, but I intend to get things back up to normal pace after the launch of my latest project. The saying is true: "After 90% of the work is done, you just have 90% to go." Software isn't easy.
Hope you are having a beautiful week. Please feel free to contact me with any questions about Concept Camp, or if you want to speak. We still have a few spots open.
Thursday, August 20, 2009
Framework Agnostic Web Languages
After a great time at a language agnostic conference this past weekend (I don't have pictures, I got a new camera and I forgot to bring it. I was so mad) I've gotten to thinking about framework agnostic languages. The ones you need to know whether you're a Python, C#, Ruby, or Java developer. I came up with the following list:
- HTML
- XML
- Javascript (JQuery, Prototype, YUI...etc)
- Querying languages (SQL, MySQL, Oracle)
- Regex (syntax, not language)
My point is, while it is important to be focused on whatever web framework we currently are working with these languages are a staple to our success. For the past few days I've been playing with Python, and so far I really like it. Say I wanted to switch from .NET, I would still be heavily working with these agnostic languages.
This is why even though I may not be heavily into writing custom HTML/css I am still paying rapt attention to the HTML 5 / css 3 advances. Unless I decide to become a Doctor or a Fireman I will be no doubt referencing them for a long time. These languages have proven their worth by staying around since the beginning of the internet (when I was a wee lass) and I doubt they have any intention of leaving anytime soon.
Any good web developer should be extremely comfortable with any one of these fab 5. If you're worth your salt you know that while you may not consistantly use these, your work will consistantly need to communicate on one of these levels, so it's important to know what's happening on the other side.
I would even go as far to say that if you are a web developer the most important thing you can do is learn Javascript. I never used to make it a priority, and since I have my apps have improved dozens of times over. I hate doing anything in my controllers now. This too may pass, and I can't say that everyone should share my overzealousness.
Here are some great references for info about these framework agnostic languages.
- SQL Server Community Blogs
- Doc Type - new Q & A site for css/html
- The JQuery Site
- Flagrent Badassery - Javascript and Regex blog
- MySQL Preacher
I realize my list is shamefully short, have any you would recommend?
Friday, August 14, 2009
Saturday, August 8, 2009
Announcing: Concept Camp (Camp)
So, I've long been discussing Concept Camp (lovingly referred to as Camp Camp) and I've ironed out the details. The dates are September 26th and 27th. It's looking like we will do the KOA in Hagerstown, MD We will be tenting it, and there is Wifi, water, and electricity (what more can a girl ask for). Friday night I plan on getting there, setting up tents, and roasting some marshmallows. Saturday day we will be giving talks (TBA), discussing frameworks and concepts, and playing some games (nerd games). Saturday night will be the party night so bring your beer hat (I make some amazing Jungle Juice, let me tell you).
I'm looking to make this a yearly thing, I think we can have a lot of fun. Contact me for details, to sign up, or to discuss possibly speaking.
Hope to see you there!!!!