markneustadt.com

Performance – Using Try/Catch

I just wrote the stupidest program ever.  It is inefficient by design.  If anyone did this thinking “hey… this is great code” they should be fired.

Anyway… generally speaking, using try/catch blocks is not a great idea.  There are a myriad of reasons but it’s usually something along the lines of:

If you truly have an unexpected error it’s better to let the program crash and then fix the bug.

If you do have to use the try/catch exception handling block, you should only catch explicit exceptions.  For example catch a file access exception or a database invalid primary key exception.  Just catching the generic exception is poor practice.

There’s another reason to avoid try/catch though… it is a performance hog.

Read more

BBBC #25 – Spice

I’m not entirely sure what to blog about with the topic of Spice.  I know that spices are valuable and useful.  I know wars have been fought over them.  That’s kinda silly though.

Hey… my soup tastes like garbage.  Let’s go kill those guys.

That doesn’t make much sense.

Read more

Performance – Inline SQL vs Parameterized Queries

In the search for better and better performance, there are many techniques developers can use.  A technique used early on by some entry level or “still learning” developers is to build inline SQL.  That looks something like this:

string name = "Mark";
string query = "SELECT * FROM users WHERE FirstName='" + name + "'";
OleDbCommand cmd = new OleDbCommand(query);
OleDbDataReader reader = cmd.ExecuteReader();

There are steps missing… this is just example code

 

This is something more seasoned developers learn to avoid almost immediately.  There’s a variety of reasons why inline SQL is bad.  The most important reason is security.

However, there’s another reason to avoid it.  Performance.

Read more

BBBC #22 – Map or GPS

I am a fan of trying to make my kids be able to change a tire before they’re allowed to drive. They may never need to do it, but if they have to, it’s an important skill.

Same with maps and GPS and navigation systems. If you find yourself in a place where the GPS signal is not available, you better be able to read a map.

That being said, I don’t even carry paper maps with me when I travel.

Read more

BBBC #21 – Best book ever

This is an interesting and timely topic.  As I daydream and fantasize about taking longer and longer trips on the motorcycle, I start to think of the time between saddle time.  The time when I am not actually riding.  Sometimes in my daydreams I’m camping, other times I’m in a hotel… but not a big chain hotel; a little bed and breakfast.

Either way, when I’m watching the scene play out, I am reading a book.  I might be reading around a firepit or in a chair in the room or maybe just taking a break reading under a tree.

But what is the book I’m reading?

Read more

BBBC #20 – Your best friend

As ToadMama rightly points out, having just one best friend is a little weird.  Perhaps when I was little and didn’t know very many people I would have said “Brett is my best friend” and meant it.  But now-a-days, I know so many more people.  I don’t like any one of them to the exclusion of the others.

That being said, there are a few that I do consider to be “among my very best friends”.

Read more

BBBC #19 – Your favorite snack food

I tend to be very streaky.  I will latch on to one thing and be totally dedicated to it for a while.  Then, for whatever reason, it’ll pass and I’ll latch on to something else.  For this reason, it’s hard for me to pick a “favorite” snack food.

But there is one thing.  I believe it should be classified as a Schedule I drug.  Something with no medical use and a high potential for abuse.  I speak of:

The white cheddar Cheez-It.

Read more

Scroll To Top