Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pretty code

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> General Programming
General Programming  
Author Message
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Tue Jun 20, 2006 9:10 pm    Post subject: Pretty code Reply with quote

Clearly, pretty code is in the eye of the beholder: Pretty Code, Ugly Code

"I don't know if I'd ever consider C code pretty, per se. Maybe it has a
nice personality. But pretty? No way. And I'm sure Ruby, Lisp, and
Smalltalk aficionados feel the same way about C# code. I know most C#
developers can barely force themselves to even look at VB.NET code."
Back to top
View user's profile Send private message
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Tue Jun 20, 2006 9:52 pm    Post subject: Reply with quote

The single most productive engineer that you're ever going to meet: Free Electron

"We were mid-to-late in a 1.0 product cycle and most of the engineers
were slowly moving from development into bug fix mode, but not Jerry,
he was still implementing... over and over again. That's the Screwed
Scenario, you've given a critical task to someone who is utterly unable to
complete it."
Back to top
View user's profile Send private message
CryWolf
Guest





PostPosted: Wed Jun 21, 2006 3:36 pm    Post subject: The Semicolon Wars Reply with quote

The Semicolon Wars - Every programmer knows there is one true
programming language. A new one every week

"C programs are also peppered with semicolons, but in C they are
statement terminators, not separators. What's the difference? C needs a
semicolon after the last statement, but Pascal doesn't. This discrepancy was
one of the gripes cited by Brian W. Kernighan of AT&T Bell Labs in a 1981
diatribe, 'Why Pascal is not my favorite programming language.' "


"Consider the Java expression Date(2006,1,1); what calendar date do you
suppose that specifies?The answer is February 1, 3906. In Java we count
months starting with 0, days starting with 1, and years starting with
1,900."
Back to top
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Sat Aug 05, 2006 11:55 pm    Post subject: Reply with quote

Jeff Atwood: MP3 Tags - A Spec-tacular Failure

"If the applications that ship with the operating system can't get ID3 tags
right, clearly something is wrong. And that something is the ID3 spec. How
does it suck? Let me count the ways..."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3136
Location: Europe

PostPosted: Fri Oct 06, 2006 11:33 am    Post subject: Reply with quote

Reddit: The scariest code

Google/Code searching for "abandon all hope"!
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3136
Location: Europe

PostPosted: Thu Oct 19, 2006 3:37 pm    Post subject: Reply with quote

JoS: The guilt of leaving a company with crappy code

"The other devs are web devs cum C# devs. Which was another
problem in my opinion. I don't think my boss (or these guys in fact) ever
managed to wrap their heads around the difference between a website
and a web application.

Anyway, thanks for the responses guys, I'll learn from this and suck it up.
My own personal take away is that I'll never work for somebody non
technical again. And i'll never work for a company who's primamry focus
is NOT software."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3136
Location: Europe

PostPosted: Mon Jan 08, 2007 5:33 pm    Post subject: Reply with quote

Slashdot: How Do You Know Your Code is Secure?

"Marucs Ranum notes taht 'It's really hard to tell the difference between
a program that works and one that just appears to work.' He explains that
he just recently found a buffer overflow in Firewall Toolkit (FWTK), code
that he wrote back in 1994. How do you go about making sure your code
is secure? Especially if you have to write in a language like C or C++?"
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Sat Feb 17, 2007 4:19 pm    Post subject: Reply with quote

Jeff Atwood: What's In a Version Number, Anyway?

"I remember when Microsoft announced that Windows 4.0 would be known as
Windows 95. At the time, it seemed like a radical, unnecessary change - naming
software with years instead of version numbers? Inconceivable!

In retrospect, switching away from software version numbers to years seems
like one of the wisest decisions Microsoft ever made."
Back to top
View user's profile Send private message Visit poster's website
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Mon Mar 26, 2007 12:37 am    Post subject: Reply with quote

Hacknot: Invasion Of The Dynamic Language Weenies

"An awareness of my own limitations is the most significant factor in
determining my approach to software development as a whole. That's
why the dynamic language features that a weenie would call 'flexible'
I would call 'an opportunity to err'."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3524
Location: Zagreb

PostPosted: Thu Oct 04, 2007 12:27 am    Post subject: Reply with quote

I found a link to a message containing some source code: safe string
copy and concetation
Well, here it is, __strlcat() funcion

Code:
size_t __strlcat(dst, src, siz)
   char *dst;
   const char *src;
   size_t siz;
{
   register char *d = dst;
   register const char *s = src;
   register size_t n = siz;
   size_t dlen;

   /* Find the end of dst and adjust bytes left but don't go past end */
   while (*d != '\0' && n-- != 0)
      d++;
   dlen = d - dst;
   n = siz - dlen;

   if (n == 0)
      return(dlen + strlen(s));
   while (*s != '\0') {
      if (n != 1) {
         *d++ = *s;
         n--;
      }
      s++;
   }
   *d = '\0';

   return(dlen + (s - src));   /* count does not include NUL */
}


I can't read this. I wasted several minutes trying to really see what it does,
but I had to give up. Small function, well described problem and solution,
and yet I couldn't see it in there. Within few iterations I changed its style
into this and made it a bit easier for my eyes.

Code:
size_t  __strlcat (
 char       *dstStr,
 const char *srcStr,
 size_t      maxTotalSize
)
{
   register char       *dstPtr = dstStr;
   register const char *srcPtr = srcStr;
   register size_t      maxToCopy = maxTotalSize;
   size_t               oldLen;

   /* Find the end of dstStr and adjust bytes left but don't go past end */
   while (*dstPtr && maxToCopy--)
      dstPtr++;
   
   oldLen = dstPtr - dstStr;
   maxToCopy = maxTotalSize - oldLen;

   if (!maxToCopy)
      return (oldLen + strlen(srcPtr));
   
   while (*srcPtr)  {
      if (maxToCopy != 1)  {
         *dstPtr++ = *srcPtr;
         maxToCopy--;
      }
      srcPtr++;
   }
   *dstPtr = '\0';

   return (oldLen + (srcPtr - srcStr));    /* count does not include NUL */
}
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3136
Location: Europe

PostPosted: Thu Oct 18, 2007 4:13 pm    Post subject: Reply with quote

Mac developer? Clean up your app

"Too many apps are shipped with debug symbols, uncompressed images,
redundant files or generally useless rubbish that not only wastes users’ disk
space, it ultimately ends up increasing the developer’s own bandwidth costs."
Back to top
View user's profile Send private message
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Thu Nov 08, 2007 12:59 pm    Post subject: Reply with quote

reddit - Who says C is simple?

"The following examples were actually encountered either in real programs
or are taken from the ISO C99 standard or from the GCC's testcases. My first
reaction when I saw these was: Is this C?. The second one was : What the
hell does it mean?"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> General Programming All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group