Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

ratbert90 posted:

Well, I have hit the point of feeling dread when I wake up in the morning. :smith: Anybody need a embedded Linux guy? I am full stack baby.

We're looking for grown adults not babies, sorry :(

Volmarias fucked around with this message at 04:58 on Dec 19, 2017

Adbot
ADBOT LOVES YOU

FlapYoJacks
Feb 12, 2009

Volmarias posted:

We're looking for growth adults not babies, sorry :(
:smith:

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

My Rhythmic Crotch posted:

wow this thread is really weird. talk about Agile you ding dongs

The IRS is to tax on money as Agile is to tax on spirit.

Keetron
Sep 26, 2008

Check out my enormous testicles in my TFLC log!

Ok, sorry for that derail, I feel somewhat responsible.

My Rhythmic Crotch posted:

wow this thread is really weird. talk about Agile you ding dongs

We develop a big software thing in three teams. We use some sort of agile thing.
Now the bosses decided we need to change stuff, so there will be a company wide pilot to transition the entire company to the Spotify model! And one of our three teams is selected for this pilot, they should feel honored. Also they will be grouped with the other pilot teams, away from our product while still working on this product. Oh, is that inconvenient for you? Hmmm, let's move your team as well.

Portland Sucks
Dec 21, 2004
༼ つ ◕_◕ ༽つ
I came into work today to find a string of emails sent out to everyone in our company by someone whom I've never met (we have about 2000 employees) that read

quote:

As a way of saying thank you for all of your support over the years, my son [name] has provided the attached.

This is email one of three due to file size restrictions.

With a dozen or so pictures of his teenage son attached. Okay...that's weird.

This is followed up by another e-mail with videos of his son attached...

Then to top it off a third e-mail comes in

quote:

The remaining videos can be viewed on the <company> share

This dude filled our internal share drive with loving videos of his son.

Am I just an anti-social goon, or is this loving weird/creepy/egotistical in the weirdest way?

CPColin
Sep 9, 2003

Big ol' smile.
Was there a time in the past when all the employees banded together to pay for some sort of life-saving medical procedure for the kid? Because I could see that being worthy of one or two pictures. (But not dozens or hundreds.)

Portland Sucks
Dec 21, 2004
༼ つ ◕_◕ ༽つ

CPColin posted:

Was there a time in the past when all the employees banded together to pay for some sort of life-saving medical procedure for the kid? Because I could see that being worthy of one or two pictures. (But not dozens or hundreds.)

I guess that could be the case, I should ask around. He just sent out another e-mail to everyone

quote:

So the videos are very choppy when played on Windows Media Player. A better media player that you can download is the VLC media player, found here.

He really wants us to watch these loving videos.

KoRMaK
Jul 31, 2012



Come to VLC in the next 10 minutes if you want a dick sucking

smackfu
Jun 7, 2004

We have a new interim product owner who is just totally indifferent about agile. I think he preferred waterfall. Can you guys just point the next four sprints so I can schedule the contents of this release? Argh.

Theoretically he is leaving in March but we will see.

Keetron
Sep 26, 2008

Check out my enormous testicles in my TFLC log!

smackfu posted:

We have a new interim product owner who is just totally indifferent about agile. I think he preferred waterfall. Can you guys just point the next four sprints so I can schedule the contents of this release? Argh.

Theoretically he is leaving in March but we will see.

We have quarterly client meetings where the sprints for the quarter are planned. And yes, some of the stuff takes more than a sprint and in a complex environment things need to be aligned if there are interface changes. But every quarter?

ChickenWing
Jul 22, 2010

:v:

smackfu posted:

We have a new interim product owner who is just totally indifferent about agile. I think he preferred waterfall. Can you guys just point the next four sprints so I can schedule the contents of this release? Argh.

Theoretically he is leaving in March but we will see.

"What do you want in the release? Move that to the top of the backlog and hope."

CPColin
Sep 9, 2003

Big ol' smile.
Boss, going over the voluntary termination checklist: "Okay, 'Employee has turned in badges and keys.' So, you wanna get your badge?"
Me, scheduled to work for another seven hours today: "If I turn in my badge, I can't get back into the office, if I go to the bathroom."
Boss: "Oh. Hmm. I guess let's do this before lunch and then you can take off."
Me, pointlessly disguising that I'd been planning to sneak out early anyway: "Yeah, that works."

Swish!

Edit: Now two workmen are here to install a touchscreen monitor on the wall for the daily scrums, for some reason. Time to take a "ten-minute" break!

