Hot answers tagged

151

Imagine you have to use someone else's code that is designed as shown below: class Messy { String concat(String param, String str) { /* ... */ } boolean contains(String param, String s) { /* ... */ } boolean isEmpty(String param) { /* ... */ } boolean matches(String param, String regex) { /* ... */ } boolean ...


79

I used to work for a company where every app we gave them led to the question: Can we export this data to Excel? After a while, I decided I had to know why they were obsessed with Excel exports for everything. It turned out that a lot of departments had one person who was an expert in Excel and could write a useful data-analysis app in no time. These apps ...


69

Do dedicated maintenance programming roles end up being detrimental to an early career? Are other programmers right to avoid roles like these? Does doing this line of work lock you into doing similar tasks unless you're prepared to start over as a junior? First up, you should know that you're considered a junior for quite a while. You may get arbitrary ...


50

I think people are missing the general point here: If you don't like all the custom development that's going on, forbidding it is solving the wrong problem - you should instead be asking why they're going around IT, not just telling them it's not allowed. Remember that you (IT) exist to help them do their job better, and that people don't use ...


46

To quote another source: Create an isolating layer to provide clients with functionality in terms of their own domain model. The layer talks to the other system through its existing interface, requiring little or no modification to the other system. Internally, the layer translates in both directions as necessary between the two models. Eric ...


33

Adapter When you have incompatible interfaces, that perform similar logic, to adapt one into the other, so that you can use implementations of one with things that expect the other. Example: You have an object that wants a Car, but you only have a 4WheelVehicle class, so you create a CarBuiltUsing4WheelVehicle and use that as your Car. Facade When you ...


31

If you want to keep the data, then it's not obsolete. Just leave it where it is. It's fine if some class mapped to a table doesn't map every column.


26

all I hear about is how they are using the latest ASP MVC framework, or Vagrant/Ruby on Rails/etc and I am getting the green eyes! Ah, but there they are playing with their toys, and there's you doing real work, using a tool that does the job to achieve a solution. That's what you should be considering - software is too often an amateur affair with ...


25

The critique about Poor Man's Injection in NerdDinner has less to do with whether or not you use a DI Container than it does about setting up your classes correctly. In the article, they state that public class SearchController : Controller { IDinnerRepository dinnerRepository; public SearchController() : this(new DinnerRepository()) { } ...


21

There are, indeed, several benefits for a company to stick with outdated technologies: Legacy stuff sometimes doesn't work with new stuff A company may have invested a large amount of money in systems which simply don't work with newer languages or operating systems. A classical example is many intranet web apps which are compatible with IE6, and IE6 only. ...


21

Programmers aren't the limiting resource. Learning a new language is easy compared to all the domain and program-specific stuff you have to learn when starting at a new company, and people move to new companies all the time. You're talking a language with 300 keywords versus a program with hundreds of thousands of functions. It's not even close. Hardware ...


17

What I would do is first disable the tests which are failing-and-have-always-failed. Make it so a test failing matters. As you investigate you might be able to ask people who have been with your company longer about them, there might be a lot of tribal knowledge about them which you can document/capture. Maybe from your VCS logs. "Oh, that test has always ...


16

One should also consider the case of the companies in which IT department contains incompetent people, while the hidden app would be created by a skillful developer who has a non-developer job within the company. In my experience, those cases are extremely frequent. Imagine that you have a double profile of a software developer and an accountant. You're ...


16

A lot of answers here say that ACLs are "not just" about wrapping messy code. I'd go further and say they are not about that at all, and if they do then that is a side benefit. An anti-corruption layer is about mapping one domain onto another so that services that use second domain do not have to be "corrupted" by concepts from the first. ACLs are to domain ...


16

You make a false assumption here over what "poor man's DI" is. Creating a class that has a "shortcut" constructor that still creates coupling is not poor man's DI. Not using a container, and creating all injections and mappings manually, is poor man's DI. The term "poor man's DI" sounds like a bad thing to do. For that reason, the term "pure DI" is ...


15

Funny you should ask that. My father is a COBOL programmer. Graduated from college, got a job at a large insurance firm. Worked on the same app for his entire career (the same physical mainframe for 30 odd years of that). Spent the last 4 years remotely teaching a team of new graduates in India how to write COBOL. He retired last year. I wouldn't count ...


14

I think warnings, which are not treated as errors, are useless. You get tons of them, therefore nobody bothers to look at them, and they miss their purpose. My suggestion is to fix them all, and start treating them as errors. Fixing them looks scary, but I think it can be done. A good programmer that would pick up this work will very soon figure out the way ...


12

You have hit the nail on the head - What you have complained about is the definition of "Legacy software". Working on this class of software requires a different mindset to Green-fields work. Your stress is a result of you measuring your progress against unrealistic measures. Don't try to put todays ideology on yesterdays work. If it was not designed ...


12

OK in all seriousness, this code has worked for 30 years. It will work for 30 more. You could spend your life 'modernising' it and only add bugs. Start walling bits off and componentising so you can write the new bits the way you want. Concentrate on measurable improvements in performance, fixing bugs and new features. Gradually improve the code as you ...


11

Yes, there are definitely situations where it makes sense to create some down and dirty "throwaway" code with the intent of tossing it after a couple years and starting over. Perhaps your company is trying to quickly prove out a new business model and want to get a sense of the market reaction to a "test product". Perhaps there is an untapped market and ...


11

It may seem that "there ought to be a business model for an IT support firm that concentrates on legacy platforms like this", but personally I think that is just wishful thinking on your part as it would "solve" the challenges you face in one fell swoop. Staying stuck in old environments is not the way to go forward. And I for one wouldn't bet the life of ...


11

This is an example of a facade pattern, which may provide some starting points for your research. I've also seen it called an anti-corruption layer. Basically, you create your dream API, the one you would create if starting from scratch today, but implement it by making calls to the current horrible back end. Then you can slowly move calling code to your ...


11

TDD does not really apply to maintenance. Instead, Test Driven Development is an iterative model that focusses on the development or implementation phase. Normally, the software life cycle would first produce designs, which are the implemented as code, which is then tested & released. TDD reorders these for each iteration: we write tests first, implement ...


10

What would help when refactoring a large method to ensure that I don't break anything? Short answer: small steps. The problem is that when I refactor a tiny part of a 500 LOC private method, adding unit tests appears to be a difficult task. Consider these steps: Move the implementation into a different (private) function and delegate the call. // old: ...


10

The problem you may quickly hit is that in order to test a particular piece of code, you should make testable the code surrounding it. Changing the surrounding code requires testing as well, which, in turn, requires even more changes. Practical example. A year ago, I had to work on a... let's call it legacy system. Millions of lines of C# code. ...


10

To a first approximation, the stakeholders of a test suite are the code developers/maintainers. You're going to need some of their time. Insist on this. Ask them about problems they're facing. Ask them about bugs they've fixed recently (in the past couple of years, assuming this is a long slow project). I get the impression that you're not expecting them ...


9

These are the reasons that I remember were given for not making UTF-8 or another Unicode representation the default character encoding for the scripting language Ruby, which is mainly developed in Japan: Reason 1: Han unification. The character sets (not sure if "alphabets" would be correct here) used China, Korea, and Japan are all related, have evolved ...


Only top voted, non community-wiki answers of a minimum length are eligible