The Education of a Programmer (Me)

Just another WordPress.com site

Month: April, 2012

Learning NHibernate – Part 2

As I said in an earlier post, I’d decided to use NHibernate in a series of programs I’m writing because I preferred the stability and the ¬†maturity of the code, especially since I have to use it against .NET 3.5 and an Oracle database. I know that Oracle updated ODP.NET to work with Entity Framework, but I’ve only seen it working on .NET 4 I’m concerned about using it since it just came out of beta earlier this year. Yeah, I know that this becomes a preference thing, but I get to make that call since I have to be comfortable with what I’m coding and how I’m doing it. If the database were SQLServer anything, I would switch to EF because it is written by Microsoft for Microsoft products (SQLServer, .NET, Visual Studio, etc.) but with the environment I have, I think I’m making the best choice.

The first part of setting it up seems pretty straight forward. I need classes which contain my tables so I can work with POCOs (I even understand what they are these days…) and I need some sort of mapping to link class to database. That way I can create the objects I need and ensure they are both type safe and useful when I need to do CRUD operations or if I need to create code which makes decisions on what it finds in the objects themselves. This is when I also am very thankful for NuGet, because I can

I’ve looked at several books, but they all leave me feeling dumber than when I started. I’ve run across a 6 part tutorial which seems to make it more understandable for me at least. The tutorial is at Geeks with Blogs and can be found here. I worked through the tutorial, all 6 parts, and really started getting it, so many thanks to Bob Palmer for this and for helping start me over the hump. Now I have some ideas of what to code and how to code it. The question then becomes what can I do with it to get the things I need to do done? The first challenge is going to be with the admin code and being able to adjust to the intersection tables and ensure that what we CRUD in the base tables gets persisted so we can get the updates in and out the best way possible. I think this is where a lot of my NHibernate coding is going to be useful. I just have to look at how to wire it all up to a form so I can pull back data to edit, or I can create a record whole cloth.

I think I’m going to need the advanced queries when I get into the actual logic of the program. That proggie has to read information from several tables to determine if this meets the send criteria or no. If so, then send it and delete it. If not, then it may need to persist it long enough to see if it will meet the send criteria for up to 30 minutes after creation. After that, forget it.

Advertisements

Book Review – HTML5 Mobile Development Cookbook

Last week, I had a week of good fortune! Monday, I won a copy of HTML5 Mobile Development Cookbook by Shi Chuan from Packt Publishing and Script Tutorials. Then I was asked if I would review the book I just was fortunate enough to win. Who wouldn’t say yes to that? (Well, to be fair, Packt Publishing is giving me another ebook for free after I finish this review.)

The short form of the review is simple: If you want to learn more about mobile development, buy this book! Mr. Shi (I’m guessing on how I expect to read Oriental names and if I’m incorrect, please correct me sir.) has written an excellent book which taught me a lot about re-optimizing my code for a more mobile friendly site. He covers a tonne of material in the book and makes good note of what works with which of the major mobile browsers. I particularly liked his discussions on geolocation and media (audio and video). The included code is all based on open source projects so anyone can get the code, read it, work with it, and have fun with it.

The other main selling point, for me at least, is that he works on a lot of the tools he demonstrates or uses, so he knows the tools backwards and forwards, but still ensures his explanation and code are highly accessible to anyone regardless of your professional level. It is well written and easy to follow. My only negative is when he addresses the fact there is no iOS emulator or Windows and suggests buying an iPhone. Sorry, my budget doesn’t stretch that far. Though I also like, to defend my thoughts, that he shows you how to turn Safari to mobile Safari for checking.

Overall, this is an excellent book. It’s well written, full of good examples, but not code you copy and forget. I read the code and get a tonne of ideas on what I can do with what I’ve read and what I’m learning. It’s a great book and if, again, you’re interested in learning how to develop for mobile devices, get it!

 

Learning on the fly?

I’m flying by the seat of my pants these days. I can’t say it’s very comfortable or comforting, but I’m slowly getting it, which is more of a relief. I’m building a series of interrelated applications which will allow us to track and broadcast inbound data information to subscribers based on multiple criteria. There are several inherited tables involved, as well as a few we’re building along the way. I realized early on that to do this as efficiently as I could I need an ORM. I know that ODP.NET now supports EF for .NET 3.5 and above, but I don’t feel real comfortable since it’s just a recent release, so I’m sticking with NHibernate which has supported Oracle and ODP.NET for much longer.

