People are Bad at Owning Houses
I live in an old house. It was built some time in the 1910s. I like the charm and character of old houses. They have details and accents you won't find anywhere else. The owners, though, I'd like to smack them upside the head.
Today, I replaced two lights. One was an old boob light that I replaced with a rather nice-looking pendant lamp. The other was in the same stair well area that was a fixture with a bare bulb. I replaced it with a matching pendant, but a much smaller one. They look pretty nice, but when they were first put in, they were done incorrectly.
In one of these cases, it makes sense that it was wrong. The fixture looks like it was installed many decades ago, and was probably done before electrical boxes came in standard sizes. The same is true of two ceiling fixtures that I'll need to replace in two bedrooms so that I can install a ceiling fan. But the entry way light has no excuse. It was built to use a standard round ceiling electrical box. It's just that someone was too lazy to do it right.
Now, if you connect the wires correctly, it should be fine. The trick though, is that previous owners don't always connect the wires correctly. I've seen a lot of electrical tape in places where none should ever have been used. In fact, here's a tip. Don't connect wires with electrical tape. Not as a permanent solution, at least. Use a wire nut. A correctly sized and installed wire nut is secure and safe from fire hazards. While we're at it, don't add electrical tape to the wire nut to "secure" it further. That won't help. The wire nut is more secure than the electrical tape. Electrical tape is for insulation and color coding wires.
Now, what did I do in my situation? I was lazy and did not install a ceiling box. I just installed the light. In my defense, I'm adding it to my list of things to work on when I replace the main floor living room lights. It too was installed without an electrical box, and I'll need to put one in for the new lamp we will be buying.
Now, for an old house like this you have two ways of installing a ceiling box. If you have attic access, you can carve out a four inch hole and then mount the brace and box from above. For the two upstairs rooms where I need to install ceiling fans, I'll probably do this since there's a lot of powered insulation up their that will make a mess if I don't clear it out first.
In the case where you don't have attic access, like when I install the boxes on the first floor, there's an alternative old work ceiling box you can use. It's designed to be installed entirely through the four inch hole you create for the ceiling box itself. It uses a telescoping support bar that you can twist to put pressure into the joists. It holds secure using metal teeth on either end of the brace. Afterwards you place a clip on the brace that attaches to the ceiling box.
It'll be extra fun in my house becuase most of the ceilings are lath and plaster. I'll be cutting into a lot of wood (the lath), and I'll need to be careful not to crack the plaster in the process. It's a pain to repair, and will be even more of a pain when I install a box in the dining room where wall paper was placed to make it look like a tin ceiling. The work will be worth it though so that if I ever need to replace any fixture. It becomes the simple task of using standard screw holes instead of having to drill new ones each time.