DEV Community

Discussion on: All CSS Properties You Need to Know to Build a Website

Collapse
 
imiahazel profile image
Imia Hazel

Thanks. Trying to explore, explore and explore..
Things are changing at very fast pace. It seems we need to refactor the code after some time :)

Thread Thread
 
domagojvidovic profile image
Domagoj Vidovic

For sure, especially in the beginning.

If your code still looks fine to you after a few months or a year, that means you didn’t grow fast enough!

Thread Thread
 
imiahazel profile image
Imia Hazel

Agree.

Thread Thread
 
riobrewster profile image
RioBrewster

Absolutely NOT TRUE. If you look at your code after a few months or year and it still looks fine, that means you wrote elegant code the first time.

Thread Thread
 
imiahazel profile image
Imia Hazel

Agree in a a sense, that elegant codes have long life and we should pat on our back for writing such algorithms.

Disagree with respect, that we have to refactor such elegant codes if we found a better way to execute our logics.

Term refactoring, means we need to update our codes according to latest standards.

Good example of refactoring is CSS Vars.

Thread Thread
 
ashleyjsheridan profile image
Ashley Sheridan

I think it depends. You don't need to do any refactoring just to use the latest features if your website doesn't need that. The danger of using the cutting edge stuff is that sometimes it's not always the best approach. Just look at CSS Grid, I barely see that used any more, yet it was at the time thought to be the perfect solution to replace the various custom grid layouts across the many CSS frameworks.

Thread Thread
 
imiahazel profile image
Imia Hazel

Yes you have point. Refactoring requires a lot of head scratch to implement the new standards without breaking the functionality and UX. Caniuse is my best friend :)

Thread Thread
 
riobrewster profile image
RioBrewster

Besides - who has time to refactor old code? You should absolutely try to learn something new with each new project. But it's pretty rare to have to go back and rewrite working code.

Unless of course accessibility standards keep changing under your feet. But that's a rant for another post. ;^)

Thread Thread
 
ashleyjsheridan profile image
Ashley Sheridan

I agree you should try to learn something new as you progress from project to project, but there's absolutely a place for refactoring, unless everything you do is for throwaway short-term campaigns, but even then you should be looking into producing something that's a bit more flexible and reusable. I now work at a place where the code is long running, and constantly being refactored and added to over time, and building from scratch every time something new came out would be an impossible task. My last job was at a media agency, where most things existed for a few months at a time, but even there I could see the pattern of what was being produced and put together something that could be re-used for each new project. This itself was updated over time, and refactored to be better and offer more features as we needed them.

As for shifting accessibility standards, it doesn't happen ofter (we've had WCAG 2.1 for quite some time now) but WCAG 2.2 is round the corner (minor changes to what already existed, but 9 additional guidelines), and WCAG 3.0 is being worked on.