IT/Software career thread: Invert binary trees for dollars.

ShakyJake

<Donor>
7,703
19,409
We have the "NIH" (not invented here) syndrome where I work. In fact, one of the other developers claimed that we cannot use open source libraries because we would, in turn, have to give away our software for free. Not sure where the hell he got that from.

The point is, though, is there is no way you or your team is going to write something better than what the community already has. Going back to the data structure examples - I'm not going to write my own BST when I know what's already in the Java or .NET library will be way more efficient than anything I can cook up.
 

Vinen

God is dead
2,783
490
We have the "NIH" (not invented here) syndrome where I work. In fact, one of the other developers claimed that we cannot use open source libraries because we would, in turn, have to give away our software for free. Not sure where the hell he got that from.

The point is, though, is there is no way you or your team is going to write something better than what the community already has. Going back to the data structure examples - I'm not going to write my own BST when I know what's already in the Java or .NET library will be way more efficient than anything I can cook up.
Some licenses do that. (Or at least force you to really think about how your product is designed to avoid having to give away stuff)

Read the GNU license someday and you will shit yourself.
GNU General Public License, version 3 (GPL-3.0) | Open Source Initiative
 

Tenks

Bronze Knight of the Realm
14,163
606
We have the "NIH" (not invented here) syndrome where I work. In fact, one of the other developers claimed that we cannot use open source libraries because we would, in turn, have to give away our software for free. Not sure where the hell he got that from.

The point is, though, is there is no way you or your team is going to write something better than what the community already has. Going back to the data structure examples - I'm not going to write my own BST when I know what's already in the Java or .NET library will be way more efficient than anything I can cook up.
Using a modern GNU you aren't required but some open source does in fact specify you have to open source your software if using it. We had to write our own Z39.50 communication library because for the longest time (maybe still?) Yaz4J required you to open source your software if using it.
 

ShakyJake

<Donor>
7,703
19,409
I've tried a handful of different prefix notations, including pSomePointer, bSomeBool, void someFunc(int _someParam). I've found that the two prefixing that have stuck are m_ for member variables and I for interfaces (Ex: IShapeFactory).

this.someMember is perfectly fine, but I find that using this. or this-> can be disruptive when used inconsistently and cluttered when used consistently Ex:

and

are both annoying compared to:

I agree. Microsoft style guidelines recommend using "this." instead of prefixes, but honestly it just looks noisy. I've seen the "m_" prefix elsewhere, but I prefer the even simpler underscore and that's it.

Speaking of variable prefixes, one of the developers here has a habit of prefixing "my" to method variables. Like "myQuery". Why not just simply write "query"? Everything is "my" this and "my" that.
 

moontayle

Golden Squire
4,302
165
There's a few internal helper libraries that have popped up in the code I'm working on but they're mostly for simple things like IO functions. I've avoided using them since they don't inherently do anything better or more efficient than base Java.

Google dropped support for Apache HTTP in 5.1 so when I get around to tackling the parts of our code that use them I'm going to switch over to OkHTTP. That should be fun.

I agree. Microsoft style guidelines recommend using "this." instead of prefixes, but honestly it just looks noisy. I've seen the "m_" prefix elsewhere, but I prefer the even simpler underscore and that's it.

Speaking of variable prefixes, one of the developers here has a habit of prefixing "my" to method variables. Like "myQuery". Why not just simply write "query"? Everything is "my" this and "my" that.
I admit to using prefixing, but only for variables attached to the UI element. 'et' for EditText, 'lv' for ListViews. Things like that. Much easier to identify on the fly, no need to reference the declaration, something I do a lot with the code already in place since the person before me had no conventions to naming anything.
 

Vinen

God is dead
2,783
490
I agree. Microsoft style guidelines recommend using "this." instead of prefixes, but honestly it just looks noisy. I've seen the "m_" prefix elsewhere, but I prefer the even simpler underscore and that's it.

Speaking of variable prefixes, one of the developers here has a habit of prefixing "my" to method variables. Like "myQuery". Why not just simply write "query"? Everything is "my" this and "my" that.
this. looks more noisy then m_? The giant benefit is you don't need to name the variable as m_. You can name it what is is then reference the member variable with this.
 

Tenks

Bronze Knight of the Realm
14,163
606
I generally explicitly use "this" even when optional. I don't prefix any of my variables. I also don't like to prefix interfaces with "I" I prefer to postfix them with "able." Since interfaces generally imply actions an implementing class can perform. So I'd have a "Rollable" interface and the Ball class will implement Rollable since rolling is an action the ball can perform.
 

Khane

Got something right about marriage
19,986
13,562
I also don't like to prefix interfaces with "I" I prefer to postfix them with "able." Since interfaces generally imply actions an implementing class can perform. So I'd have a "Rollable" interface and the Ball class will implement Rollable since rolling is an action the ball can perform.
Everyone in the .NET world hates you
 

Vinen

God is dead
2,783
490
I generally explicitly use "this" even when optional. I don't prefix any of my variables. I also don't like to prefix interfaces with "I" I prefer to postfix them with "able." Since interfaces generally imply actions an implementing class can perform. So I'd have a "Rollable" interface and the Ball class will implement Rollable since rolling is an action the ball can perform.
Postfixing something is god awful retarded.
Do you read backwards?