My problem with NHibernate, Fluent, and/or Castle Project’s Active Record is that the documentation has been written to the level of programmers much better and much more skilled than I. The basic tutorials are a little too basic, and I feel I’m falling through the cracks of my own ignorance. So here’s a snapshot of my learning experience to see if this may turn, yet, into a tutorial of my own writing, or at least helpful notes for another in my position down the road.

I’ve tried, using each book and tutorials methods, various forms for class construction and mapping. By far, I like Active Record the best. I am able to add the mapping into the class file and make it all in one fail swoop. It also looks to have one of the easier initializations. Of course, I still haven’t pulled the ISessionFactory yet to ensure that the first of the proggies will do what it’s designed to do. This one is the one which will read from the databases and populate a temp table which should also be populated from an external agency and then all of it will be read every three minutes into another table where the logic program will evaluate the rows to see which ones need to be mailed to users and which ones will be ignored and later dropped from the table. This proggie will also be the one which reads the tables and drop rows as needed.

I still need to do a lot of reading and study, but I believe NHibernate is my best option. I also think I will get this as I keep working on it.

The story behind the blog

These days, I work as a programmer and internal web developer. These were not the careers I expected when I went to college. When I went to university, I ended up with a Bachelor’s Degree in Linguistics. I wanted to continue my work and win my PhD and settle into being a professor. I wanted to study Celtic languages and specialize in Syntax models.

After school, I got married and didn’t have the funds to continue my education, so I entered the work world while the wife worked and went to school. Ironically, my ex-wife switched her major from Music Theory to Computer Science. I might even try to get my degree at the same university she was attending when we married and divorced. After divorcing, I entered the world of International Freight Forwarding, which is perfect for a polyglot like me. I moved to Los Angeles with Emery Worldwide and went from being a Japanese Customer Service agent to an International Operations Supervisor. Later I would move on to Distribution By Air, which is where I started working with computers professionally.

At DBA, I upgraded systems from all dumb or slave terminals to full PC’s and rebuilt a network from the ground up. Not the best work I ever did, but I did the best with what I knew at the time. At home, I was getting a lot of experience building systems and working with Linux because I couldn’t afford Microsoft software or full machines. After 9/11, I was laid off. I can’t blame DBA for that one, when we went to 1 shipment in the days following and everyone was calling for tighter restrictions on international freight, I saw the handwriting on the wall.

A couple of jobs later and I was working for Diebold, as a glorified dispatcher. However, after I got my Masters Degree in Information Systems, I was training as a Technical Performance Manager and had high hopes. Then came February 08 right before the start of the recession. Diebold was aware there were problems with the banks. They laid off 5% of their workforce nationwide. I was one of them. I understand the decision. I had gotten my Masters a few months earlier. I was at the end of a period where I agreed not to look for a job while my boss looked for opportunities inside the company to keep me and I was in the middle of a nasty divorce, so it took a lot of my time and energy.

After a couple of months of looking, I ended up getting a job with the Independence School District as a web developer, working on both internal and external websites and spending a lot of time working on web servers. Honestly, that was as close to dream job as I could get when I started getting into it. I love writing websites and learning more and more. That’s really where the inspiration for this portion of my blogging career started. How do you learn everything and keep on top of all of it. I hope to start doing a lot more with this as I go along as well.

I was laid off there after a couple of years because of the recession and its impact on school district funding from the state. There you go, I am a two time victim of the recession. After the second layoff, I was able to take advantage of a program from the State of Missouri and went to school to learn .NET programming as a career change. That helped me land my current job as a programmer for a local sheriff’s office. I’m having fun and working my tail off to learn about things I’ve never used before. These days it’s all NHibernate, Fluent NHibernate, and Castle ActiveRecord for me.

I’m hoping I will be able to start writing more book reviews, lists, and other things which will start this off on the right foot and catch a few readers interests.

Gads! Not again

I finally decided to bite the bullet and use the blog here rather than self-hosting on a free site. I had done that for a while, but the provider crashed and while my static pages came back in 3 weeks, the blog never recovered, then they went out of business, were bought (I presume), and all my previous work is now in the ether. I should have known better because I had trouble actually backing up files with them. 

Now that the rant is out of the way, I’ll post the purpose of this and the other blogs I’m running off of my site here and start making more time for reviews, website suggestions, general thoughts, and who knows what else. However, I should be doing all of it here, so I won’t lose it hopefully. Just don’t like the theme choices, but I’ll live. Eventually, I think I’ll buy my own name as a domain and return to hosting. Once I do that, I’ll move all this stuff there, but with school, work, and the light of the moon, it may be a little while.¬†

Cheers all,

T