The Education of a Programmer (Me)

Just another WordPress.com site

Book Review – Becoming Functional

I’ve recently been reading Becoming Functional by Joshua Backfield. As usual, the disclaimer is that I received a copy of the book for free in return for the review.

I was interested in this book, primarily because I have always been of the opinion that some of the code I’ve written for a couple of programs I’ve developed could be better written using a functional model as opposed to the traditional declarative programming model I learned in school. After reading this book, I’ve realized my instincts are better than I thought and that I’m right in that belief.

Mr. Backfield does a very good job stepping the reader through a fictional company where, as a developer, you’re trying to make some of their back end programming more efficient and more responsive to the user. He starts by walking you through the company’s code and then refactoring it step-by-step to more and more functional paradigms. Along the way, he does a good job of explaining functional programming in brief and how factoring the functions can make everything work more efficiently.

When I read the book for review, I only had the first six chapters available, but the chapters on immutable variables and recursion were enough for me to be sufficiently impressed and to have some ideas on where to take my own code. I am certainly going to go back and finish the book and work my way through the code.

Even though the code examples are in Java and Groovy, it’s not difficult to see how to change them over to C# and possibly F#. (For programmers like myself in the ASP.NET world.) With this in mind, it won’t be hard at all to work out the refactoring method by method.

Overall, for an experienced declarative programmer, this is a great introduction and a good guide to adding in functional concepts where they are called for. For less experienced programmers, this is a great way to look at a new paradigm while gaining a good understanding of how it can work in the real world. I heartily recommend the book for anyone interested.

Step by step in Vim

I kept reading Ben McCormick’s blog entries about Vim and am going over other tutorials and books I have in my collection and I felt comfortable enough working on a file to never take my hands off the keyboard and NOT go into insert mode as the default way of doing things. For me that’s a bit of a win. I did a few significant updates to a behind the scene page so now I feel safe enough going from there to start building and having more fun with things to see just how comfortable I can get. 

I know it’s always one day at a time and that’s how you learn. It’s just fun to make some progress and remember the ways to do something more efficiently and go from there. (Yes, I’m a geek and things like v18ld to pull a piece of a string out of a url is pretty cool to me!)

 

Next step in the evolution and education

I spend a lot of time in front of a keyboard. That’s the nature of programming. Since I also write websites, I also spend a lot of time on the web, reading about programming and the like. 

Recently, I ran across a wonderful series of articles by Ben McCormick on Vim. Here is his first post in the series. He made me think about a few things, including the fact that though I have a couple of editors I love and use a lot in the Windows world, I have never mastered Vim myself. (Now, for those of my readers who are Emacs fans, I’ve never mastered it either, but in trying to use either one, Vim seemed easier to me, so I’ve tried several times to learn it as opposed to Emacs. No flame wars here please!) 

So I’m going to use his posts as inspiration and the resources I have available to me so I can really make an effort to learn Vim and learn it well. The truth is, it should not matter what computer I am at, I should be able to sit down, fire up Vim, and be able to work on a file regardless. I can’t do that right now and that bothers me. It’s not about programming chops or anything like that. It’s really about the ability to go where I need to go and be as productive as I can me. Yes, I know that I have Visual Studio or Sublime Text available on my normal rigs and I have sublime and Vim both on a flash drive, so for a Windows OS, I’m relatively well set. However, I came from the Linux world. (Yes, I actually have worked with Linux as a primary desktop OS since a 1.2 kernel and the fact that I have not mastered Vim and LaTeX do make me hang my head some days. I had more success with joe and nano.)

So the goal for the second half of the year is to learn both Vim and LaTeX well enough for every day usage. I know that I need to learn them and I know they will be beneficial for me to learn and master. 

My question for you my readers, if you are out there, is what other resources do you know of which might help? I know about vimtutor and I have a few eBooks on PDF which will help me. From there, it’s time to get cracking and any resources are fantastic.

Packt Publishing Sale

Disclaimer – From time to time, I do reviews for Packt Publishing and in return, I receive free copies of the books I review. I also write blog posts like these to promote their sales from time to time. I do this because I like the quality of their material and with more business, there are more opportunities for me to review books for them.

They are now celebrating their 10th anniversary and they are running another sale, hence the reason I’m writing this now. From the 26th of June until the 5th of July, Packt is offering all of their eBooks and videos for $10 a piece. While they are normally affordable, this is a very good sale. If you are going to go check it out, and you should, use this link so they know you came from my blog. Or click the graphic below!

 

