Pages

Monday, December 7, 2015

MVC Blows

It's like some Linux/Apache/Java coders with no GUI API were sitting around one day and suddenly thought, Hey, lets make Visual Studio web development more like working in Notepad!

Where there was once the simplicity of writing a query, presenting on a page, and handling edits - all trivially simple on WebForms there is now an arcane, 1950's mainframe style of coding.

There is now a Model (enterprise framework, that uses LINQ in C# but you can never be sure if it's the EF or the Database that is causing problems),

There is a View, which would be a web page but its basically an unreadable tag soup.

A Controller, which should consolidate all your validation, but they are not used that way, basically everyone creates a model, view, and controller for each page (and sometimes more model/view/controllers for elements within the page).

But here's the real fun part.  You can't design visually anymore.  Like the old days of designing HTML in Notepad (remember the days of having 6 files open in Notepad, and hopping back to the browser and refreshing 600 times a day?)  MVC cannot use any of the ASP controls.  So if you wanted to use a GridView, or an Image, you're screwed.

Today I needed to embed a code-generated image into a page.  I created a class.  The class works brilliantly to create a System.Drawing.Image.  But then I went to  present it, and I googled to a website that opened with "Warning, this is long but full of info. Read it all.".  When I wanted to do this in WebForms, 1 google search and 30 minutes had it up and running.

This brings up the next thing.  You just have to KNOW a million little things about MVC.  With WebForms, I learned by trying stuff.  With this, there are a million little secrets and NOTHING works until you find them.  It's like those video games where you just can't find that damned twelfth key!

Of course MVC is all the rage this week, and everyone wants to say they used it so they can add it to their resume, but honest to God the sooner we can abandon this unholy mess the better!

I am sitting here actually considering signing up for a class in this crapfest... I have been intuiting software development since BASIC.  I'm sure the LAMP programmers out there will like this more (not that any of them would seriously PAY for software), but for those of us who like to get things done, you know - THIS WEEK, this framework is a giant time-sucking pain in the ass!
...

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Wednesday, December 2, 2015

How to Convert a Bitmap to an Image

I have seen a lot of crap about how to do this, and there is some very bad advice out there.
This:
Image img = (Image)myBitmap; DOES NOT WORK!

I did find a way to do this in one line of code. Many of the solutions I saw were 50+ lines of code, and most assumed you were saving the bitmap to a file first, which I did not want to do.

Image img = Image.FromHbitmap(bmp.GetHbitmap()); ...

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Share This!

Contact Us

Name

Email *

Message *