Dev leads - Nitpicking on Code Style - Chicagoland Sportbikes
Chicagoland Sportbikes
 
Geek Squad to the rescue! fucken computer crashing on you again? another porn site infected your computer? tierd of your wife seeing your anal fisting videos and want to lock her out of the external HD? get the answers you need from our local computer experts.

 
LinkBack Thread Tools Display Modes
post #1 of 14 (permalink) Old 09-12-2007, 11:29 PM Thread Starter
[Online]
 
Fracker's Avatar
 
Join Date: Mar 2005
Location: Chicago
Posts: 3,695
Location: Chicago
Sportbike: Multistrada 1100S; CBR600RR
Years Riding: Since 2004
How you found us: CRR
           
Dev leads - Nitpicking on Code Style

Question to those who ever had to herd cats or, in other words, work as a development lead. Do you nitpick on code style / formatting / layouts in any way? If yes, to what degree? Not looking for specific items, just trying to get a general opinion.

I've recently been made responsible for another developer and it's only the second time when I have full control over everything that happens in the code of a multi-person project that's promising to grow large over time. I've had to manage people before, but it was mostly either informal tech leadership / code counseling / short stunts as a sub for primary leads. Now I'm responsible for everything, long term, and more people are joining the team soon.

I've created more or less solid code base before the other person started on the project and everything is uniform in terms of style. Lot of people joke I have OCD about code quality but they also compliment on how my code is easy to read.

Now, the new guy committed his code to SVN, I'm going through it and I'm seeing few things I dislike, mostly minor stuff like several lines of code going together without logical separation with blank lines or SQL statements without proper indentation. I wonder if I should raise this issue with the guy and make him follow the same level of code cleanliness that I set.

On one hand - I definitely should, because lax code writing quickly leads to code rot (broken window syndrome) and it's one of the worst things that can happen to the software project. One the other hand, functionally the code is good and considering that the developer switched to C# from Java in just a few weeks it is very good. I'm afraid that forcing the person to follow my style will discourage his creativity.

Also, I've noticed that all great dev leads that I worked with before ignored the minor stuff in regards of code style. The only thing they required was easy to read code that functionally worked well. However, code in all of those projects was more or less messy.

On the other hand, that one time when I had to manage someone on another project and I also had a say about the code style, I enforced it strictly and it worked well. The code stayed completely clean, uniform, easy to read and with low bug rate. But that was a short term thing and very specific (large number of stored procedures), so I'm not sure if the experience is relevant.

So, it sums up to the following - not enforcing code style leads to the risk of getting code rot, enforcing it may discourage the programmers (about the worst thing that can happen). And it's not clear what is the best solution.

Thoughts, opinions, ideas? Thanks in advance, ya all

- Stas

Thou shalt not disfigure the soul.
Fracker is offline  
Sponsored Links
Advertisement
 
post #2 of 14 (permalink) Old 09-12-2007, 11:40 PM
Irony helps us play!
 
Arch's Avatar
 
Join Date: Jan 2006
Location: N'ville
Posts: 29,508
Location: N'ville
Sportbike: 2000 F4
Years Riding: Long enough to know better
How you found us: some hot MILF whispered it in my ear
           
Draft up and have approved by upper management a 'coding standards' policy that sets out the policy covering all of those areas of formatting, logical grouping, commenting and hand it to them.

Then, it's simply part of the 'requirements' and not you being an asshole


Trust me on this... do not let bad code sit if you plan on building upon it or having someone else at some point have to maintain it.

The other old litmus is: If the coder got hit by a bus after work and died, how much of a bitch would it be to have someone else swoop in and take care of it or pick up where they left off?

Everyone Exaggerates

We're being taken for a ride... agaaaaaaain.....


Best Auto/Moto Insurance | Motorcycle Protection Today | FREE Trade-In Quote
Arch is offline  
post #3 of 14 (permalink) Old 09-13-2007, 12:02 AM Thread Starter
[Online]
 
Fracker's Avatar
 
Join Date: Mar 2005
Location: Chicago
Posts: 3,695
Location: Chicago
Sportbike: Multistrada 1100S; CBR600RR
Years Riding: Since 2004
How you found us: CRR
           
Thanks, Arch, I was hoping that you chime in.

Quote:
Originally Posted by Arch View Post
Draft up and have approved by upper management a 'coding standards' policy that sets out the policy covering all of those areas of formatting, logical grouping, commenting and hand it to them.

