HNHacker News
TopNewBestAskShowJobs

thepp1983

70 karma · joined November 9, 2018

submissionscomments
thepp1983··on Ask HN: What's the largest amount of bad code you have ever seen work?
To even write unit tests effectively you need to write your code in a certain differently.

In C# this normally means using IOC + DI.

Also almost nobody I know does proper TDD. I know it is very convincing when one of the TDD evangelists shows you how to write something like a method to work out the nth number in a fibonacci sequence using nothing but just writing tests.

In reality most 95% of developers that even write tests write the logic and write the test afterwards to check the logic does what it should.

thepp1983··on Ask HN: What's the largest amount of bad code you have ever seen work?
Knowing when something isn't right is easier to knowing how to do it right. So I would be wary as to saying it is a lack of skill by your co-workers.

e.g.

I had to write a bespoke popup window launcher for a large gambling company in the UK. The games were mainly the awful slots games that you see in motorway service stations. These are basically one arm bandits on steroids.

There is a lot of logic that was in JavaScript that should have been in C# and I had to design it correctly to work with a third party Proprietary CMS system and I had to manage session tokens on 3 to 4 third party systems. Not easy.

It took me about 2 weeks of just reading the code and absorbing it, drawing lots of diagrams of how data flowed through the system and then porting that logic over to C# in a way that would work with the CMS system in a logical and OOP fashion and handling auth tokens effectively.

thepp1983··on Ask HN: What's the largest amount of bad code you have ever seen work?
In reality there often isn't time.

Getting it done > Getting it done properly as far a management is concerned.

thepp1983··on Ask HN: What's the largest amount of bad code you have ever seen work?
I've worked on a CMS that was partially done in .NET, Iron Python and used an XSLT templating system to generate HTML for the front end.

The architecture looked like something from the Early Java days.

The system used Iron Python / C# in the following way.

1. A web request would hit the CMS 2. There was a massive switch statement to work out how the query would be rewritten 3. If it the url was prefixed with processor it would attempt to find the processor in the db. 4. The code would then find the python script associated with the processor. 5. The processor would then spin up a command line instance in a hidden command window on windows server. 6. The processor would have to return XML that had to be built up using strings (not element tree for you). 7. This would return the XML to the C# which would then try to render into the XSL Transform.

If at any time this failed. Silent failure. There was no way to debug easily (There was a magic set of flags that had to be set in Visual Studio or wise you couldn't debug the python scripts).

To get the software to build on a new machine. It took a contract 4 months to reverse engineer an XP machine. None of it was documented anywhere.

It used ImageMagick to generate thumbnails on the fly which doesn't work to well with windows server.

The lead engineer was an alcoholic. He used to go to the local pub for 4 hours in the middle of the day and come back smelling like a brewery.

thepp1983··on What Makes .NET Core So Special?
Because it is cross platform and isn't really used cross platform it is a pain in the arse.

SQL Aliases don't work. So people have to put in registry hacks into C# code (YAY back to 2002).

Loads of missing functionality (e.g. GeneratePassword is missing in aspnet core).

It is just incomplete. .NET 1.0 was more together than ASP.NET core and that was in 2002.

We've lost loads of functionality in the spurious benefit of it running on multiple platforms. I was developing ASP.NET on Linux 5 years ago.

It is more churn and burn for the small amount of devs that use dotnet without Windows.

thepp1983··on What Makes .NET Core So Special?
> This is why I cringe at fanboyism. Whether it is F#, Ruby, Rust, etc. People get so irrational and consume by zealotry.

Amen brother.

thepp1983··on What Makes .NET Core So Special?
It isn't a proprietary language. Anyone can implement the language spec.

Do you people do any basic research, you know just googling or reading the license?

thepp1983··on What Makes .NET Core So Special?
TBH I worked in high stress environments (gambling and finance). Management didn't care that I would work to 7-8pm most evenings (9pm start) and do a few all nighters. A few times I was like 30 minutes late twice in a row I would get called in for a talk about "tardiness". I was younger at the time and I thought they would cut me a bit of slack after delivering the impossible on time!!

After a while you realise that it isn't worth the effort and just get a contract job where you earn twice as much and have none of the bullshit.

thepp1983··on What Makes .NET Core So Special?
> I've worked in a variety of shops, both "Microsoft" shops and non-Microsoft shops, and I would most certainly agree with the GP That Microsoft shops tend to be dominated by developers who like the comfort of just eating whatever pablum Microsoft is serving, often even if that pablum will take years longer to digest than competitive alternatives. There is, in general, a tunnel vision that profoundly limits the options available to build solutions, at substantial project cost.

I dunno about this. The vast majority of costs in any project is contractors / staff rather than licenses.

I added up the cost of hiring 3 contractors for a month versus just buying a piece of software that did 90% of what the business needed. We were much more expensive.

> And it's understandable. If you're at a Microsoft shop you aren't going to challenge the norm if your first choice is SQL Server and BizTalk and Azure, etc. It's the easy, laziest option. Occasionally it might be the best option, but that's just accidental given that the choice was predetermined.

It is also kinda counter-productive for everyone else. If everyone knows how to do something in a particular language + IDE it makes things easy because knowledge can be shared without a steep learning curve.

e.g. I write lots of scripts using python, I mainly work in .NET shops.

I left instructions for the whole process on how to get the script to run for an adhoc support job I wrote 5 or 6 years ago. For whatever reason it broke (the db structure changed slightly). I have been in a lot of contracts since that job and it was just cheaper for them to call me up and pay me to fix the script than have one of their devs look at it.

The only reason I wrote it in python at the time was because I didn't know Powershell at the time and they said I could use what I wanted as long as it was documented.

thepp1983··on What Makes .NET Core So Special?
> The average .NET developer never even tries different things like AWS or the Google Cloud, TravisCI or AppVeyor, etc. They just swallow anything which so-called MVPs and conference presenters force them down the throat, primarily Azure which is by all measures inferior to the other two and they don't even know.

I've made an account because this attitude irritates me.

1. This is patently untrue. The real reason is that a large number of developers simply have more important things to do (friends / family / children etc) than learning whatever is considered in fashion. Scott Hanselman even has a name for these developers "Dark Matter Developers".

https://www.hanselman.com/blog/DarkMatterDevelopersTheUnseen...

If you have 10 years of experience working with .NET and all the parts that normally come with it, it makes more sense to keep within the ecosystem and keep up with the changes in the tooling if you want to stay up to date. There isn't much benefit for most people to look outside of it.

I've personally got sick of things changing every 3 months and build almost everything exclusively using full fat .NET because I know it isn't going to be gutted and changed in 6 months time unlike .NET core. It has also 16 years worth of development and documentation behind it. I don't need to spend half a day trawling through stack overflow posts.

2. Most software that is built in .NET is intranet software that will never be seen by the public. It is most likely hosted in a server rack in the basement. Almost 90% of the problems when developing in these places is internal politics, poor IT infrastructure spending and abhorrent legacy code. I could probably list another hundred common problems.

> Visual Studio is littered with SQL server and Azure tools which doesn't even make sense. Either offer equal tools for all major tech or none, but this subconscious constant selling of their own tools sickens me slowly.

The whole point of VS is that you shouldn't have to go outside of the IDE very often. Thus why wouldn't Microsoft offer tight integration. If you don't want to see the tooling, remove it from your VS installation or use one of the many alternatives now (Rider, VS Code or setup your editor with Omnisharp).

← PreviousPage 2 of 2