10 days 10 years - Home Banner

Even more inches and Github Commits

Well, Bugs and I, from my previous post have made many more strides on my “wascally web app”. (Pardon the pun, but I’m full of them when I’m trying to make sense of this stuff.) Now, it’s deployed and useful. I’m at the stage, now, where it’s fun working on it and making the incremental improvements which ensure that my admins will not only use it, but will like how it comes out.

The nice part was solving each of these incremental mysteries and then improving it without saying, “I can’t do this, solve it for me,” on the various boards. I added in a search feature for subscriptions based on the user id so I can grab each users subscriptions. It was built in response to not being able to delete a user until the subscriptions were accounted for because of foreign key relationships. Later, read today, I changed the table structure of the underlying subscription table to enable cascade deletions so when you delete a user, the database also deletes the user’s subscriptions.

I’ve left the ID to be set by the admin because it works and because I can reuse IDs that way for deletions. Oracle’s default behaviour is to reserve 20 id’s at a time when you write an incremental ID trigger. So this seems to circumvent that. It’s a little more work from the admin, but it’s not too onerous.

I fixed the name entry into upper case through javascript. It works and it’s not problematic, so I’m happy about that.

I built my dropdown lists with a little bit of help and then added those into the page along with finding the IE problem. It turned out to be client side and with a little adjustment to the quirks mode, it’s all good. So this is, effectively, done and deployed. YaY!!

Getting Ever and Ever Closer

As I type the title, I hear Bugs Bunny, “Slowly he turns, step by step, inch by inch.” That is how this web application feels like. Step by Step, Inch by Inch I make some progress. I finally was able to break through the ODP.NET issues. I broke down and used the managed driver and then insured it was registered in the machine.config files for both x64 and x86 architectures. To me, this feels a bit like overkill. I had set the .dll to Copy Local=”true”, so IIS should not need to access the server’s copy. (Though I had already copied there just because I had learned that valuable lesson quite painfully recently.) Be that as it may, that is what it needed. After that came the ORA-12504 error. It couldn’t find the proper tnsnames.ora file. However, that is a relatively easy fix. I just changed the Data Source = from the alias to the full TNS name. Violá, the app likes the change and now it works.

Of course, I wouldn’t be discussing “step by step” if that were the end of things. Version 1 in classic ASP allowed you to filter a user list by the sponsoring agency. I didn’t include that this time. However, my users are quite content not to have it as long as they can have a search box which allows them to query the user base. It didn’t take me too long to find this page. I modified the basics to fit what I wanted and it works. I had to go back and make a modification and that was to ensure the search always hit the database in upper case. However, I’ve used ToUpper() many other times, so it was a quick fix.

The next step has arrived. How do I ensure that the data which is being entered is written into the database using only upper case for the subscriber names? I’ve worked through a couple of different solutions and they haven’t panned out. In fact, the whole thing has shown me that the ID field trigger on the database isn’t actually catching on that it needs to fire and the application doesn’t need to set the ID. So for now, I will set the ID in the /Users/Create page. It’ s not my preferred solution, but it’s on the list of enhancements.

Also on the agenda are to see why the site renders perfectly in Chrome and Firefox, but won’t render in any version of IE (I run 11 myself), but will render perfectly in IE when I use my IIS Express configuration locally to test the site functionality. I tried to alter the properties at the solution level, but garnered an error stating the .NET versions don’t match. Back to that drawing board. I need to build radio buttons and/or drop down lists for /Users/Create and 3 fields which need to be restricted as to their possible entries. So far, everything I have researched shows it’s really easy, but doesn’t work.

And, if I can do it, make sure that the first and last name entries go into the db in upper case, not lower or mixed case.

Simple? Maybe. But it’s taking time to research since this is the first ASP.MVC app I’ve built.

Book Review – Microsoft Visual C# 2013 Step by Step

I’ve recently been reading Microsoft Visual C# 2013 Step by Step by John Sharp. As usual, the disclaimer is that I received a copy of the book for free in return for the review. I’ve not linked to the book because I blog as part of O’Reilly’s reader review program and recently Microsoft Press books have been removed from their site. Out of courtesy to them, I am not going to link to Microsoft’s site for the book.