Everyone in the .NET world hates you
Every developer with 1/5th of a brain would.
 

Noodleface

A Mod Real Quick
37,961
14,509
We prefix everything, it's so much nicer for me to read "gSomeShitFucker" and know it's global than try to guess.
 

Tenks

Bronze Knight of the Realm
14,163
606
I've never seen anyone post-fix at a sane development shop.
What is standard for Interface naming in java api - Stack Overflow

Stephen Colebourne's blog: More Java prefixs and suffixes

Fooable - This would be used for an interface where the implementations are in some way related to Foo. An example would be Identifier and Identifiable. In this case, the -able suffix implies that the implementing class "can be identified". In code terms that usually means a single getFoo() or toFoo() method.
Beginning Java 7 - Jeff Friesen - Google Books
 

Khane

Got something right about marriage
19,986
13,562
I just don't get why you wouldn't put I as a prefix for an interface and instead use "Class"able. It's like 6 on one hand and a half dozen on the other except that I is the industry standard and everyone will immediately recognize it as an interface as a result.
 

Asshat wormie

2023 Asshat Award Winner
<Gold Donor>
16,820
30,967
So first entry of my rebuttal against the Clean Coding book. I actually like the book so far and have little bad to say about it by page 40, but I do have a few things.

I'll start out with a practice I follow that I actually like, but can see others not liking:


I find that functions perform some operation and should be describable as a verb. I think in C# (and other languages) this gets a little awkward because of the getter/setter property system making the verbs for the names impossible, but in C++ I like it.



And something I disagree with:


I've tried a handful of different prefix notations, including pSomePointer, bSomeBool, void someFunc(int _someParam). I've found that the two prefixing that have stuck are m_ for member variables and I for interfaces (Ex: IShapeFactory).

this.someMember is perfectly fine, but I find that using this. or this-> can be disruptive when used inconsistently and cluttered when used consistently Ex:

and

are both annoying compared to:

I also think the idea that the IDE will color your member variables making it so you don't need to worry about it a false assumption. I write a lot of different code on a large number of computers at work and I can't demand that all the languages I write on all the different platforms all be as good as Eclipse for java.

Again, this isn't a huge point to me, just the first thing I disagreed with.
I am of an opinion that explicit references to self are terribad so usage of "this" should be minimized as much as possible. However i also dislike the trailing underscore convention but i think its the lesser of two evils. As far as "this" is concerned, if it is required then the dot notation is preferable to me. "->" should be used strictly for dereferencing.

As far as the other posts about college education are concerned, I think colleges are doing their students a big disservice by offering just Computer Science degrees. A lot of people interested in programming are forced to get CS degrees and these are full of theory which isnt very useful outside academia. I think more places should offer a software engineering degree as well as CS degrees and make sure their students understand the difference. The number of people in theory classes pissed off at being forced to take such classes is always fairly large. On top of that, the number of people who could not finish such degrees due to compiler or programming languages or automata classes being required is fairly large and leads to people, who could be good developers, to being kept out of the field.
 

Obtenor_sl

shitlord
483
0
It depends on the position.

Entry level Software Engineers? Sure tell me when would you use a LinkedList over an Array, or a Hash. What's their efficiency when searching, or adding new elements. This more or less tests their logical mind, you'll never (or almost never) implement your own Datastructures, but it is important to know that for some type of data a tree is better than a list, or a hash, etc.

For a more advanced role, I usually put forth scenarios during interviews, I want to see how they approach the problem, what kind of architecture (we'll put a hook here, use a pattern like there, do some tdd/bdd here, etc).

I was reading the other day on glassdoor some questions about "how would you reverse an array?" and it was very interesting to see everybody's 10-15 line implementation in Java, C, C++ etc. And I mean interesting because if I'm asked that I'll just do it in Ruby in one liner:

words.reverse_each { |x| print x, ' ' }

Knowing your APIs in your language to take the bulk load of most operations instead of trying to create your own is what makes a great developer overall.
 

Asshat wormie

2023 Asshat Award Winner
<Gold Donor>
16,820
30,967
It depends on the position.

Entry level Software Engineers? Sure tell me when would you use a LinkedList over an Array, or a Hash. What's their efficiency when searching, or adding new elements. This more or less tests their logical mind, you'll never (or almost never) implement your own Datastructures, but it is important to know that for some type of data a tree is better than a list, or a hash, etc.

For a more advanced role, I usually put forth scenarios during interviews, I want to see how they approach the problem, what kind of architecture (we'll put a hook here, use a pattern like there, do some tdd/bdd here, etc).

I was reading the other day on glassdoor some questions about "how would you reverse an array?" and it was very interesting to see everybody's 10-15 line implementation in Java, C, C++ etc. And I mean interesting because if I'm asked that I'll just do it in Ruby in one liner:

words.reverse_each { |x| print x, ' ' }

Knowing your APIs in your language to take the bulk load of most operations instead of trying to create your own is what makes a great developer overall.
Using the reverse_each method wouldnt be very useful if the goal is to see how the engineer uses logic, no? I think the entire purpose of those complicated questions is to see if the person can reason through problems, not so much to see the solution.

Also what would you think if the ruby coder used .reverse.each instead of .reverse_each?