Ifyou take over a project from someone to do simple updates do you follow their naming convention? I just received a project where the previous programmer used Hungarian Notation everywhere. Our core product has a naming standard, but we've had a lot of people do custom reporting over the years and do whatever they felt like.
I agree suggest that leaving the code as the author wrote it is fine as long as that code is internally consistent. If the code is difficult to follow because of inconsistency, you have a responsibility to the future maintainer (probably you) to make it clearer.
If you spend 40 hours figuring out what a function does because it uses poorly named variables, etc., you should refactor/rename for clarity/add commentary/do whatever is appropriate for the situation.
That said, if the only issue is that the mostly consistent style that the author used is different from the company standard or what you're used to, I think you're wasting your time renaming everything. Also, you may loose a source of expertise if the original author is still available for questions because he won't recognize the code anymore.
If you're not changing all the existing code to your standard, then I'd say stick with the original conventions as long as you're changing those files. Mixing two styles of code in the same file is destroying any benefit that a consistent code style would have, and the next guy would have to constantly ask himself "who wrote this function, what's it going to be called - FooBar() or fooBar()?"
This kind of thing gets even trickier when you're importing 3rd party libraries - you don't want to rewrite them, but their code style might not match yours. So in the end, you'll end up with several different naming conventions, and it's best to draw clear lines between "our code" and "their code".
If you are maintaining code that others wrote and that other people are going to maintain after you, you owe it to everybody involved not to make gratuitous changes. When they go into the source code control system to see what you changed, they should see what was necessary to fix the problem you were working on, and not a million diffs because you did a bunch of global searches and replaces or reformatted the code to fit your favourite brace matching convention.
When a good programmer's reading code, he should be able to parse the variable names and keep track of several in his head -- as long as their consistent, at least within the source file. But if you break that consistency, it will likely force the programmer reading the code to suffer some cognitive dissonance, which would then make it a bit harder to keep track of. It's not a killer -- good programmers will get through it, but they'll curse your name and probably post you on TheDailyWTF.
I certainly would continue to use the same naming convention, as it'll keep the code consistent (even if it is consistently ugly) and more readable than mixing variable naming conventions. Human brains seem to be rather good at pattern recognition and you don't really want to throw the brain a curveball by gratuitously breaking said pattern.
If the file or project is already written using a consistent style then you should try to follow that style, even if it conflicts/contradicts your existing style. One of the main goals of a code style is consistency, so if you introduce a different style in to code that is already consistent (within itself) you loose that consistency.
If the code is poorly written and requires some level of cleanup in order to understand it then cleaning up the style becomes a more relevant option, but you should only do so if absolutely necessary (especially if there are no unit tests) as you run the possiblity of introducing unexpected breaking changes.
Absolutely, yes. The one case where I don't believe it's preferable to follow the original programmer's naming convention is when the original programmer (or subsequent devs who've modified the code since then) failed to follow any consistent naming convention.
Existing code supersedes all other standards and practices (whether they are industry-wide standards or those found in this document). In most cases, you should chameleon your code to match the existing code in the same files, for two reasons:
Personally whenever I take over a project that has a different variable naming scheme I tend to keep the same scheme that was being used by the previous programmer. The only thing I do different is for any new variables I add, I put an underscore before the variable name. This way I can quickly see my variables and my code without having to go into the source history and comparing versions. But when it comes to me inheriting simply unreadable code or comments I will usually go through them and clean them up as best I can without re-writing the whole thing (It has come to that). Organization is key to having extensible code!
Yes.. There is litte that's more frustrating then walking into an application that has two drasticly different styles. One project I reciently worked on had two different ways of manipulating files, two different ways to implement screens, two different fundimental structures. The second coder even went so far as to make the new features part of a dll that gets called from the main code. Maintence was nightmarish and I had to learn both paradigms and hope when I was in one section I was working with the right one.
If the code already has a consistent style, including naming, I try to follow it. If previous programmers were not consistent, then I feel free to apply the company standard, or my personal standards if there is not any company standard.
Unfortunately, most of the time the answer is yes. Most of the time, the code does not follow good conventions so it's hard to follow the precedent. But for readability, it's sometimes necessary to go with the flow.
However, if it's a small enough of an application that I can refactor a lot of the existing code to "smell" better, then I'll do so. Or, if this is part of a larger re-write, I'll also begin coding with the current coding standards. But this is not usually the case.
If there's a standard in the existing app, I think it's best to follow it. If there is no standard (tabs and spaces mixed, braces everywhere... oh the horror), then I do what I feel is best and generally run the existing code through a formatting tool (like Vim). I'll always keep the capitalization style, etc of the existing code if there is a coherent style.
My one exception to this rule is that I will not use hungarian notation unless someone has a gun to my head. I won't take the time to rename existing stuff, but anything I add new isn't going to have any hungarian warts on it.
Original programming (also called originals or original programs, and subcategorized as "original series", "original movies", "original documentaries" and "original specials") is a term used for in-house television, film or web series productions to which the exclusive domestic and, if the originating service operates non-domestic versions of the service outside of their home country, international broadcast rights are held by traditional and over-the-top content providers. The term was coined by HBO in 1983 when the premium service began producing its slate of in-house series and film productions. HBO initially branded the original series on the network under "HBOriginal" until 1986, and by 1993, the "originals" term had expanded to encompass most of its original productions. The term eventually expanded into use by various cable-originated television networks (including, among others, Disney Channel, TNT and USA Network) to identify their in-house productions. It also advertises them as being distinct from the acquired content offered to fill out the remainder of their programming schedule.
LinkedIn and 3rd parties use essential and non-essential cookies to provide, secure, analyze and improve our Services, and to show you relevant ads (including professional and job ads) on and off LinkedIn. Learn more in our Cookie Policy.
For Christmas I was given Walter Isaacson's The Innovators and I excitedly read it all. Lovelace, Babbage, Turing, Jobs, Andreesson, Gates all familiar names to me and beautifully tied together by Isaacson.
I nearly fell off the chair when I realised the original programmers of the first general-purpose electronic digital computer were women. I did fall off the chair when I realised that one was Irish and a Gaeilgeoir. Further investigation revealed we shared a birthday - and I was truly done for.
Kay McNulty, emigrated to the US with her parents and thanks to her love of Maths and the war became part of the sisterhood of programmers that were tasked with figuring out the ENIAC (Electronic Numerical Integrator And Computer), the first electronic general-purpose computer.
Six intelligent women were hired during the war and programmed the first all-electronic, programmable computer, the ENIAC. As with the Turing story this was a top secret WW2 project run by the U.S. Army in Philadelphia. No programming languages or tools existing. Their collaboration enabled ENIAC to create in seconds a set of missile trajectory calculations that would take weeks for humans. When all was revealed to the public in 1946 there was no mention of Frances Bilas, Marlyn Wescoff, Ruth Lichterman, Betty Jean Jennings, Betty Holberton
and Kay McNulty.
So this is my International Women's Day Tribute to a brilliant woman, an Irish woman and a woman who unknowingly (to us both) helped to forge my interest in computers, technology and pique my curiosity about the world.
Hi everyone i bought bluepill with fake chip and i replaced it with an original stm32f103c8t6.
When i use stlink utility with other fake bluepill it detecets the chip but when i use stlink utility with original chip in a fake bluepill board i get this error.
3a8082e126