Then, it's simply part of the 'requirements' and not you being an asshole
The company I work for now decidedly does not have structured management. Organizational chart is flat, everyone except 5 folks on the very top is senior architect / consultant. It is based on trust and personal responsibility. When you work on one project, you can be the lead. On another project the roles may get shuffled in a different way. The huge advantage of everyone being equal is that no one is intimidated by a formal title, it is only knowledge, experience and intelligence that matter. You can openly disagree with others far more experienced than yourself and not be persecuted in any way. It is a very good system if you have the right people. But it also means I can't shift responsibility to upper management - if I'll come to them asking to sign such a document, they'll probably fire me for creating bureaucracy . If I'll create such a document - it comes from me and everybody knows that. However, I'm not afraid of being an asshole. This is business, not a popularity contest. My point of view is that you may have a your own opinion and disagree with me, and I'll listen to you, but in the end if you don't do as I say - get the fuck out of here . What I fear is discouraging people, killing creativity.


Quote:
Originally Posted by Arch View Post
Trust me on this... do not let bad code sit if you plan on building upon it or having someone else at some point have to maintain it.

The other old litmus is: If the coder got hit by a bus after work and died, how much of a bitch would it be to have someone else swoop in and take care of it or pick up where they left off?
Agreed. As someone riding a motorcycle, I emphasize that aspect all the time


BTW, any experience with the refactoring tools that can automatically reformat the code to the common standard? I'm using one (bought it long time ago with my own money) and it has the capability of creating a shared code style config. I'm thinking of getting the company buy the tool for everyone on the project, I know it works very well. But I've never used a tool for automatic code style management in a team environment before.

- Stas

Thou shalt not disfigure the soul.
Fracker is offline  
Sponsored Links
Advertisement
 
post #4 of 14 (permalink) Old 09-13-2007, 12:16 AM
Irony helps us play!
 
Arch's Avatar
 
Join Date: Jan 2006
Location: N'ville
Posts: 29,508
Location: N'ville
Sportbike: 2000 F4
Years Riding: Long enough to know better
How you found us: some hot MILF whispered it in my ear
           
It's a balance... time spent reformatting = lost time from new code

The last formatter I used (which worked great for years) was a set of SunOS binaries from a package called RIO. After Sun dropped binary compatibility I opted to keep 1 workstation at solaris 2.8 just to use it when needed. Luckily, over the 14 years, everyone does the proper formatting on their own that it's not needed anymore. Now we nit-pick about tab stops and saving as 4 spaces or har tabs (( A far easier battle since several editors will automatically convert them now ))

If you find a tool that does what you need, and it can work from the command line, it should be easy to write a script to check out the various source trees under SVN and script the reformatting and check them back in... I'll admit though, I've only recently started using SVN and I am not sure how well it will do if people still are working on code parts... but for a 'finished' project that everyone has all their changes updated into the tree, it *should* work..

As for the 'policy'.. perhaps just explaining to them that others will need to work on the code at some future point, it would be good for the team and the company to adopt a mostly-agreed upon 'style'... Naturally, if what they write is good code, definitely emphasize that over and over that it's just a formatting things... Maybe as another incentive, explaining that since the code is copyrighted by said company and if the company ever decided to file any patents or other 'protections' that it's important that the company produced code look the same style for consistency. If any part ever comes up in a dispute, it is embarrassing to defend badly formatted code versus properly formatted code... Make it readable for lawyers...

Everyone Exaggerates

We're being taken for a ride... agaaaaaaain.....


Best Auto/Moto Insurance | Motorcycle Protection Today | FREE Trade-In Quote
Arch is offline  
post #5 of 14 (permalink) Old 09-13-2007, 12:25 AM
stuck in 6th gear
 
Ernie's Avatar
 
