Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Is there anyone waiting for the code?
Do it fast and dirty. Functional, but ugly. While it's used, you can write a new version without impacting others work.
Else, go as clean as possible. You never know who might work on it later. o/ -
devTea219176y@DarkMelchiah @monzrmango sometimes I feel bad, and my ocd just force to write it clean from the start until I’m really depressed or desperate
-
Condor323366yUsually I write stuff dirty first, then take a couple nights of sleep to cultivate how else I could write it, and then end up writing its refactored version 🙂
-
devTea219176y@Condor I mean sometimes when I write I know this is a wrong way to do it, but it worked. So I always stuck at it doing the right way instead of leaving it and come back later
-
@devTea I feel you. But it's something that you "develop" with time. You don't have to keep writing ugly code and stuff... It's just a resource you have when there's little time to deliver the MVP.
-
Condor323366y@devTea ah, I see now. Well my stuff usually works and as far as I can tell I don't have any users and certainly not deadlines, so that could be the cause why my workflow is different from yours. Perhaps it's ignorance, perhaps it's lack of deadlines, laziness, or no financial incentive to work on it as much as I would if I were to get paid for it. Perhaps it's a bit of all that.
If I were to make a professional product, I wouldn't release it until it's fully functional and clean though. Often times that means multiple iterations of the product and a long time of being a work in progress before I call it in any way stable.
I would hate to sell a product to anyone if I know that it wouldn't be good. -
@Condor That's actually a good point. - Most of times my work is not related to coding (which is weird, considering that I'm a CompSci guy), but to network log analysis. So when I'm actually writing code, it's for some automation tool to be used by another dev to help with some tasks - As it's something that won't actually go out of our technical group, making it beautiful usually is not a necessity - even tho we go through our code from time to time to reorganize it (I forgot the correct word to use here...).
-
I spend a bit of time thinking before coding. Clean it up as much as I can in my head then code. Once it's in the editor try to keep it clean as I go. Like a master chef will tell you "Mise en place".
Code under construction is naturally going to be messier than the end product but it's easier to work on if you clean as you go along. -
Maartz22876yWrite function, write test, pass test, rewrite function properly, test again to see if nothing’s broken, next step ;)
-
I try to make it clean from the start but always go back and clean it again after I'm done, never got it all clean from the first shot lol
-
devTea219176y
-
Maartz22876y@devTea I’ve to admit that it’s really difficult to not write down directly what’s in my head.
You shouldn’t feel bad ;)
Have you tried TDD ? -
@devTea its not only you, I too face this problem, but I try to create lots of tiny projects that cover one idea, for example how to structure my data layer, when I'm done with that I use my findings in a production project, so that I can see what is wrong with what I did, then go back and fix again ...etc. That's how I sort of teach my self to better code
-
@devTea My day is like 70% thinking and 30% actually putting code down but that brings my over all productivity way up because I'm not spending time writing and deleting code for the sake of seeing if it will work as expected.
It is a challenge though to not end up in analysis paralysis. -
It may be due to the fact that I do not program professionally yet (no deadlines :P), but I generally lay out good quality code straight away :) Feels much better imho
-
musician6656yMake it work - then make it pretty.
Of course dont write shit code but you wont see the ideal solution (implying there is one) until you got it working most of the times. Also good IDEs help alot with refactoring -
devTea219176y@Biggy what? lol
@karma how I feel when getting out of bed on monday morning
Well After hearing these from you guys maybe I shouldn’t worry too much, thanks -
arfro22506yI usually go with iterations. Hack a function together, write tests, pass tests, tweak the function so it looks nice, pass tests and repeat for another component. I like quick results. And when it works, beautifying / optimizing it is usually pleasant 😁
-
Agred20226yI think that there's always room for improvement. Write code as good as you can given time constraints and abilities and go back to it after a while to make it gorgeous 😍
-
rant1ng44626ylet s = speed of development ( or hours spent coding)
let m = ease of maintenance
m/s
rating scores of 1 .. 10
s = 1, means took forever
m = 1, means hard to maintain
and so on
in the beginning, all code is
1/10
Right? cuz you'd want to write it quick, but you know it'll be hard to maintain.
Just write naturally, whatever comes to mind, don't stress yourself, don't edit yourself, just make it work as best you know how.
Once it's working, I take a break. But more importantly I accept it. When coming back to it the first time, I might end up with 3/8
Then second session, 4/7 and so on.
Repeat that until I'm happy with the code/functionality. Might end up with 7/4
Sometimes it'll take a week to implement a major feature, but I had it working within 2 days.
It will never be 10/1, and that's ok. And it'll never start off at 3/7 thats ok too.
I think this made sense... lol just came up with it, tell me if errors please, going in book -
rant1ng44626ycontinuing ...
So, sometimes, on my way to doing a task, and as part of it, I encounter some methods/classes that need refactoring, I might take that time to improve some or all of them, while I'm doing the new task, if I can
so in that way, I'm always coding new stuff, but drying up older stuff as I go along
kind of like making sure the room isn't too dirty, sometimes it gets dirty and I spend a whole day cleaning it up, but I try to keep it clean as I go and accept that it'll never be tooclean, unless I want to wear rubber gloves and never go outside... then I'd be ocd
same with code
hope this sorta helps? -
devTea219176y@rant1ng thanks it’s just sometimes my own self forbids to go further unless this is done correctly. Which kinda tearing my own self apart honestly
-
rant1ng44626y@devTea depends what your higher goal is
what do you value most?
the idea that you have the perfect code,
(for whatever other emotinal/psychological reasons that sub-processes off to)
or
to get the task done for the endgoal of whatever that is, make boss happy, or client, if the latter, what does the client really want
etc
try to distill and examine your thinking that might cause anxiety/obsession etc and you'll usually find there's some irrationality in there
try journaling , answer: "why am I obsessed with writing perfect code, why do I use this to beat up on myself, etc"
I've gotten over so many things like this, just by writing down my thought process, once I write it down, there's usually some really weird shit in there and it's like "ok, next time I think this, i'm not going to think that, instead I'll think this" and then, just practice that until I don't think the weird shit anymore
sorry if getting personal, just, I can recognize your problem... -
When I was totally new to coding the stuff I wrote (or at least tried to write) looked like a necromancers hotpot. Something acid from hell met a virgins blood. It worked somehow, but after I encountered my first programming classes I feel slightly embarrassed looking at my first tries. ^^
-
Start clean, get messy, clean it, get messy... shit infinite loop irl, how to debug? 😂
-
Usually, I start clean to get something working at all. At work, I leave it at that state and start documenting. Maintainability is more important than performance.
With my private stuff, that's where speed profiling starts, and the code gets ugly. Global variables accessed from deep inside the call tree, goto via array index (computed goto), cramming together unrelated variables in bit patterns. Sometimes, I have to read the disassembly to be sure the compiler does what I want. It's as dirty as C can get, but that's the fun part. -
cursee165986yLinter with Auto format.
So can say I write it clean from the start.
I think we are talking about the appearances of the code rather than logic 🤫
Ugly hacking duck tape shit is everywhere and I don't think I'll ever clean them in this life 🤫
Just finished all the form function, time to clean up I guess.
Did you guys like to write it clean from start or do it later at the end?
random
code cleanup