Never assume people know you think your code is crap
1,352
5
Advertisement
Lesson learned. When dealing with people in the professional world, never ever assume that they know you think your code is crap.
I was emailing back and forth with the guy mentioned recently about this potential project. Now I should know better than this - I'm an experienced B2B salesman and have many years of email communication on a professional level under my belt - but, intended as a throw-away comment, I mentioned that I had been playing around with the MySQL library and without thinking attached a cpp file I'd been using to test some concepts.
[source lang="cpp"]
#include
#include
#include
#include
#pragma comment (lib,"libmysql.lib")
int main()
{
try
{
MYSQL *conn;
conn=mysql_init(NULL);
if(!conn) throw std::runtime_error(mysql_error(conn));
if(!mysql_real_connect(conn,"www.freesql.org","*****","*****","*****",0,NULL,0)) throw std::runtime_error(mysql_error(conn));
std::cout << "Connected okay\n";
MYSQL_RES *result;
mysql_query(conn,"SELECT test.name,numbers.number FROM test JOIN numbers ON test.id=numbers.owner");
result=mysql_store_result(conn);
MYSQL_FIELD *field;
while(field=mysql_fetch_field(result)) std::cout << field->name << "\t";
std::cout << "\n";
int fields=mysql_num_fields(result);
MYSQL_ROW row;
while(row=mysql_fetch_row(result))
{
for(int i=0;i {
std::cout << (row ? row : "NULL") << "\t";
}
std::cout << "\n";
}
}
catch(std::exception &E)
{
std::cerr << E.what() << "\n";
}
return 0;
}
[/source]
I'd hope that those of you who have known me on here for a while understand that I am aware that this is terrible code, scribbled together purely to test some concepts.
But, of course, these people do not. Duh!
So today I get an email back with feedback from the programmers offshore who have produced a list of criticisms of the design of the above. Including things like "All the code is in main" and "This is not standard C++" and "The program returns 0 even on an error" and so on.
Daft sod that I am, it never actually occurred to me that people would assume I was presenting this as an example of work. With retrospect this was obviously very silly.
So maybe done too much damage already, so hope someone else may learn from this post. But I have rewritten the above, slightly trivial, example properly using classes to wrap and manage the MySQL resources and so on and resubmitted it with a very apologetic email. Be interesting to see what comes back.
Hey ho. You live and learn. Quite like being unemployed anyway. I've watched the entire first season of Battlestar Galactica in two days.
I was emailing back and forth with the guy mentioned recently about this potential project. Now I should know better than this - I'm an experienced B2B salesman and have many years of email communication on a professional level under my belt - but, intended as a throw-away comment, I mentioned that I had been playing around with the MySQL library and without thinking attached a cpp file I'd been using to test some concepts.
[source lang="cpp"]
#include
#include
#include
#include
#pragma comment (lib,"libmysql.lib")
int main()
{
try
{
MYSQL *conn;
conn=mysql_init(NULL);
if(!conn) throw std::runtime_error(mysql_error(conn));
if(!mysql_real_connect(conn,"www.freesql.org","*****","*****","*****",0,NULL,0)) throw std::runtime_error(mysql_error(conn));
std::cout << "Connected okay\n";
MYSQL_RES *result;
mysql_query(conn,"SELECT test.name,numbers.number FROM test JOIN numbers ON test.id=numbers.owner");
result=mysql_store_result(conn);
MYSQL_FIELD *field;
while(field=mysql_fetch_field(result)) std::cout << field->name << "\t";
std::cout << "\n";
int fields=mysql_num_fields(result);
MYSQL_ROW row;
while(row=mysql_fetch_row(result))
{
for(int i=0;i {
std::cout << (row ? row : "NULL") << "\t";
}
std::cout << "\n";
}
}
catch(std::exception &E)
{
std::cerr << E.what() << "\n";
}
return 0;
}
[/source]
I'd hope that those of you who have known me on here for a while understand that I am aware that this is terrible code, scribbled together purely to test some concepts.
But, of course, these people do not. Duh!
So today I get an email back with feedback from the programmers offshore who have produced a list of criticisms of the design of the above. Including things like "All the code is in main" and "This is not standard C++" and "The program returns 0 even on an error" and so on.
Daft sod that I am, it never actually occurred to me that people would assume I was presenting this as an example of work. With retrospect this was obviously very silly.
So maybe done too much damage already, so hope someone else may learn from this post. But I have rewritten the above, slightly trivial, example properly using classes to wrap and manage the MySQL resources and so on and resubmitted it with a very apologetic email. Be interesting to see what comes back.
Hey ho. You live and learn. Quite like being unemployed anyway. I've watched the entire first season of Battlestar Galactica in two days.
Advertisement
Advertisement
Advertisement
Discussion