Join Date: Apr 2002
Location: Palatine
Posts: 7,632
Location: Palatine
Sportbike: '99 SV650, GSX-R1K2, CRF230F5, '08 HM-S
Years Riding: not enough lately *(&%# work...
How you found us: LBK back in the day
           
you're his mentor. crack the whip!

he'll thank you for it later if he can understand the benefits of why you do things the way you do and how it will make his life easier and more productive for himself and the rest of the team.

if there are no benefits, then you're just being anal
Ernie is offline  
post #6 of 14 (permalink) Old 09-13-2007, 11:05 AM
Ninja Kick!
 
Insomniac's Avatar
 
Join Date: May 2007
Location: Schaumburg
Posts: 1,648
Location: Schaumburg
Sportbike: 09 R6 09, RS125
Years Riding: Not enough
How you found us: Spongebob
           
If a guy is fresh out of college the chances are his code formatting is text book accurate, but the code itself is about as useful as WSE being a sperm donor. If the guy has been coding for a few years he most likely has developed his own style which although functional is a lot lazier and not easy to update. A great programmer with plenty of experience however will be both functional, easy to update and efficient, but most likely a pain in the ass to read. Clean code is not always speed or time efficient and as such unfortunately only the great coders are going to know when and where to be cryptic to speed things up.

My point is to give people pointers depending on which level they are at. If they are fresh then concentrate on them minimizing code and thinking outside the box, the code will be relatively clean anyway. If they have some experience then concentrate on making them follow patterns and keep everything easy to update. If they are great but sloppy, then don't bother them, they won't change just because you wanna nag.

That said... java?.. JAVA?!?!?! I feel like vomiting....
Insomniac is offline  
post #7 of 14 (permalink) Old 09-13-2007, 01:24 PM Thread Starter
[Online]
 
Fracker's Avatar
 
Join Date: Mar 2005
Location: Chicago
Posts: 3,695
Location: Chicago
Sportbike: Multistrada 1100S; CBR600RR
Years Riding: Since 2004
How you found us: CRR
           
Quote:
Originally Posted by Arch View Post
It's a balance... time spent reformatting = lost time from new code
Agreed. I would like to avoid the need to reformat - it should be perfect every time it is checked in.

Quote:
Originally Posted by Arch View Post
If you find a tool that does what you need, and it can work from the command line
What I found is ReSharper - it is Visual Studio .NET refactoring plug in. Has a lot of powerful tools, highly flexible and configurable code reformatting is just one of them. Can't work from the command line, but still good enough.

Thanks!

- Stas

Thou shalt not disfigure the soul.
Fracker is offline  
post #8 of 14 (permalink) Old 09-13-2007, 01:25 PM Thread Starter
[Online]
 
Fracker's Avatar
 
Join Date: Mar 2005
Location: Chicago
Posts: 3,695
Location: Chicago
Sportbike: Multistrada 1100S; CBR600RR
Years Riding: Since 2004
How you found us: CRR
           
Quote:
Originally Posted by Ernie View Post
you're his mentor. crack the whip!

he'll thank you for it later if he can understand the benefits of why you do things the way you do and how it will make his life easier and more productive for himself and the rest of the team.

if there are no benefits, then you're just being anal
Finally, a good criterion for determining whether or not it's useful No, really... Good advice, thanks!

- Stas

Thou shalt not disfigure the soul.
Fracker is offline  
post #9 of 14 (permalink) Old 09-13-2007, 01:29 PM Thread Starter
[Online]
 
Fracker's Avatar
 
Join Date: Mar 2005
Location: Chicago
Posts: 3,695
Location: Chicago
Sportbike: Multistrada 1100S; CBR600RR
Years Riding: Since 2004
How you found us: CRR
           
Quote:
Originally Posted by Insomniac View Post
If a guy is fresh out of college the chances are his code formatting is text book accurate, but the code itself is about as useful as WSE being a sperm donor. If the guy has been coding for a few years he most likely has developed his own style which although functional is a lot lazier and not easy to update. A great programmer with plenty of experience however will be both functional, easy to update and efficient, but most likely a pain in the ass to read. Clean code is not always speed or time efficient and as such unfortunately only the great coders are going to know when and where to be cryptic to speed things up.

My point is to give people pointers depending on which level they are at. If they are fresh then concentrate on them minimizing code and thinking outside the box, the code will be relatively clean anyway. If they have some experience then concentrate on making them follow patterns and keep everything easy to update. If they are great but sloppy, then don't bother them, they won't change just because you wanna nag.

That said... java?.. JAVA?!?!?! I feel like vomiting....
The guy is not out of the college, he has a good experience, probably, more than I do. The code is functionally good, there is a room for improvement, but the problems are very minor.

That said, I agree that it has to be adjusted to a different experience levels. I guess I'll try to explain that I want to keep everything uniform because we already have some code. Also, that we expect more people to be added on the team and if we are not careful with keeping everything clean, it will become a mess. I hope he will get it.

Quote:
Originally Posted by Insomniac View Post
That said... java?.. JAVA?!?!?! I feel like vomiting....
What's wrong with Java? It's just another language..

- Stas

Thou shalt not disfigure the soul.
Fracker is offline  
post #10 of 14 (permalink) Old 09-13-2007, 01:42 PM
Ninja Kick!
 
Insomniac's Avatar
 
Join Date: May 2007
Location: Schaumburg
Posts: 1,648
Location: Schaumburg
Sportbike: 09 R6 09, RS125
Years Riding: Not enough
How you found us: Spongebob
           
Quote:
Originally Posted by Fracker View Post
The guy is not out of the college, he has a good experience, probably, more than I do. The code is functionally good, there is a room for improvement, but the problems are very minor.

That said, I agree that it has to be adjusted to a different experience levels. I guess I'll try to explain that I want to keep everything uniform because we already have some code. Also, that we expect more people to be added on the team and if we are not careful with keeping everything clean, it will become a mess. I hope he will get it.
Then yeah he should get it. If not, get him to spend some time auditing/optimizing other peoples code and he should start to come around to your way of thinking.

Quote:
Originally Posted by Fracker View Post
What's wrong with Java? It's just another language..
Code once, debug everywhere. It's decompileable (all your code are belong to me). It's a syntax nazi. It's slow. It's really freakin slow. It's a memory hog (not to mention it sandbox's it's memory usage under Linux). It's a CPU hog. It forces objects into situations where objects are unnecessary. It runs in a sandbox (this can be good and bad). It has an insane following of Tomcat lovers who think Java is enterprise ready and efficient for websites serving millions of uniques every hour, let alone a few thousand.
Insomniac is offline  
post #11 of 14 (permalink) Old 09-13-2007, 01:44 PM
Ninja Kick!
 
Insomniac's Avatar
 
Join Date: May 2007
Location: Schaumburg
Posts: 1,648
Location: Schaumburg
Sportbike: 09 R6 09, RS125
Years Riding: Not enough
How you found us: Spongebob
           
Just to add, it's also an intermediate language. It is neither compiled nor scripted. Damn I hate bytecode....
Insomniac is offline  
post #12 of 14 (permalink) Old 09-13-2007, 01:50 PM
Irony helps us play!
 
Arch's Avatar
 
Join Date: Jan 2006
Location: N'ville
Posts: 29,508
Location: N'ville
Sportbike: 2000 F4
Years Riding: Long enough to know better
How you found us: some hot MILF whispered it in my ear
           
Thanks.. you mention Java and Tomcat in the same post and it throws my neck out... way to go!

"Our 5 test users tested the speed and the website 'seemed' to be fast enough"

Yup.. now turn it loose on a site that gets hit no less than 1 million times an hour...

Everyone Exaggerates

We're being taken for a ride... agaaaaaaain.....


Best Auto/Moto Insurance | Motorcycle Protection Today | FREE Trade-In Quote
Arch is offline  
post #13 of 14 (permalink) Old 09-13-2007, 01:54 PM Thread Starter
[Online]
 
Fracker's Avatar
 
Join Date: Mar 2005
Location: Chicago
Posts: 3,695
Location: Chicago
Sportbike: Multistrada 1100S; CBR600RR
Years Riding: Since 2004
How you found us: CRR
           
Quote:
Originally Posted by Insomniac View Post
Code once, debug everywhere. It's decompileable (all your code are belong to me). It's a syntax nazi. It's slow. It's really freakin slow. It's a memory hog (not to mention it sandbox's it's memory usage under Linux). It's a CPU hog. It forces objects into situations where objects are unnecessary. It runs in a sandbox (this can be good and bad). It has an insane following of Tomcat lovers who think Java is enterprise ready and efficient for websites serving millions of uniques every hour, let alone a few thousand.
Er-r-r-r... I'm not really a Java programmer, but I worked with it a bit and they say a lot of same things about .NET. So, let me respond one by one...

Code once, debug everywhere - this applies to every complex crossplatform solution. Except for the really simple stuff or scripting languages, you will have to debug it everywhere, anyway. The fact that Java is crossplatform is nice per se.

It's decompileable (all your code are belong to me). - yeah, so is .NET. And so what? Just how many trade secrets do you have in your code? Most apps don't. And if you have a supersecret algorithm, chances are it's small - implement it in C++ and link. Also, you can use obfuscators to make decompiled code practically unusable.

It's a syntax nazi. - sorry, could you please explain?

It's slow. It's really freakin slow. It's a memory hog (not to mention it sandbox's it's memory usage under Linux). It's a CPU hog. - this is not true. It is easy to write real slow code in Java / .NET, but if you know what you are doing it's not much slower than native code for business applications. Once the intermediate byte code is JIT compiled, it's native and runs pretty quickly. It also can use few tricks and optimizations that native compilers can't do (like inlining JIT compiled code in runtime). Problem is that Java / .NET make it easy for unexperienced people to write the code and that creates the bad general perception.

It forces objects into situations where objects are unnecessary. - true, that... but there are value types. And again, it's determined by the programmer. You can use static methods to imitate C-like programming.

It has an insane following of Tomcat lovers who think Java is enterprise ready and efficient for websites serving millions of uniques every hour, let alone a few thousand. - well, it is. It works. Lots of large solutions run on Java. But I agree about the zealots - they are always unpleasant to deal with.

In the end, I think Java is just another language. There are good and bad sides, but overall, it's not that bad.

- Stas

Thou shalt not disfigure the soul.

Last edited by Fracker; 09-13-2007 at 01:56 PM.
Fracker is offline  
post #14 of 14 (permalink) Old 09-13-2007, 02:15 PM
Ninja Kick!
 
Insomniac's Avatar
 
Join Date: May 2007
Location: Schaumburg
Posts: 1,648
Location: Schaumburg
Sportbike: 09 R6 09, RS125
Years Riding: Not enough
How you found us: Spongebob
           
Quote:
Originally Posted by Fracker View Post
Code once, debug everywhere - this applies to every complex crossplatform solution. Except for the really simple stuff or scripting languages, you will have to debug it everywhere, anyway. The fact that Java is crossplatform is nice per se.
This is true, however most of the situations I've been in where I'd have wanted to be cross platform (mobile applications) I had to spend hours locating various extension documentations from hardware providers just to get simple functionality going.

Quote:
Originally Posted by Fracker View Post
It's decompileable (all your code are belong to me). - yeah, so is .NET. And so what? Just how many trade secrets do you have in your code? Most apps don't. And if you have a supersecret algorithm, chances are it's small - implement it in C++ and link. Also, you can use obfuscators to make decompiled code practically unusable.
I'm not a big fan of .NET either, but I do prefer it to Java. That said, I'm an expert reverse engineer. I've reversed supposedly unusable code created by obfuscators many, many times. Nearly any compiled language which compiles to native code assembly is hundred if not thousands of times more complex to reverse.

Quote:
Originally Posted by Fracker View Post
It's a syntax nazi. - sorry, could you please explain?
Java is very picky about how you write code. Everything has to be done exactly the way it's intended or it will simply throw errors. After your first 10,000 lines of code or so this becomes more of an annoyance than a problem, but it's still something I strongly dislike. That said, I'm an avid Perl coder so I'm happy to twist the rules a little.

Quote:
Originally Posted by Fracker View Post
It's slow. It's really freakin slow. It's a memory hog (not to mention it sandbox's it's memory usage under Linux). It's a CPU hog. - this is not true. It is easy to write real slow code in Java / .NET, but if you know what you are doing it's not much slower than native code for business applications. Once the intermediate byte code is JIT compiled, it's native and runs pretty quickly. It also can use few tricks and optimizations that native compilers can't do (like inlining JIT compiled code in runtime). Problem is that Java / .NET make it easy for unexperienced people to write the code and that creates the bad general perception.
Once JIT compiled it still runs in a sandbox and therefore all resources calls are monitored and slowed down. Since Java does all of it's own memory management, it also runs it's own separate thread along side other code, therefore wasting precious cycles that your code could be using. In the case of a web application any extra user level threads at all are a major hinderence. Java/.NET can be reasonable for some client side applications but as far as servers goes it should be avoided at all costs.

Quote:
Originally Posted by Fracker View Post
It forces objects into situations where objects are unnecessary. - true, that... but there are value types. And again, it's determined by the programmer. You can use static methods to imitate C-like programming.
Yup, but it's still a pain in the but especially when you want to write a quick app just to run as a cron job.

Quote:
Originally Posted by Fracker View Post
It has an insane following of Tomcat lovers who think Java is enterprise ready and efficient for websites serving millions of uniques every hour, let alone a few thousand. - well, it is. It works. Lots of large solutions run on Java. But I agree about the zealots - they are always unpleasant to deal with.
Lots of large solutions also run badly, are incapable of scaling, and crash. Take an 'enterprise' ready solution such as OpenFire. It supposedly handles many hundred of thousands of users, however running on a dual Xeon 2.8 with 2gig of ram it has trouble handling more than 2.000 users in it's database. Most of these apps are made by companies which never consider their applications will ever be used in situations with more than a few users.
Insomniac is offline  
Reply

Quick Reply
Message:
Options

Register Now



In order to be able to post messages on the Chicagoland Sportbikes forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.

User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.

Password:


Confirm Password:
Email Address
Please enter a valid email address for yourself.

Email Address:
OR

Log-in










Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page
Display Modes
Linear Mode Linear Mode



Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

 
For the best viewing experience please update your browser to Google Chrome