The book is aimed, as you read it, for programmers who are wanting to get a foundation in the basics of C#. As such, the book is a good reference work. It takes apart each of the different parts of the language and shows you how they are used in basic format. The first part of the book introduces you to the language, it’s absolute basics, and Visual Studio. The second part, getting the object model under control. Part 3 extends it, and finally, part four shows you how to build something simple for Windows 8.1; as that is Microsoft’s application focus currently.

Overall, Mr. Sharp does an excellent job describing the basics. If you’re a more experienced programmer wanting to see what’s new in the language, this isn’t really your book. But that’s not a negative. It’s not designed for that level of programmer. The examples are clear and concise. However, my one concern is that, as with most beginning books, what you’re learning along the way doesn’t build on itself until the final portion of the book when it all builds at once. However, if you’re going to be new to C# and you’re not coming from Java, this is certainly a good book to start with.

Decisions decisions

Well, I’ve had a few things on my mind recently. I’m still having the deployment problems. I don’t think anyone is surprised to hear that. What disappointed me was taking this to iis.net and to asp.net and having someone at the latter site patiently tell me this was an odp.net problem and that I should take it to Oracle for assistance. Really? This is a deployment problem. On my dev rig, this works perfectly, so I doubt that it is an Oracle failure.

OTOH, I also have been thinking. I like using VS2013 and all of the abilities I can find when I use it. However, I also know that I need to learn to use other text-editors to greater proficiency. I typically use either Sublime or Notepad++ when I’m at the office. They both work well and I’m used to them. However, I used to live in the GNU/Linux – Unix world before I started really trying to learn to program and now that I work as a programmer, I recognize my need to learn the basics, at least, of Vim and Emacs. It’s not really a want to, it’s a need to. It’s just part of programming life. I have worked with Vim a bit in the past as I thought it might be easier than Emacs, but I know future work I want to do will be better done in Emacs. So I need to make a concerted effort to get a good working knowledge of it.

The trick is being able to get over the learning curve and then figuring out what all I can do with it as I learn it. I know that, like anything else in programming, I have a lot of work ahead of me to get over the hump. Back to the mines….

The more I know…..

Well, the next part of the line is “The less I understand.” However, that really isn’t accurate right now. I am understanding more. Not necessarily getting where I want to go, but I’m understanding more. So far, in building the new admin section for the program suite, I’ve been able to get comfortable with a basic MVC program. Really it doesn’t have to do much, it does simple CRUD against the database and I have built custom tables for it to work with. There were a few neat tricks I’ve learned along the way which have made it much prettier. Now my headache is trying to get it deployed on IIS 7.5. I just can’t get it past showing me the front screen at the best I’ve got. Now the latest error is “System.BadImageFormatException: Could not load file or assembly ‘Oracle.DataAccess, Version=4.112.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342′. This assembly was compiled for a different processor” which implies that, though I matched the odp.net dll to the version which is on the server and is in the GAC, it still is fighting me.

Oh well! Back to the drawing board.

 

Down the road, I want to start implementing more SOLID principles along with Unit Testing and Mocks. It will be more detailed, but just as much fun to learn….

Updates

Well, I had planned on writing at least once a week, starting in January and here we are in May and I’m writing for the first time in who knows how long. (Before anyone can answer, yes, I am aware of the fact that WordPress knows…) 

Life has been busy and that hasn’t always been a bad thing. I’m a newly minted A+ certified techie (Yay!) and have actually completed the next class behind that one. So now I’m a certified Web Design Professional; whatever that will mean to others. 

On the programming front, I was successful, finally, in getting ODP.NET working with EF 5 and have built a newer version of the Hot Calls program which seemed to run correctly in the first preliminary tests. Once I get this other project under control, I think I will test it further to see if I want to work it out and deploy it. Should it go the way I expect, I want to go ahead and blog about the progress and how I did it. I’m using MVC 5 to build the administration interface and it appears to be ready for deployment. I just need to figure out why I am getting 403 errors trying to attach to the web server to deploy it. Once I have that figured out, I want to get it running and decommission the old site. The current admin piece uses Razor syntax, but it isn’t as elegant or efficient as the MVC version.

My Good Lady Wife has had a few health problems of late, so I’ve been away from this beast to worry about her. She is getting stronger and back to her ornery self which makes me feel better. 

I’ve not abandoned my book reviews, just really haven’t had time for them and haven’t stressed about that. 

Follow

Get every new post delivered to your Inbox.

Join 782 other followers