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
TheresaJayne
Jul 1, 2011
I cant really post the code that makes me cry...

its a single "small" java class, part of a bean for an article on a website.

15448 lines long,
113 lines of import statements,

and where i worked, only the senior devs were allowed to make changes in case anyone else broke it.

the next largest class was a paltry 5000 lines (and it was extended from this one)

/me sits down and weeps some more at the inhumanity of the class...

oh and this is a key part of a live website needing low latency

Adbot
ADBOT LOVES YOU

TheresaJayne
Jul 1, 2011

Contra Duck posted:

15888 lines, 230 imports :smith::hf::smithicide:

if its called Article.java,

say hi to the guys there :)

and i see they added more stuff, did the GWT stuff go in then :)

TheresaJayne
Jul 1, 2011

duck monster posted:

I've seen C written like that by an engineer who had only ever done verilog. Every single loving constant was defined as such Including things like const_two = 2 , etc.

Oh and the macros. God drat it macros are cool, but when every loving operation is first defined as a macro THEN applied to code, it very rapidly becomes brain damage inducing trying to read.

Ever heard of obsfuscation?

Its a common thing to obsufscate code to make you "irreplacable" and so secure your position in a job. (yeah right that will work right)

TheresaJayne
Jul 1, 2011

Zhentar posted:

That is pretty terrible. If he never makes you fix that poo poo yourself, you're never going to stop doing it.

but then he is doing standard coding standard,
ie he is doing
code:
public void main(String[] args) {
     System.out.println("yes i know this is java and not php!");
}
where his super prefers

code:
public void main(String[] args) 
{
     System.out.println("yes i know this is java and not php!");
}
Where ever i am, (as a java dev) i try to get everyone to use PMD as it ensures that the code always matches the defined rules and stops that sort of problem, and I do believe that you can tweak it to work properly with any language so a php rule file might be helpful.

TheresaJayne
Jul 1, 2011
at a previous place i used ClearCase that was so annoying,
I have used Subversion, Git, CSV and SourceSafe
currently i am using SVN and/or git with IDEA or NetBeans

TheresaJayne
Jul 1, 2011
Clearcase - where do i start, Its like you set up a project with modules (sounds a bit like maven that does) and some modules are documentation some are architect documents and some are source repositories,
I had to manage it at one point and boy did it suck, as you have to log in and do it all with command line and long command strings,

I remember doing source control with the m2 compression program in dos, it had a "extract the archive as it was on <date> command, very very handy.

TheresaJayne
Jul 1, 2011

Haud posted:

code:
if(x == 0)
   //Do Nothing
else
   DoSomething();
I took over development of a program, and this guy's work is full of stuff like this. Not even using return or anything, just comments that say //Do Nothing. I'm starting to wonder if he even knows that > and < exist.

I see that a lot, i think because code validators like PMD (in java) complain about
code:
if(variable != null) { 
do this
}
so people do stuff like this

code:
if(variable == null) {
  //do nothing
} else {
  //dosomething
}

TheresaJayne
Jul 1, 2011

Bunny Cuddlin posted:

Seriously? I didn't even realize this person was a woman until I read this post. What does this have to do with gender?

Nothing, and there are plenty of female programmers... Me included.

TheresaJayne
Jul 1, 2011
Shudder::::

Well I once worked for a large media company in the London UK area, They do the websites for people like Womens Tennis Association, Premier League Football sites, Big Brother (the TV series) website to do the Video Streaming.

And their system works on a huge in house CRM with Drag and Drop Layout system.

The main class in the application is called article.java

15773 lines
113 import statements
800 lines of variable / static variable definitions
2000 lines of Getters and Setters with some SQL calls dropped in
Then the rest is all business logic.

Only the Senior Architects were allowed to touch this file although EVERY new dev wanted to get it refactored.

TheresaJayne
Jul 1, 2011

Cerberus911 posted:

Finally something to contribute.