Edit2: After complaining multiple times about how issues (like which building I was going to be working in, where my desk was, whether I could help my teammates with tasks that were outside my department, etc.) repeatedly would sound like they were settled and then would just come up again later, my boss comes back in just now and says her boss didn't answer her texts, so she doesn't know if I can actually leave early. Meanwhile, she has led every talk since I gave notice with the assumption that I'm leaving because I'm used to Java and didn't like the transition to C#. Every time she says that, I say that's really a minor issue, but whatever.

CPColin fucked around with this message at 20:42 on Dec 22, 2017

Portland Sucks
Dec 21, 2004
༼ つ ◕_◕ ༽つ
My tech lead is finally starting to come around to the idea of not intentionally writing poo poo code (aka. it's better to copy paste than write functions because then you can see the code on the screen right away!). Anyone know of any good, concise, documents on good fundamentals of code design I can either give him or use as a training aid to dig us out of this hole?

Carbon dioxide
Oct 9, 2012

Portland Sucks posted:

My tech lead is finally starting to come around to the idea of not intentionally writing poo poo code (aka. it's better to copy paste than write functions because then you can see the code on the screen right away!). Anyone know of any good, concise, documents on good fundamentals of code design I can either give him or use as a training aid to dig us out of this hole?

Building Maintainable Software by J. Visser

E: Well, that's not very concise, as it's a full book. But it's not a bad book. It's based on the product his company sells where they scan your code for smells of bad code and give you a report. While I don't think it's usually worth paying for their service, the book itself has some good ideas on how to build a better code base. Comes in Java and C# editions I think.

Carbon dioxide fucked around with this message at 18:19 on Dec 28, 2017

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Portland Sucks posted:

My tech lead is finally starting to come around to the idea of not intentionally writing poo poo code (aka. it's better to copy paste than write functions because then you can see the code on the screen right away!). Anyone know of any good, concise, documents on good fundamentals of code design I can either give him or use as a training aid to dig us out of this hole?

I'm still struggling with this when I run into such people. I am assuming thanks to some ADHD that complete books are out of the question. I went too far, too fast on my last case of this and kind of got dismissed as "The Mad Scientist" when I went too far into design patterns and stuff too quickly. All I can really say is that the next step to me is encapsulating code and data in objects in order to start some OOP. Getting into any kind of abstraction beyond animal-cat-dog--which is completely useless, in my opinion--is too far.

Portland Sucks
Dec 21, 2004
༼ つ ◕_◕ ༽つ

Rocko Bonaparte posted:

I'm still struggling with this when I run into such people. I am assuming thanks to some ADHD that complete books are out of the question. I went too far, too fast on my last case of this and kind of got dismissed as "The Mad Scientist" when I went too far into design patterns and stuff too quickly. All I can really say is that the next step to me is encapsulating code and data in objects in order to start some OOP. Getting into any kind of abstraction beyond animal-cat-dog--which is completely useless, in my opinion--is too far.

We do a ton of python scripting for automation around here. The hurdle we just got over was why 500 line scripts with no function definitions are hard for other people to follow, or why adding i's to the end of a variable name to differentiate is confusing (aka. namei, nameii, nameiii, nameiiiii where i stands for instance?). I'm not even sure that OOP is needed for what we're doing. Just not straight up hammering out hundreds of lines in a row with no structure, no way to test, and no reuse of code.

I know exactly what you're talking about. I've failed at convincing them that the way they write code actually decreases our overall productivity by doing the :science: thing in the past. I'm not exactly sure what piqued his interest in not churning out literal poo poo this time, but he ended the day yesterday talking about wanting to write better code, and started today off with some whiteboarding and asking me to do some code review with him.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Portland Sucks posted:

We do a ton of python scripting for automation around here. The hurdle we just got over was why 500 line scripts with no function definitions are hard for other people to follow, or why adding i's to the end of a variable name to differentiate is confusing (aka. namei, nameii, nameiii, nameiiiii where i stands for instance?). I'm not even sure that OOP is needed for what we're doing. Just not straight up hammering out hundreds of lines in a row with no structure, no way to test, and no reuse of code.

I know exactly what you're talking about. I've failed at convincing them that the way they write code actually decreases our overall productivity by doing the :science: thing in the past. I'm not exactly sure what piqued his interest in not churning out literal poo poo this time, but he ended the day yesterday talking about wanting to write better code, and started today off with some whiteboarding and asking me to do some code review with him.

If we're still at the "can't even name variables in a sane way" then I can see where even objects can be a rough sell. I suppose next would be getting into modules and making all that code importable. I imagine you've reused code between these files often--given the copy-and-paste you were talking about. In this case, you're probably better off just showing it to your tech lead yourself because none of that is particularly time-consuming.

There's definitely a bunch of reuse across a series of ~500-line automation scripts; there's probably reuse within a single 500-line file. It's a different category of development than other things but it's definitely not write-once-read-never shell scripts. I don't know the exact nature of your automation, but if it's shell stuff, then I imagine you all have a whole song-and-dance over how to launch and monitor processes. Inevitably people get fed up with means Python has for this and tend to put a shell around it.

Portland Sucks
Dec 21, 2004
༼ つ ◕_◕ ༽つ

Rocko Bonaparte posted:

If we're still at the "can't even name variables in a sane way" then I can see where even objects can be a rough sell. I suppose next would be getting into modules and making all that code importable. I imagine you've reused code between these files often--given the copy-and-paste you were talking about. In this case, you're probably better off just showing it to your tech lead yourself because none of that is particularly time-consuming.

There's definitely a bunch of reuse across a series of ~500-line automation scripts; there's probably reuse within a single 500-line file. It's a different category of development than other things but it's definitely not write-once-read-never shell scripts. I don't know the exact nature of your automation, but if it's shell stuff, then I imagine you all have a whole song-and-dance over how to launch and monitor processes. Inevitably people get fed up with means Python has for this and tend to put a shell around it.

We do industrial manufacturing. Most of these scripts are for either data collection from PLC OPC servers and historians. Or for reading parameters from other systems and feeding them back into large scale industrial systems, adjusting parameters for or collecting information from physical testing routines, etc...

Lots of interaction with relational databases on the data side, there is basically zero process monitoring at this point. All of our scripts are either launched by windows task scheduler or SQL Server Agents because that's about as complex as they've been willing to get with it at this point. There's probably somewhere in the range of 1000-2000 of these scripts spread around about 200 physical single purpose servers.

geeves
Sep 16, 2004

Portland Sucks posted:

My tech lead is finally starting to come around to the idea of not intentionally writing poo poo code (aka. it's better to copy paste than write functions because then you can see the code on the screen right away!). Anyone know of any good, concise, documents on good fundamentals of code design I can either give him or use as a training aid to dig us out of this hole?

Any language in particular? This article ( http://williamdurand.fr/2013/07/30/from-stupid-to-solid-code/ ) covers an intro to SOLID which is a pretty good direction. Just following the Single Responsibility Principle and Open / Closed Principle will probably improve your code base dramatically - and make it easier to write tests for.

Also are you doing code review? Because sometimes it just takes the time to say, "how about we make this better by doing <foo>?" with the guidelines in mind. If you can look at code and see that one method does five different things just breaking that down into separate methods already is a win for maintainability.

Here is a good 2-part article about how to do code reviews without killing your co-workers

https://mtlynch.io/human-code-reviews-1/
https://mtlynch.io/human-code-reviews-2/

vonnegutt
Aug 7, 2006
Hobocamp.

Rocko Bonaparte posted:

If we're still at the "can't even name variables in a sane way" then I can see where even objects can be a rough sell. I suppose next would be getting into modules and making all that code importable. I imagine you've reused code between these files often--given the copy-and-paste you were talking about. In this case, you're probably better off just showing it to your tech lead yourself because none of that is particularly time-consuming.

I wonder how much of the resistance to "not writing garbage code" is not knowing how vs not knowing how AND being afraid of looking stupid. If there's a lot of ego tied up in it, framing it as "Hey, here's a little trick I use to {solve immediate glaring problem that is well understood by all involved}" rather than "You're doing Code Wrong, read a textbook" is probably going to go over better.

The last time I met resistance to testing (for example), I waited until we had yet another stupid outage and then wrote a test for the thing and showed everyone how it worked. The stated argument up to that point was that testing was too time-consuming, but I suspect that they also didn't know how and didn't want that to be exposed. Giving them a good example case to copy and expand on let them save face.

It might be a little hand-holdy, but good example code + thorough code review (with fully coded examples of how to do better - offered as suggestions, not rewrites) are a good way to get a team up to speed. Tone is super important when dealing with this stuff - if people are getting defensive, they're going to double down on bad habits.

Portland Sucks
Dec 21, 2004
༼ つ ◕_◕ ༽つ

vonnegutt posted:

I wonder how much of the resistance to "not writing garbage code" is not knowing how vs not knowing how AND being afraid of looking stupid. If there's a lot of ego tied up in it, framing it as "Hey, here's a little trick I use to {solve immediate glaring problem that is well understood by all involved}" rather than "You're doing Code Wrong, read a textbook" is probably going to go over better.

The last time I met resistance to testing (for example), I waited until we had yet another stupid outage and then wrote a test for the thing and showed everyone how it worked. The stated argument up to that point was that testing was too time-consuming, but I suspect that they also didn't know how and didn't want that to be exposed. Giving them a good example case to copy and expand on let them save face.

It might be a little hand-holdy, but good example code + thorough code review (with fully coded examples of how to do better - offered as suggestions, not rewrites) are a good way to get a team up to speed. Tone is super important when dealing with this stuff - if people are getting defensive, they're going to double down on bad habits.

I know I'm butting up against some egos. We're talking about a bunch of electrical engineers mostly who are in their 50s and taught themselves to code in FORTRAN that are writing python scripts and C# now. Typical conversations are in the format of (ask a yes/no question about a section of code) -> (receive 30 minute extremely defensive justification for why it's bad and he didn't have a choice at the time but could totally do it better now if he had the time).

Portland Sucks
Dec 21, 2004
༼ つ ◕_◕ ༽つ

geeves posted:

Any language in particular? This article ( http://williamdurand.fr/2013/07/30/from-stupid-to-solid-code/ ) covers an intro to SOLID which is a pretty good direction. Just following the Single Responsibility Principle and Open / Closed Principle will probably improve your code base dramatically - and make it easier to write tests for.

Also are you doing code review? Because sometimes it just takes the time to say, "how about we make this better by doing <foo>?" with the guidelines in mind. If you can look at code and see that one method does five different things just breaking that down into separate methods already is a win for maintainability.

Here is a good 2-part article about how to do code reviews without killing your co-workers

https://mtlynch.io/human-code-reviews-1/
https://mtlynch.io/human-code-reviews-2/

This is the kinda stuff I need to be reading. Thanks. I think I really just need a list of hot topics to cover when they get interested that can help start steering us towards some actual standardization in how we do things.

vonnegutt
Aug 7, 2006
Hobocamp.

Portland Sucks posted:

I know I'm butting up against some egos. We're talking about a bunch of electrical engineers mostly who are in their 50s and taught themselves to code in FORTRAN that are writing python scripts and C# now. Typical conversations are in the format of (ask a yes/no question about a section of code) -> (receive 30 minute extremely defensive justification for why it's bad and he didn't have a choice at the time but could totally do it better now if he had the time).

I would jump straight into example code in this case. If you know how to reduce duplication / encapsulate something better / etc I would write it up and submit it as part of your code review. You might be able to put a dent in some of that defensiveness if your changes seem both friendly and useful. So in practice that would look like:

"Foo seems like a really good approach we could use elsewhere. Why don't we make it its own class so we can import it a few other places? I'm thinking {fully functional example code here}. Then we could use it to fix bar and baz as well. What do you think?"

Portland Sucks
Dec 21, 2004
༼ つ ◕_◕ ༽つ

vonnegutt posted:

I would jump straight into example code in this case. If you know how to reduce duplication / encapsulate something better / etc I would write it up and submit it as part of your code review. You might be able to put a dent in some of that defensiveness if your changes seem both friendly and useful. So in practice that would look like:

"Foo seems like a really good approach we could use elsewhere. Why don't we make it its own class so we can import it a few other places? I'm thinking {fully functional example code here}. Then we could use it to fix bar and baz as well. What do you think?"

They don't do code reviews, my TL asking me to look over his stuff this morning was like the first time this has ever come up from anyone but me.

This is probably a question better served for the python thread, but at what point in just building scripts for automation should you start looking at implementing OOP structure? Currently what I'm handling is just a bunch of one off scripts that have a lot of duplication that could just be better served as a few importable libraries.

vonnegutt
Aug 7, 2006
Hobocamp.

Portland Sucks posted:

They don't do code reviews, my TL asking me to look over his stuff this morning was like the first time this has ever come up from anyone but me.

This is probably a question better served for the python thread, but at what point in just building scripts for automation should you start looking at implementing OOP structure? Currently what I'm handling is just a bunch of one off scripts that have a lot of duplication that could just be better served as a few importable libraries.

Maybe start by creating a library then? Start with a small one that just fixes one bit of the duplication, and make sure using it is as effortless as possible (error handling, good README, etc). That would probably help get people on your side, and once they start adding to your lib, then you can think about OOP principles and splitting your library into different classes based on SOLID principles.

Sandi Metz's OOP books are good references for these.

LLSix
Jan 20, 2010

The real power behind countless overlords

Portland Sucks posted:

We do a ton of python scripting for automation around here. The hurdle we just got over was why 500 line scripts with no function definitions are hard for other people to follow, or why adding i's to the end of a variable name to differentiate is confusing (aka. namei, nameii, nameiii, nameiiiii where i stands for instance?). I'm not even sure that OOP is needed for what we're doing. Just not straight up hammering out hundreds of lines in a row with no structure, no way to test, and no reuse of code.

I know exactly what you're talking about. I've failed at convincing them that the way they write code actually decreases our overall productivity by doing the :science: thing in the past. I'm not exactly sure what piqued his interest in not churning out literal poo poo this time, but he ended the day yesterday talking about wanting to write better code, and started today off with some whiteboarding and asking me to do some code review with him.

Oh. If that's the level of madness you're dealing with, Google has a style guide. I'd start with the C++ naming guide.

There's also a python style guide but it places more emphasis on neat tricks and assumes a certain baseline level of sanity your team hasn't reached yet: https://google.github.io/styleguide/pyguide.html#Naming

return0
Apr 11, 2007
The Google C++ standards historically were pretty weird, are they better now?

Capri Sun Tzu
Oct 24, 2017

by Reene

return0 posted:

The Google C++ standards historically were pretty weird, are they better now?

code:
string tableName;   // Bad - mixed case.
Apparently they think lower camelcase style i.e. the most common variable naming convention in the world is bad.

KoRMaK
Jul 31, 2012



vonnegutt posted:


Sandi Metz's OOP books are good references for these.
was going to say this. Artisanal, single-purpose classes

LLSix
Jan 20, 2010

The real power behind countless overlords

return0 posted:

The Google C++ standards historically were pretty weird, are they better now?

What do you mean by weird? They're certainly idiosyncratic and do some things I would prefer they'd done the other way, but all coding standards are going to be idiosyncratic.


Capri Sun Tzu posted:

code:
string tableName;   // Bad - mixed case.
Apparently they think lower camelcase style i.e. the most common variable naming convention in the world is bad.

Google's coding standard uses camelcase for typenames so having a variable name using something so close to the convention for types is bad.

Volguus
Mar 3, 2009
The only problem I would have with a company-wide coding standard would when it conflicts (or is too different) than the most common coding standard for that language. When you leave that company, you take the knowledge and the habits (good or bad) with you. If you're used to writing code in a weird (to others) way, is not going to be fun outside.

And saying: "but way X improves readability" is bullshit. If you're familiar with that style, of course it does, it is the only way. If you're not familiar with that style, it will look alien and will cause errors.

Bongo Bill
Jan 17, 2012

"Code Complete" is the book you want, if anything.

redleader
Aug 18, 2005

Engage according to operational parameters

LLSix posted:

Google's coding standard uses camelcase for typenames so having a variable name using something so close to the convention for types is bad.

The standard C# conventions use PascalCase for types and camelCase for local variables. You get used to it very quickly, and then find yourself getting irrationally annoyed when someone makes a Pascal-cased variable.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

vonnegutt posted:

I wonder how much of the resistance to "not writing garbage code" is not knowing how vs not knowing how AND being afraid of looking stupid. If there's a lot of ego tied up in it, framing it as "Hey, here's a little trick I use to {solve immediate glaring problem that is well understood by all involved}" rather than "You're doing Code Wrong, read a textbook" is probably going to go over better.
Unfortunately, Portland Sucks revealed the truth:

Portland Sucks posted:

We're talking about a bunch of electrical engineers mostly who are in their 50s and taught themselves to code in FORTRAN that are writing python scripts and C# now.
And there it is. I refuse to claim it as a career, but my current job is definitely dealing with REEWDASOC people (Random Electrical Engineer Who Did A Semester Of C) loving everything up. I'm a living Zamboni machine for that crap. Now let me crack these knuckles...

So my problem personally is I can get people to code well if they haven't coded at all, or they have coded a lot. If they have coded a little, then it's a hot mess. I think there's some kind of Dunning-Kruger Effect going on here with electrical engineers that did not have an intensive digital or software track in their curriculums. They usually ended up having some kind of formative programming course that really was very basic, and took away from it that programming is easy and people that struggle with it are morons. So all this talk of object-oriented programming, unit testing, maintainability, and the like is all just some prattle by lesser-borns. The elitism of a lot of these curriculums does absolutely nothing to help this.

Anyways, some of them do turn around.

vonnegutt posted:

Maybe start by creating a library then?
Yes! Very much this!

Watch it like a hawk and when your tech lead comes along and changes one of the functions from:
code:
def does_foo(some_arg):
  ...
to:
code:
def does_foo(some_arg, some_bool=False):
   if some_bool is True:
      SAME poo poo FROM original does_foo COPIED AND PASTED WITH ONE loving LINE INSERTED
   else:
      ORIGINAL does_foo
Then you can pounce with some abstraction talk. I reason that will take two weeks, tops. I had somebody do that on me the day after I started gather up the code into a common library before.

For what it's worth, a lot of code I have had to see EE people writing are indeed very procedural, but they lend themselves well to things like the Strategy Pattern or the Template Method Pattern. I particularly run into a lot of "always do A, B, and C but sometimes do God-knows-what in between them."

Also I kind of blew it when you said you were doing "automation" because that's another term that all the EE-heads at my company have kind of distorted to mean "glorified shell scripting." It was a real hoot when "singleton" turned into jargon to them. I imagine you could get them appreciating better compartmentalization with a library to handle data import and export between the various formats. If it's as regular as it sounds then that's the basis for a framework there: specify inputs, specify outputs, specify what eats it up, pull lever. They probably already are using tools that are connecting boxes together with arrows like that.

Taffer
Oct 15, 2010


redleader posted:

The standard C# conventions use PascalCase for types and camelCase for local variables. You get used to it very quickly, and then find yourself getting irrationally annoyed when someone makes a Pascal-cased variable.

Isn't that standard.... pretty much everywhere? Granted I mostly write Java, but I almost never see code that doesn't follow that basic standard.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Taffer posted:

Isn't that standard.... pretty much everywhere? Granted I mostly write Java, but I almost never see code that doesn't follow that basic standard.

Python in particular goes for lowercase_underscore_locals. Ditto for files and directories.

Xarn
Jun 26, 2015
Probation
Can't post for 31 minutes!
C++ is full snake_case language, for types as well as for variable names.

PascalCase is usually reserved for template arguments and PascalCase might come to signalize template concepts, so a

C++ code:
InputIterator a = ...
would mean that the type of a will be inferred according to the RHS, but it must conform to Input Iterator concept.

FlapYoJacks
Feb 12, 2009
My convention for c++:

Local variable: camelCase
Class variable or function name: PascalCase.
Static functions: camelCase

Makes it real easy to know if something is from within the function or not.

Destroyenator
Dec 27, 2004

Don't ask me lady, I live in beer

Portland Sucks posted:

My tech lead is finally starting to come around to the idea of not intentionally writing poo poo code (aka. it's better to copy paste than write functions because then you can see the code on the screen right away!). Anyone know of any good, concise, documents on good fundamentals of code design I can either give him or use as a training aid to dig us out of this hole?
I'd say the biggest aim is to make readable, maintainable code. If you can understand it and reason about it and make sensible changes to it without it falling apart then it's good enough. If you're in a big java enterprise place then that means following the SOLID/patterns stuff because that's what people know and expect, if you're writing one off scripts for automation then it means keeping it as simple and clean as possible. You're writing for an audience of your current team members and future maintainers so you don't need to go wild with patterns if they won't get it, but you can introduce that culture if you think it's worthwhile.

Simple starting points are code review where you question anything that isn't immediately obvious. Whether it's making longer variable names, adding comments to explain for external constraints (eg. 'this external library/hardware needs poking twice before it works'), simplifying control flow, or pulling repeated code out to functions, you goal should be the most understandable code possible. Function extraction, patterns, and objects all follow from making maintainable code in different settings but they aren't a magical goal in themselves.

Adbot
ADBOT LOVES YOU

Taffer
Oct 15, 2010


ratbert90 posted:

My convention for c++:

Local variable: camelCase
Class variable or function name: PascalCase.
Static functions: camelCase

Makes it real easy to know if something is from within the function or not.

If you're going to alter naming for local vars why not use hungarian notation instead, seeing as it's something of a real convention already? But the real answer is that you should do neither because a good IDE can make it immediately obvious which variables are local or not, and well designed functions (i.e. small ones) will be easy enough to read that it's obvious without any help like that.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply