The Joys Of Programming

Gave a talk at the OU math club about programming and the tech industry in general.
I think I didn't make a complete mess of it.

Awesome! Is the talk or the slides online anywhere?

Mixolyde wrote:

Awesome! Is the talk or the slides online anywhere?

++

No. It was me and a legal pad of notes saying things.
They didn't have a DVI plugin for my laptop so I had to write out all my examples on the chalkboard.

as A

SixteenBlue wrote:
Cyranix wrote:

Is there a good framework for developing a RESTful service in Java? Inspired by a talk at QCon on micro-services, I want to slap together a quick prototype to try wrapping REST interfaces around two related components of a codebase I've been working on. In this prototype, the micro-service for Component A would receive requests from a user, either through a browser or the command line, whereas the micro-service for Component B would only receive requests triggered by Component A.

Am I looking for something like Restlet or Jersey? Rescue my tired brain!

Yeah, I recommend Jersey. I used it for a quick side project and it was incredibly easy to plug in to my existing application. If you're looking for a more complete package, I recommend taking a look at DropWizard. I haven't used it yet but I've used most of those libraries and they're all solid.

Jersey is good, but as an alternative I would suggest trying ApacheCXF.

kazar wrote:

as A

SixteenBlue wrote:
Cyranix wrote:

Is there a good framework for developing a RESTful service in Java? Inspired by a talk at QCon on micro-services, I want to slap together a quick prototype to try wrapping REST interfaces around two related components of a codebase I've been working on. In this prototype, the micro-service for Component A would receive requests from a user, either through a browser or the command line, whereas the micro-service for Component B would only receive requests triggered by Component A.

Am I looking for something like Restlet or Jersey? Rescue my tired brain!

Yeah, I recommend Jersey. I used it for a quick side project and it was incredibly easy to plug in to my existing application. If you're looking for a more complete package, I recommend taking a look at DropWizard. I haven't used it yet but I've used most of those libraries and they're all solid.

Jersey is good, but as an alternative I would suggest trying ApacheCXF.

Looking through the documentation, that looks to much much more heavy weight and time consuming than Jersey. Serious overkill for a prototype.

They are both both JSR311 compliant so you can swap one for the other. But apache cxf can turn rest into soap without any extra code. I found Jersey to be the heavy weight version. There are so many sub modules.

Anyone got any good suggestions for online resources for learning:

a) Hadoop/map-reduce
b) Amazon EC2
and
c) Hadoop on EC2

I saw Question B pop up on Hacker News recently: http://news.ycombinator.com/item?id=...

I found Hadoop's Map/Reduce to be pretty straightforward -- have you ever done M/R at all? If your jobs are straightforward, the usage is about as simple as it gets:

  • Define mapper and reducer classes that implement the corresponding interfaces with appropriate generic type arguments
  • Define the map method in the mapper and reduce method in the reducer
  • If you need to load any resources before the map or reduce operation, override the setup method; override the cleanup method for corresponding teardown
  • Write an entry point that creates a Job object, which will hold your configuration properties and let you connect your mapper and reducer

Be sure to use the "new" API (has "mapreduce" in the package name instead of "mapred"). I can't pull up a better guide at the moment, but I bet Cloudera has some good docs on their site.

I know you said online resource but I learned Hadoop from this book and it was surprisingly helpful. Not sure when the last time I learned a new technology from a book was.

Cyranix wrote:

I saw Question B pop up on Hacker News recently: http://news.ycombinator.com/item?id=...

I found Hadoop's Map/Reduce to be pretty straightforward -- have you ever done M/R at all? If your jobs are straightforward, the usage is about as simple as it gets:

I haven't done any M/R before but I have done a lot of Grid Engine work over the years. To be honest my jobs are very straightfoward, although each map task will be about 15-30mins CPU time. From what I've read thus far it looks pretty easy.

SixteenBlue wrote:

I know you said online resource but I learned Hadoop from this book and it was surprisingly helpful. Not sure when the last time I learned a new technology from a book was.

O'Reilly is pretty good. Picked up PHP through Programming PHP back in college, and just ordered Learning Rails 3 over the weekend.

I like to leave defensive, insulting comments to future me in my code.

Like, if something's an inefficient hack, I'll write something about how it's easier this way, it only runs once in the middle of the night, it's not performance critical... basically, the sort of comments everyone does (or should do) with an ugly hack, but I assume future me is all pissed off about it, so I get all defensive and call him an idiot.

Past me is a dick.

*Legion* wrote:

I like to leave defensive, insulting comments to future me in my code.

Like, if something's an inefficient hack, I'll write something about how it's easier this way, it only runs once in the middle of the night, it's not performance critical... basically, the sort of comments everyone does (or should do) with an ugly hack, but I assume future me is all pissed off about it, so I get all defensive and call him an idiot.

Past me is a dick.

I tend to leave olde timey warnings like "abandon hope all ye who enter here" and "Here be dragons" and occasionally things like "Seriously, you do not want to look in here"

My favorite comments I've seen at work come from the older brother of one of our current devs.
#This is dumb
#Stupid validation code
etc

In college I woke up to find that I had commented:
// Drunk, fix later.

I freaking love Rands in Repose. The post he put out today (http://www.randsinrepose.com/archive...) speaks volumes to me, as I am a Volatile working as a renegade in a sea of Stables. Although his posts are from a managerial perspective, I think every coder can benefit from reading some of his articles on organizational and interpersonal dynamics.

*Legion* wrote:

I like to leave defensive, insulting comments to future me in my code.

Like, if something's an inefficient hack, I'll write something about how it's easier this way, it only runs once in the middle of the night, it's not performance critical... basically, the sort of comments everyone does (or should do) with an ugly hack, but I assume future me is all pissed off about it, so I get all defensive and call him an idiot.

Past me is a dick.

I thought I was the only one who did that!

I found comment in an else-clause once that handled some error condition:

//Houston, we have a problem

tboon wrote:
*Legion* wrote:

I like to leave defensive, insulting comments to future me in my code.

Like, if something's an inefficient hack, I'll write something about how it's easier this way, it only runs once in the middle of the night, it's not performance critical... basically, the sort of comments everyone does (or should do) with an ugly hack, but I assume future me is all pissed off about it, so I get all defensive and call him an idiot.

Past me is a dick.

I thought I was the only one who did that!

I found comment in an else-clause once that handled some error condition:

//Houston, we have a problem

This was weird for me, as one of our projects is known as Houston.

We do this a lot, and I've reason to be grateful for it. Today we avoided going down a rabbit-hole left over from 2005 again because of one of those.

Cyranix wrote:

I freaking love Rands in Repose. The post he put out today (http://www.randsinrepose.com/archive...) speaks volumes to me, as I am a Volatile working as a renegade in a sea of Stables. Although his posts are from a managerial perspective, I think every coder can benefit from reading some of his articles on organizational and interpersonal dynamics.

Good article. I am definately a Volatile and my boss is definately a Stable. I agree with both philosophies but feel that you have to be willing to fail if you want to succeed. Some people are just scared to fail.

kazar wrote:
Cyranix wrote:

I freaking love Rands in Repose. The post he put out today (http://www.randsinrepose.com/archive......) speaks volumes to me, as I am a Volatile working as a renegade in a sea of Stables. Although his posts are from a managerial perspective, I think every coder can benefit from reading some of his articles on organizational and interpersonal dynamics.

Good article. I am definately a Volatile and my boss is definately a Stable. I agree with both philosophies but feel that you have to be willing to fail if you want to succeed. Some people are just scared to fail.

Very good read. I suspect I fall into the realm of "stable", but I'm not sure where I got my battle scars from. I just have an appreciation for order and direction. On the other hand, I also appreciate what "volatiles" bring to the table - just keep them on the other end of that table

tboon wrote:
*Legion* wrote:

I like to leave defensive, insulting comments to future me in my code.

Like, if something's an inefficient hack, I'll write something about how it's easier this way, it only runs once in the middle of the night, it's not performance critical... basically, the sort of comments everyone does (or should do) with an ugly hack, but I assume future me is all pissed off about it, so I get all defensive and call him an idiot.

Past me is a dick.

I thought I was the only one who did that!

I found comment in an else-clause once that handled some error condition:

//Houston, we have a problem

After a long comment attempting to explain how a particularly complicated and counterintuitive algorithm worked, I added:

// If you understood this, lose 1D6 SAN.

I was working through Stephen Kochan's Programming in Objective-C last night and got to an exercise where I needed to extend a calculator class to incorporate sine, cosine, and tangent. I learned a lot about the precision, or lack-thereof, of Obj-C longs and doubles. Apparently I needed to incorporate the NSNumber object to achieve my desired precision, got frustrated at the complexity and went to look at the book's source code. The author utilized the native sin(), cos(), and tan() functions from the native math.h library. I totally missed the point of the exercise and realized that I'm terrible at realizing the utility of native libraries. On the bright side, I'm much more comfortable with categories.

Spoiler:

Not worth it.

CaptainCrowbar wrote:
tboon wrote:
*Legion* wrote:

I like to leave defensive, insulting comments to future me in my code.

Like, if something's an inefficient hack, I'll write something about how it's easier this way, it only runs once in the middle of the night, it's not performance critical... basically, the sort of comments everyone does (or should do) with an ugly hack, but I assume future me is all pissed off about it, so I get all defensive and call him an idiot.

Past me is a dick.

I thought I was the only one who did that!

I found comment in an else-clause once that handled some error condition:

//Houston, we have a problem

After a long comment attempting to explain how a particularly complicated and counterintuitive algorithm worked, I added:

// If you understood this, lose 1D6 SAN.

See, I tend to encourage my future self to get rid of this crap. For instance:

# TODO: dehacktify ("+ 9"? Seriously??)

I was thinking about brushing up on my C++ again and checking out what's changed with C++11 when a colleague sent me this link: http://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers

The essence of the issue is that “&&” in a type declaration sometimes means rvalue reference, but sometimes it means either rvalue reference or lvalue reference. As such, some occurrences of “&&” in source code may actually have the meaning of “&”...

And it then gets even less comprehensible

Zelos wrote:

I was thinking about brushing up on my C++ again and checking out what's changed with C++11 when a colleague sent me this link: http://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers

The essence of the issue is that “&&” in a type declaration sometimes means rvalue reference, but sometimes it means either rvalue reference or lvalue reference. As such, some occurrences of “&&” in source code may actually have the meaning of “&”...

And it then gets even less comprehensible :-(

This kind of sh*t is why I love C#, although I admit it didn't get good til .Net 3.5 or maybe 4.0.
To me, the best layering of languages is like this:
Assembly
C
C#

Can you just imagine how great C would be if it had a good macro system?

This is a pet peeve of mine, why are virtual machines so limited in their opcodes? It's a virtual machine, make it do any damn thing you want, especially if there's a chance a processor doesn't support an analogous instruction (I'm thinking about stuff like SSE4 or AVX, or maybe 64-bit math on a 32-bit processor, etc.).

Zelos wrote:

I was thinking about brushing up on my C++ again and checking out what's changed with C++11 when a colleague sent me this link: http://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers

The essence of the issue is that “&&” in a type declaration sometimes means rvalue reference, but sometimes it means either rvalue reference or lvalue reference. As such, some occurrences of “&&” in source code may actually have the meaning of “&”...

And it then gets even less comprehensible :-(

Yeesh. C++ has been a mess since templates went in. And they finally fix being able to type

Foo > x; //look ma, no space between the >'s - this used to not compile

but replaced it with something else for the other languages to make fun of.

So, so glad I don't do a lot of C++ anymore.

Edit: bah, Drupal eats angle brackets for dinner evidently. Trust me, my point is witty and poignant.

tboon wrote:
Zelos wrote:

I was thinking about brushing up on my C++ again and checking out what's changed with C++11 when a colleague sent me this link: http://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers

The essence of the issue is that “&&” in a type declaration sometimes means rvalue reference, but sometimes it means either rvalue reference or lvalue reference. As such, some occurrences of “&&” in source code may actually have the meaning of “&”...

And it then gets even less comprehensible :-(

Yeesh. C++ has been a mess since templates went in. And they finally fix being able to type

Foo > x; //look ma, no space between the >'s - this used to not compile

but replaced it with something else for the other languages to make fun of.

So, so glad I don't do a lot of C++ anymore.

Edit: bah, Drupal eats angle brackets for dinner evidently. Trust me, my point is witty and poignant.

Visual Studio 2008 could handle that already.

SixteenBlue wrote:

Visual Studio 2008 could handle that already.

But in a non-standard way. The C++98 standard created the problem and the C++03 explicitly says double right brackets must always be parsed as the right-shift operator.

But I'm just using this as an example of how crazy C++ has gotten from the perspective of someone who started writing code in it in the late 1980s. If folks like C++, more power to them. I used to love it. It's just so complex to parse that even all the smart people on the ISO 14882 committee (and there are a lot of really smart people on the C++ standards committee) can't add a feature without busting some part of the syntax.

At this stage in life, I am looking for easier and C++ ain't it.