The following is from a dev that has been around for over 6 months, and apparently has over 10 years of experience.

code:
 mainTitleContainer.visible = (mainTitleContainer.visible == false) ? true : false; 
I've been going through a refactor of our app and the above just made me stop an go for a walk. All the features he has added are copy-paste of existing code with slight modifications.

As my Fave author says

quote:

The way you determine Good code from Bad code is WTF's per minute

TheresaJayne
Jul 1, 2011

geonetix posted:

Just ran into something that's always pretty sad (it's coldfusion, but the comments make it worse):

code:
// If the thread is still running.
if (redactedThread.status == 'RUNNING') {
	// Trace a message.
	trace(text="Waiting for redacted");
}
Every single line of code in this file has a comment. It wasn't there some revisions ago. Somebody actually spent time adding it.

Actually some programmers have a habit of writing the logic as a series of comments then adding the code, but usually once complete the comments are removed. ie.
code:
//Get the input string
//check if it starts with an expletive
//check if it ends with an expletive
//check if there is an expletive in the string
//if there is no expletive, 
//reject post on 4chan
//and allow post on SomethingAwful
//else
//allow post on 4chan
//and reject post on SomethingAwful
that would then be replaced by code doing said logic.

note: sorry about the expletive stuff, but just been implementing expletive check on the work site...

TheresaJayne
Jul 1, 2011

Goat Bastard posted:

I'm sure you didn't make the requirement, but this is as close as I've ever gotten to talking to someone who has: What is the possible business justification for this? If someone is goofing off on the internet instead of doing their job then blocking sites based on swear words isn't going to help that, it's a management issue not an IT issue.

On the other hand if (for example) a user is trying to read a relevant forum thread with a swear word in it, or a user is trying to download a library with an author who's name looks a bit like an English swear word, or a user is trying to download an actual English language dictionary then all that the swear word filter has accomplished is to prevent them from doing the job that they are paid for.

Seriously, swear filters are the stupidest things.

These are to prevent people putting unpleasant words on the site we have written,
Someone entered a job description (without the 1337 5p33k and non alphabetic characters)as:

"A Fu*&ing Cr4p job where you sit around and do Sh17 all day except getting p1553d and high on wacky backy"

TheresaJayne
Jul 1, 2011

feedmegin posted:

Hard drive? My first code was on a zx spectrum's tape drive somewhere. Kids these days :corsair:

I still have a pile of C30 cassettes for my old zx81...

TheresaJayne
Jul 1, 2011

Gazpacho posted:

The real horror is seeing MAX_PATH used all over a project to statically size strings that aren't even paths.

The weird thing is that when i see MAX_PATH in the forum i hear a voice in my head saying something like
"Max Path sat down at his desk, when there was a knock on his door. "Yep" he said as a gorgeous gal drifted in the opening door."

:)

TheresaJayne
Jul 1, 2011
Before I ever saw SVN and CVS I had only ever used Microsoft Source(un)safe

So when I started on Java/C projects at home i used UC2 compressor as it had functions like


UC2 E !DTT=YYYY-MM-DD/HH:MM:SS Dynamic Time Travel (extract archive as it was at that date)

Yes a Zip file utility had built in Version Control.....

TheresaJayne
Jul 1, 2011

BigRedDot posted:

I'm 40 and I work at a hot new startup, go figure.

Snap, although a little older than 40...

TheresaJayne
Jul 1, 2011

Pollyanna posted:

What in god's name is the reason for keeping this crap? Could it somehow not get any more efficient or something? Why does everything have to be a class?! All I want to do is print Hello World, come on.

Also, the interactive tutorial on learnjavaonline.org errors out when you try to complete the exercise. Bodes well for me.

Errm,

Have you ever tried a J2EE application, you dont have a main method there? or for an applet, all our servlets have @RequestMapping annotations and no sign of a main.

Main is used when you are running an application command line or GUi and its that way so you know where the program starts, otherwise it could start running anywhere...

Pascal now that was a strict language, you put the start of the program at the bottom and all subroutines if they called another had to be below the one they called.

TheresaJayne
Jul 1, 2011
I recently had to update our unit tests that had become out of date about 2 years ago.

I came across these tests.

assertTrue(expectedValue == result);


:freakout:

Why not just use assertEquals(expectedValue,result);

TheresaJayne
Jul 1, 2011
I remember working for a large company,

They do websites for large organisations all running on the same engine.

They had a restful SQL service so that devs didnt have to write new DAO/Service calls just call the webservice to get your query....

TheresaJayne
Jul 1, 2011

Amarkov posted:

C#, like Java, does not support multiple inheritance from non-interface classes. So making an empty abstract base class severely limits your ability to modify things.

C++ does support multiple inheritance, so it's not an issue. (Does C++ even have the concept of an interface, distinct from a pure virtual class?)

However if you are using TDD or something similar, then you need to have the interface to Mock, but true i guess with nothing in the interface to mock is a bit stupid.

TheresaJayne
Jul 1, 2011

PrBacterio posted:

Oh the fun you would have with the code base at my place of work. If even that (comparatively) insignificant little spelling mistake is enough to set you off I'd like to see your reaction to the kind of stuff I deal with every day :allears:

Its usual when you have indian coders,

For instance we have a class for mandatory fields in the CSS called

.mondatory {}

and the error messages reported on the webservices

"Username and Password not match"

TheresaJayne
Jul 1, 2011
Well this is a fresh one, I am just getting into Minecraft Mod Development,

I was looking at both Forgemod and Bukkit until i came across this laughable situation

in 1.7.2 they are getting rid of item Ids or as they want to call them "Magic Numbers"
so there is currently a method to return the object you are looking at

Block block = livingEntity.getTargetBlock(null,10);

Now i am developing in 1.6.4 which should not be affected except that they have deprecated ALL methods in the API including the older versions and have no replacement methods to actually do anything.

Currently the 1.6.4 javadoc reads as follows

getTargetBlock

@Deprecated
Block getTargetBlock(HashSet<Byte> transparent,
int maxDistance)
Deprecated. Magic value
Gets the block that the living entity has targeted.
Parameters:
transparent - HashSet containing all transparent block IDs (set to null for only air)
maxDistance - this is the maximum distance to scan (may be limited by server by at least 100 blocks, no less)
Returns:
block that the living entity has targeted


When asking one of the devs on IRC his answer was, "someone else who hasn't read the javadocs"

and when i pasted the Deprecated message he just reiterated his commment. and claimed that wasn't the javadoc.

So currently in Bukkit ALL the useful methods that might use an ID have been deprecated with no replacement methods available, and no explanation why included in the javadoc either.

TheresaJayne
Jul 1, 2011
Talking about recruitment, what i find laughable is i went for a job that offered to be cutting edge TDD/Agile

They gave me the toughest TDD programming test.

I got the job.

To find that its HARDCORE waterfall, with ISO9001 calling the shots. To change any code in any way needs authorisation from the Original Head Developer to make sure it follows his design (and I mean on a class level)
You have to Produce full designs for any new work that has to be signed off by clients before starting.
Daily Standups happen - The Head Of Operations (HOOP) walks up tells you what you are doing, end of standup.

My first week involved me staying late on my second day to help the others with a release - I did most of the work.

Needless to say I quit after 3 months and am glad I got out.

Now i work in a nice place that sold itself as Waterfall but trying to shoehorn agile in where possible.
And I love it....

TheresaJayne
Jul 1, 2011
Going back to the use of tech discussion up the page,

I still find people who are wizard programmers but dont even know to use Windows-P to select the monitor config - (even works on Linux)

people like to fit into small cubbyholes, for instance someone who is great at networking may suck at pc repair and the repair guy would suck at OS support etc.

Computing is All of that so you should be as happy wiring networks as coding the next uber game.

TheresaJayne
Jul 1, 2011
I was chatting with colleagues about bad code the other day,

One of them commented that in the source code they found the following comments

code:
/* 
eggs
cheese
bread
milk
potato
spaghetti
beans
butter
bacon
*/
obviously someone was coding whilst on the phone to their wife being given the weekly shop.

The bigger problem is that they committed it to SVN..

TheresaJayne
Jul 1, 2011

qntm posted:

I blame whoever buddy-checked it.

Whats that!!!?

(Not currently an issue but apparently at the time they were actually old style waterfall....)
review = Does it work? Yes! = Code passed

TheresaJayne
Jul 1, 2011
I have been doing some coding for minecraft mods, which are usually coded by complete novices who plough through examples until their code does what they want it to.

One thing i have noticed more than anything in their code

code:
String one;
String two;
String three;

String one = "Hello ";
String two = "World!";
String three = " Dilbert";

public String doSomething()
{
  String one = (String)one + (String)three + (String)two;
}

Specifically they cast EVERYTHING whether it needs it or not.

TheresaJayne
Jul 1, 2011
I dont get the pragmatic programmer link....

I get defensive coding but doing something like

code:
Player player = (Player)(new Player());
is just insane.

TheresaJayne
Jul 1, 2011

Ithaqua posted:

Seriously. There's almost never a reason for a developer to be poking around in a live production server, and there's absolutely never a legitimate reason for a change to be on a production box but not in source control.

I worked for a payroll company and was on the Tiger Team, our job was to tweak stuff directly on Production to get it running again then work out what was causing it to be wrong and passing that to the dev team as a defect report.

I was one of 6 people with access to production the 4 of the tiger team and the 2 DBAs

TheresaJayne
Jul 1, 2011

Yeah they had heard about computer teams called Tiger Teams in computing and called us that erroneously.

Where the real meaning of Tiger Team was a team of people who's job was to hack into the system and show where vunerabilities were

TheresaJayne
Jul 1, 2011

shrughes posted:

How many of your regexes can recognize the following phone number?

code:
same
Guess what folks, sometimes you've just got to validate phone numbers, and also email addresses, and regexes are a great way to do that.

Phone numbering systems change.

For instance it used to be something like
High Wycombe 4882

Then
0494 4882

Then they changed it to

0494 724882

Then

01494 724882

and they now are talking about changing it to something like

020 494 724882

now what next.....
1100 1001 :)

TheresaJayne
Jul 1, 2011
Address validation is even worse,

I had to enter a town name into an online form

I tried to enter the Town Name : Münster

Invalid Address : Can only contain Alpha Characters

I cant Put Munster as that is a different town in a different Country....

FAIL......

TheresaJayne
Jul 1, 2011

Paul MaudDib posted:

Yeah, the standard way to transliterate umlauts into alpha characters is to follow the umlaut'ed character with an e, so Münster becomes Muenster. The postal service will figure it out from there.

See also, the ess-tset, which is transliterated as "ss". So "Fuß" becomes "Fuss".

Really the problem isn't the transliteration though, it's the fact that the software is requiring validated addresses. I've run into that sometimes with cities and zip codes, places like universities tend to have their own mail systems with their own zip coding or +4 coding and those tend not to be in the databases used to validate addresses. It's gotten better over the years, most electronic addressing systems will now try to auto-correct the address to the closest thing it can validate but also let you override it and put in a different address if you're really sure.

Can i also point out that the Postcode lookup didn't. Entering a valid postocde always returned 0 results

TheresaJayne
Jul 1, 2011

necrotic posted:

We had one guy come in and say "I'm not writing any code, you have my resume" after we asked him to write a basic algorithm (flatten an array or something similar).

I must agree though its annoying, They have seen your resume and all the companies you have worked for as a developer (about 10 in my case) and they have verification of your Oracle OCA SE7 certificate and they still want to see you write "FIZZ BUZZ" in a TDD way.

and then make you work a 9 month probation because "Thats what probation is for... To see if you can actually do the job"

<rant> SO WHY DID I HAVE TO PROVE I COULD DO THE JOB IN THE FIRST PLACE.... </rant>

TheresaJayne
Jul 1, 2011

ultramiraculous posted:

Have you never encountered or heard about a hire that ended up being totally unqualified? There are people who can fart their way through school and years of work and come out with a 3.5+ GPA and a nice looking resume, while not being able to code/problem solve their way out of a paper bag. Coding interviews are a sanity check on your credentials, along with probationary periods (though 9 months sounds excessive?).

The company had a large Call Center operation and everyone in the company was subject to the 9 month ruling.

I personally also had a 3 month probation as well because i hadnt been doing .NET for a bit.
(I passed that at the end of Month 1 because it was obvious i could do the job. )

Unfortunately I went on holiday for a week and when i came back the Lead Dev had quit, the Senior Dev also had quit, and 3 of the other devs had quit, and the Dev Manager was leaving....

I was not allowed into the office and just taken to an external area and given all my stuff and told - you don't have a job here bye.

TheresaJayne
Jul 1, 2011
I think this argument for/against PHP is futile.

PHP is provided with apache webserver as default. (LAMP/XAMP etc)

To add Tomcat/another language you usually have to download and install said language/tool

PHP has a foothold much like Windows has.

The first web language most newbies will touch therefore will be php.

Knowing that. Is it such a bad thing? those who know better will not use it. Let the newbies use it until they realise that it is not as good as they thought - but by then they have the knowledge to know what is a better language.

For instance at college i learnt a "4GL" (basically DB front end where it automatically created the forms)

Ruby on Rails struck me as just being a Web based version of that.

TheresaJayne
Jul 1, 2011
I concur, I find even now looking at code from my last job I cringe when i see some of the stuff that was done.

although there are nice things as well. but when a complex system is made by a team of 8 contractors you know you are going to have problems...

Note: I was not a contractor I was in the after spaghetti time, but there were whole areas that no body else would even look at.

Such as Video Capturing on a website using a 3rd party video tool and linking it into an oracle database using ajax....

TheresaJayne
Jul 1, 2011

Literally Elvis posted:

crosspost from the noob jobs thread:
The Fizz Buzz from Outer Space

I read the comments, I loved this one - reminds me of previous roles....

quote:

FizzBuzzFactoryBeanFactoryBeanManagerBeanFactoryBeanBeanFactory

TheresaJayne
Jul 1, 2011

coffeetable posted:

A few months back Obsidian Entertainment (a games company with a reputation for buggy games) released the beta for their next game. I decompiled it and discovered this monstrosity of a class:

SNIP...

Calling an Obsidian programmer out on this over on another forum, I got


So, my question: is there any way to succinctly explain why this thing is a travesty? I tried writing something up but Christ if I've got to explain why single responsibility and encapsulation are good ideas, I'm not sure there's any hope.

Throw them a link to Clean Code by Uncle Bob - that might be helpful, or why not a link to SOLID
S ingle Responsibility Principle
O pen Close Principle
L iskov Substitution Principle
I nterface Segregation Principle
D ependency Injection

Adbot
ADBOT LOVES YOU

TheresaJayne
Jul 1, 2011

Contra Duck posted:

Yeah I has a manager once who wanted to know how many lines of code were written for a project. I gave him a big number that included all the changes in config files and other non-code things and he was happy.

We have the opposite issue, we can only change 10% of the codebase for each release which means we see many examples of laughable code and spelling mistakes (such as recieve instead of receive in method names) but as we can only change 10% and any change has to be 80% minimum coverage of unit tests we have to grit our teeth and ignore them as in most cases 90% of the code has no coverage yet at all....

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