Thanks. Heard about Flutter, never actually seen it. If I had to write any, I’d look into writing it properly and having my code peer reviewed. But then, I’ve a few more than 3 years experience and I believe in learning every day. I might even watch a bunch of Fireship videos about it later.
I wish more people in this sub would explain their submissions and suggest how they’d approach it instead.
Flutter developer here. I think this is an auto generated code from Figma. In Figma there is a plugin that lets you export the design in a flutter widget and most of the time it's a widget made of Positions. I don't think he counted every pixel
3 years experience don't actually say much. 3 years experience in flutter? or just as developer. Sometimes I have to jump in to solve problems in applications I never touched before or very little experience on tech stack, the main goal is to solve the problem.
Don't know flutter but.... this is what I would do:
Use git blame, find who the developer is and asks questions about this code in a nice way and explain better options, he might not know better. (We don't know what we don't know)
Also a bigger problem I see here is not even the code, if it is so bad... How did it get passed a pull request?.
Pull requests are great if done it in the right way, a lot of knowledge can be passed on. I worked with Java for two years (2 years professionally, 5 years from university, games etc...) and started working as full-stack developer (totally different stack) on the beginning I was horrible even though I had 3 years experience, the difference was that I was horrible on that stack compared to how good I was with Java. Lucky me, I was working with people that focused more on quality than quantity.
Personally, I love finding this type of code on our systems (I see as a way to help someone grow, but it all depends on the culture of the company). Because I get the chance to test my teaching/communication skills and also learn more about how other developers think so we can grow together. There where times I found things like this, had a better solution and than while discussing with other developers found a even better solution than I had to start with.
I strongly recommend to not only fix the code, but discuss with the person that created it. Otherwise you will have to fix this type of errors again. If the person takes in the wrong way, he won't be a great programmer or evolve at all. What you think might be the best answer, there is someone out there that might have a better solution. Be humble.
Hey, thanks for sharing your opinion. I learned some things. I don't work in an organization. I am a freelancer right now (looking for a job though). The client hired a freelance developer who tricked the client and set the first milestone as completing the UI of the whole project. He did the UI milestone, took the money and said that he was busy with his job. So, he can't continue working on the project.
It looks like he took the code generated by a Figma plugin and just pasted it. Then, showed the client the result. The whole codebase is like this. Apparently, this guy works at a good company with high pay.
That is sad, people like this ruin the trust factor and make it harder for the rest of us in the long run. Even more sad is that a lot of big companies don't actually know what is going on in their repos or have tech leads that don't actually care about the quality of the code as long everything is working and they achieve their quarter goals.
It looks like not many people know flutter. So I will try to explain it in web terms. What the above code is doing is making a div of fixed height and width and then using absolute position to make three rows of text on each end.
Some of the text is not positioned in an exact row, though. I would guess there was some perceived need for absolute positioning to get the desired result.
Looks like only two parameters change. Can the static parameters be set as default eliminating the redundant definition of font size, font family, and font weight?
It's Okay. I am a freelancer right now and this is from one of my clients. There is also nothing confidential in the above picture. It's just dummy data. I have shown the code to my client and taken his permission to share it on other platforms. I am not stupid enough to share sensitive information on reddit. I have also removed all of the above code anyway and rewritten correct code.
What the above code in the picture is doing is making a div of fixed width and height and absolute positioning it's children to make three rows.
163
u/[deleted] Feb 04 '23
What even is this, and what would a good version look like?
123
u/MisterAntox Feb 04 '23 edited Feb 05 '23
Flutter developer here. I think this is an auto generated code from Figma. In Figma there is a plugin that lets you export the design in a flutter widget and most of the time it's a widget made of Positions. I don't think he counted every pixel
27
u/Ninh0w Feb 04 '23
3 years experience don't actually say much. 3 years experience in flutter? or just as developer. Sometimes I have to jump in to solve problems in applications I never touched before or very little experience on tech stack, the main goal is to solve the problem.
Don't know flutter but.... this is what I would do:
Have a nice weekend :)
25
u/frostyfauch Feb 04 '23
Looks like Flutter or some front end framework
2
u/Bhallu_ Feb 04 '23
It looks like not many people know flutter. So I will try to explain it in web terms. What the above code is doing is making a
divof fixed height and width and then usingabsolute positionto make three rows of text on each end.10
u/Beginning-Height7938 Feb 04 '23
Looks like only two parameters change. Can the static parameters be set as default eliminating the redundant definition of font size, font family, and font weight?
9
u/indefinitude Feb 04 '23
I’ve seen code like this written by people with 20 years of experience
8
u/haberdasher42 Feb 04 '23
When you get paid by the line of code.
1
u/jaysuchak33 ifelseifelseifelseifelseifelseifelseifelseifelseifelseifelse Feb 04 '23
What theme is this?
2
u/NetherFX Feb 04 '23
Well, yes, but depending on the context you might want to nest these instead of using rows
2
u/private256 Feb 04 '23
Sadly, a lot of people don’t care about quality code. They’re good to go so far it compiles with no errors.
2
u/[deleted] Feb 04 '23
3 years of experience is not much.
3
u/icoonh Feb 04 '23
This looks like a code generated from a visual builder.
Flutterflow or similar. Each row is probably "dragged" and positioned with absolute values by hand, instead of using actual related containers.
1
u/arthurb09 Feb 04 '23
Maybe use a function?
1
u/wick3dr0se Feb 04 '23
That's rough..
1
u/RootU5R Feb 04 '23
Not very readable and only minor changes. Looks bad to me
1
u/0xdef1 Feb 04 '23
If it’s 3 years of experience in general then it’s not much of an experience.
1
u/horreum_construere Feb 04 '23
3 years of experience of what?
1
u/radim11 Feb 04 '23
We all wrote shitty code sometimes, don't we? 🤔
1
u/[deleted] Feb 04 '23
Looks like a lack of mentorship above anything else ..
1
u/[deleted] Feb 04 '23
Bad implementation? maybe. But it's certainly NOT bad code.
1
u/Nyan-Catto Feb 05 '23
Dart? This is Dart, right?
1
u/LawtroStudios Feb 05 '23
why? just why?
1
u/Alarmed-Pollution-89 Feb 05 '23
Job security
1
u/[deleted] Feb 05 '23
But was it relevant experience related to the code that is written?
1
u/LittleLow7 Feb 05 '23
Months**
1
u/[deleted] Feb 05 '23
Flutter is still fairly new, so he may have 3 years of experience as a developer, probably not with Dart. Haha
1
u/[deleted] Feb 05 '23
That indenting
I hate it
I just realised I am being a massive hypocrite right now, ignore me
0
u/harrymfa Feb 04 '23
People would do anything to not learn css.
-3
u/[deleted] Feb 04 '23
Ok now, hear me out. I was told I'm unemployable bc I just started learning coding.
But even I can do it better.
-10
u/Bhallu_ Feb 04 '23
You can do this or you can just use rows?
6
u/[deleted] Feb 04 '23
[removed] — view removed comment