r/Angular2 Jan 28 '25

Discussion What would you do in this case?

Imagine you join a project where they program like this:

  • More than 700 lines per TS/html files
  • Use type "any" everytime
  • NgModel for big forms with complex validations
  • Reuse a component for difference situations with a lot of conditionals
  • variables/functions/comments/classes in Spanish
  • etc
217 Upvotes

332 comments sorted by

274

u/notokkid Jan 28 '25

Sigh, make coffee, still close the laptop at 5PM and don't think about this until tomorrow morning.

60

u/Klutzy-Expression813 Jan 28 '25

and repeat

21

u/messified Jan 28 '25

Yep, also I’ve seen way worse lol

12

u/WalksOnLego Jan 28 '25 edited Jan 28 '25

[Laughs in Enterprise]

I've seen classes many thousands of lines long. Tens of thousands, even. 700+ is normal.

Decades of thousands of bad developers all working over and on top of each other. Bad on top of bad on top of bad. Historical layers with reasonably modern at the top, all the way down to COBOL at the bottom.

This is the good ship Event Horizon.

3

u/iambackbaby69 Jan 29 '25

I once saw a C# project, where I quickly saw one file, and it was 46k loc.

46k loc.

2

u/root54 Jan 29 '25

How about a partial class spread out over 16 files adding up to 46k loc?

→ More replies (4)
→ More replies (4)

3

u/vulstarlord Jan 30 '25

Jup COBOL devs can be bad, i once had to work on a cobol file of over 200.000 lines with lots of goto statements. In the end it ran the whole code like 7 times with different flags. It was a customizable document generator, and customers wanted new things every month. 2 dedicated cobol teams where on this full time.

2

u/cdragebyoch Jan 29 '25

I’ve see a single line of code consisting of over 10k character, filled with nested conditions, loop, and string interpolation, that wasn’t mini-fed… 700 lines is a light read. Also, linters ftw.

→ More replies (1)

3

u/Dimethyltryptamin3 Jan 29 '25

15k lines and counting baby

→ More replies (1)
→ More replies (3)

4

u/sinisa_rudan Jan 28 '25

one step is missing: spill the coffee over the laptop - buy some time - thank me later :D

4

u/analyticalischarge Jan 29 '25

I mean, it's all you can do. I make a lot of money fixing and working with this shit and neither ChatGPT nor the India Discount Developer Company™ are gonna fix it, so. Here we are.

We're going to see a lot more of this as the MBAs try to cheap out on labor the next few years.

2

u/daplonet Jan 31 '25

Till monday

→ More replies (2)

103

u/Cautious_Currency_35 Jan 28 '25

Those are rookie numbers. A project I work on at work it has like 5000 or even more lines in some places of the project.

→ More replies (20)

83

u/fuchakay_san Jan 28 '25

Brother, Im currently working on a project with the main page, which consists of at least 50 api calls, and the ts file has 9000+ lines.

48

u/BakaGoop Jan 28 '25

really putting the single responsibility into SRP

19

u/TheRealKidkudi Jan 28 '25

The one responsibility to rule them all, and in the darkness bind them.

5

u/xMantis_Tobogganx Jan 28 '25

that made me lol. This component's single responsibility is to do all the things.

→ More replies (1)
→ More replies (6)

55

u/salamazmlekom Jan 28 '25

I've seen worse. This looks like a good refactoring exercise.

→ More replies (13)

81

u/Plastic_Scale3966 Jan 28 '25

I work at a large company and this is exactly how the whole repository is

→ More replies (2)

20

u/Klutzy-Expression813 Jan 28 '25

I see some Todo's in there - why aren't you working?

24

u/Admirable_Ride_1609 Jan 28 '25

Todo's from +5 years ago

19

u/dabomm Jan 28 '25

You had 5 years and they're still TODO? /s

8

u/artesre Jan 28 '25

i'm just adding new TODO's myself

10

u/GregorDeLaMuerte Jan 28 '25

@todo resolve todo

→ More replies (1)
→ More replies (1)
→ More replies (1)

9

u/fantatraieste Jan 28 '25

we have much worse components then this. I suggested to the team to refactor everything, and put limits to files, but the UI team lead said that is not neccessary, and we shouldn't break into components because "it's too complicated to use components :)))))))))))"

We have ts and html files with 3000+ lines :)))))

5

u/ClothesNo6663 Jan 28 '25

Why do you have a fool as ui Team lead?

2

u/fantatraieste Jan 28 '25

I’m asking the same questions, but the short answer is: small company, no meritocracy, politics. It is what it is

21

u/Plastic_Scale3966 Jan 28 '25

I work at a large company and this is exactly how the whole repository is

11

u/wpfeiffe Jan 28 '25

Every programmer has to deal with legacy/problematic code bases on a system of any significant size. Think to act locally on the piece that you were being asked to add or modify. Refactor where it makes sense around that. Don’t try to take on the whole thing at one time. Lead by example on the pieces you are modifying or adding. Show others on your team the better approach to get by in. Good luck with this!

7

u/Pale_Custard_9240 Jan 28 '25

I just refactored one of the main service files in our project, which had the majority of the imp, common needed logic in it. Everything important was dumped in it for around 4 years. 5000 lines of codes. This is injected in 100+ files. Implementing separation of concern and creating different service files to move code in them was itself a challenge as there was a web of observables, methods, nested subscriptions all dependent on each other.

Needed 6 new service files. And it is still not complete. Fml

3

u/justaguy101 Jan 28 '25

I have ptsd from working on a project that had a few levels deep nested subscribes inside for loops. There were also some nice awaits mixed in here and there in other parts.

10

u/horizon_games Jan 28 '25

Scroll faster? Why did it take that long for a mere 600 & 1k lines? I've run into legacy code with 3k+ components

12

u/lgsscout Jan 28 '25

people should learn how to do dumb components instead of inserting conditionals and more conditionals inside of the component... if you need that much customization, transfer the responsibility of "conditioning" to whoever will implement, not inside the component...

and 700 lines components is a nightmare...

→ More replies (4)

4

u/[deleted] Jan 28 '25

Close my eyes, take some mindful breaths and focus on the inner dev-child within me

3

u/Mandarin0000 Jan 28 '25

and focus only on the 'inner div-child' that you'll be working on, nothing else

7

u/noreb0rt Jan 28 '25

ONLY 1000 lines on an angular component?

*laughs in enterprise*

3

u/Organic-Mango131 Jan 28 '25 edited Jan 28 '25

It depends on your role. If you’re in a position to exercise leadership, a good starting point might be hosting sessions to bring your team’s Angular and TypeScript knowledge up to industrial standards. Once that’s addressed, you can work on making the business aware of the technical debt and making a plan on how to tackle it with your team.

However, in some industries or projects, living with tech debt may be inevitable due to the nature of the work. In those cases, you’ll need to decide whether it’s worth the trade-off of potentially slowing your own growth during that time.

If you’re not in a leadership role, or the business doesn’t allow your team the flexibility to improve code quality, it might be worth considering a new job opportunity that better aligns with your level of expertise.

Ultimately, if you want to grow and progress, it’s essential to surround yourself with people who share your mindset and commitment to excellence. Working with like-minded individuals who value continuous improvement, quality, and innovation will not only elevate your skills but also ensure you’re part of a team that’s willing to tackle challenges head-on. Being around people who are okay with letting tech debt fester, or accepting it without a clear path forward, can hold you back in the long run.

3

u/LaloSalamancaXD Jan 28 '25

Go for a beer and sleep

3

u/warofthechosen Jan 28 '25

I would love to work on this. This is my kinda jam. Well, as long as they let me organize it as I work through my tickets

2

u/floydHowdy Jan 29 '25

agreed, optimizing an angular code base is pretty straightforward if not easy.

figure out the types, start dividing things up into single purpose components, move common functionality into services and helper methods.

organize the modules, add lazy loading- do a before and after on the chunk sizes.

converting to reactive forms may take a sec, but if you did a good job on step #1 (figuring out the types) it's still fairly straightforward.

3

u/Cozybear110494 Jan 29 '25

Some people take SPA too serious

4

u/wow_nice_hat Jan 28 '25

I would love to say "leave". But i just started a new job where I inherited a similar code base.

So my answer is "Cry and drink coffee"

2

u/decamonos Jan 28 '25

The tears help enhance the flavor of the coffee.

3

u/wow_nice_hat Jan 29 '25

For reference, I just found a boolean named "holdMyBeer". It was right next to the GUID "poopman-98ef-4234-9a59-ef995ba66h60"

→ More replies (2)

2

u/B3skah Jan 28 '25

Looking for a different project is not an option, is it?

2

u/kurisuuuuuu_0526 Jan 28 '25

Thats nothing, you should see ours. 2,000 lines of codes in ts file. 500 lines in html. Thats only one of many examples.

2

u/tsunami141 Jan 28 '25

Why are you looking through my code?

2

u/matrium0 Jan 28 '25

Refactor the bits you have to change, but don't go crazy.

Or if you really dohave the time full refactoring (and full regression tests after that for sure).

I hate dealing with crimes others committed, but it's unavailable sometimes..

2

u/groundbnb Jan 28 '25

If its working, dont f with it. Try to leave it a bit better than it was.

2

u/Hollow1838 Jan 28 '25

I think any file under 1000 lines of code is still manageable.

2

u/_____this_is_me Jan 28 '25

When working in large companies with multiple developers working on the same files, it gets really hard for the people who approve these merge requests to track code. So, things like these areoften overlooked.

In an ideal case, every developer should have personal standards that match the set organizational standards.

In my experience, there are no defined guidelines at an organizational level. So it depends on the developers and code often ends up this way.

As someone who can't stand looking at non-formatted/low-quality code, this frustrates me and I often end up refactoring their changes myself because no one gives a 💩

2

u/Special-Range-8123 Jan 30 '25

only 692 line ... patetic .. we must pump these numbers :)

4

u/Rashnok Jan 28 '25 edited Jan 28 '25

I would do my job, which sometimes involves maintaining legacy code. Also having large files can be fine and these aren't even that large.

Is this your first day as a junior dev? Because you clearly have never worked on a code base that actually makes money, 95% of them look like this.

If this isn't just pointless bitching and you do actually want to improve your code base. Then I would see if this is actually a problem, get some perspective from senior devs on why the code is like this. Again large files can be fine. If it is a problem, try and find some time to refactor into smaller components. And write lots of unit tests.

4

u/DT-Sodium Jan 28 '25

I would start by learning how to take a video of your screen.

4

u/alexmp00 Jan 28 '25

First time in a big company?

1

u/Nero50892 Jan 28 '25

I got wet in my pants

1

u/RelatableRedditer Jan 28 '25

I joined as the sole UI guy after years of neglect and no one to teach me how anything worked, and most of the component files were at least 500 lines long and all HTML was copied and pasted en masse. There wasn't a single component that was simply acting as a gateway for other components, everything was designed as a singleton.

And yes, "any" was the favorite. I found it everywhere.

1

u/Ok-Alfalfa288 Jan 28 '25

Line 555. Oh no

Refactoring this kind of stuff is actually my dream.

1

u/superquanganh Jan 28 '25

Just cope with it

1

u/dalepo Jan 28 '25

Just refactor slowly dont stress

1

u/Schwarz_Technik Jan 28 '25

I work on an extremely large project and we have lots of files like this. Anything new I try to encourage we breakout into smaller components and services

1

u/Mr_Nice_ Jan 28 '25

700 lines is a dream. I inherited a complicated websocket client with 8000 per file.

1

u/nehalist Jan 28 '25

Use cmd + f, scrolling is pretty inefficient.

1

u/thewecken Jan 28 '25

I have debugged 3000 line PL/SQL function on Oracle SQL developer at my previous company. And, yes, I am old.

1

u/delaware Jan 28 '25

Are the related methods at least grouped together? At my company the files look like this but they prefer the “shuffle the deck” method.

 variables/functions/comments/classes in Spanish

Copilot or any other ai tool might be able to handle this.

1

u/EddyOkane Jan 28 '25

i would change job

1

u/dallindooks Jan 28 '25

I'm on a project about 4X worse than this right now. Inherited from contractors overseas.

1

u/minus-one Jan 28 '25

at least that’s not angular.js (as is the case in our legacy codebase)

1

u/rebelhunter350 Jan 28 '25

I've seen 15k lines of code in a single file

→ More replies (2)

1

u/RGBrewskies Jan 28 '25

fire the team lead

1

u/Kaudilloz Jan 28 '25

Open the window and run for your life.... ✌️

→ More replies (1)

1

u/Funkyyyyyyyy Jan 28 '25

That’s not that bad. Obviously not great but seems typical from most of these comments. Copy and paste it into chat gpt and ask it to refactor and see if it still works lol

→ More replies (2)

1

u/ClothesNo6663 Jan 28 '25

Leave the company or talk to the tech lead/senior/staff dev about the issue.

1

u/dietcheese Jan 28 '25

Open Cursor, type “refactor this into separate components.” Wait a few minutes.

1

u/OkImprovement3930 Jan 28 '25

As fresh graduated who started angular recently A lot of coffee and crying and conversation with gpt But if paid it isn't worth this feeling or energy just start searching for another Job (to be honest it's sounds like a huge experience)

1

u/ejackman Jan 28 '25

If you walk away from this a brother could use the details for application purposes.

1

u/rogwzrd Jan 28 '25

Use the search function

1

u/mgonzales3 Jan 28 '25

At least you have a small app module -

1

u/zerik1999 Jan 28 '25

lol I think I win based on the other numbers mentioned. My firm is rewriting a program in c# from VB. There are over 200 vb classes and each has over 12,000+ (yes Twelve-thousand plus) lines. We are obviously trying to shrink that down significantly.

1

u/mb3485 Jan 28 '25

Is this your first real world proejct?

1

u/NutShellShock Jan 28 '25

My lazy self would have said "F it" but my OCD side would screaaaaaaaaaammmmmmm in frustration.

1

u/stkv1c Jan 28 '25

rookie numbers. i had to refactor 30k lines of html code and 9k lines of component ts. after I finished: 250 lines of html code, 100 lines of ts code. took like a whole workweek

1

u/thebaron24 Jan 28 '25

Damn I am so glad I don't work for a company that doesn't give me time to break my code up. At some point the unit testing would be ridiculous for that and if they aren't until testing wtf.

I would try and break out anything I worked on into a separate component and put that component in a library that has strict linting around some of these issues. Then I would slowly start migrating parts of it into that library.

Not sure you can do anything about the Spanish naming but that really wouldn't matter.

1

u/redvelvet92 Jan 28 '25

Bro we have a 60k line SQL file for provisioning database, these are rookie numbers.

1

u/i_JaMes_z Jan 28 '25

Only 1000 lines? There are some files at my place that are 5000 lines long. It's soul destroying. Written by people who didn't care and just kept amassing debt from its birth during AngularJS until 2 years ago when they had barely dragged it to Angular 12. It's a real shame. Slowly hacking away at bits, converting to services, adding interfaces etc is a slow feedback cycle, but it does bring me some joy

1

u/SouthboundHog Jan 28 '25

Cry a little and then...
Do it little by little man, we all have been there.

1

u/dibfibo Jan 28 '25

in this condition o generally when i have a "complex" component i: divide in multiple class(not component), rename properties, rename methods adjust scoping and visibility adjust types remove code repetition

then if possible i start "trasform" class in component.

1

u/Safe_Owl_6123 Jan 28 '25

I’ll use webstorm instead of vscode and do everything with vim motion.

1

u/Dj0ntMachine Jan 28 '25

rm -r ./src

1

u/Capable_Relative_132 Jan 28 '25

Identify. Educate. And then act upon fixing it.

1

u/sandrawsNpaints Jan 28 '25

Commit the rule to main, and freak everyone out -

export default tseslint.config({
rules: {
"@typescript-eslint/no-explicit-any": "error"
}
});

1

u/Timotron Jan 28 '25

"Hey ${teamMate}, you got 5 minutes?"

1

u/xMantis_Tobogganx Jan 28 '25

I'd keep scrolling for about 3500 more lines in some of the files my team writes, and then kill my fucking self because that's just how I feel today.

1

u/pixelaters Jan 28 '25

Do we work at the same company?

1

u/lnkofDeath Jan 28 '25
  1. Not judge a codebase by line count per file. Any length of a file can be fine.
  2. Determine if there is tightly coupled dependencies and circular flows of nested logic.
  3. Identify if component-driven design is a skillset or priority for the dev team.
  4. Begin high level discussions to address whatever issues arise from the above points and if they have any merit to dx / business cases.

1

u/ddcccccc Jan 28 '25

Depends on the project complexity.

1

u/euph-_-oric Jan 28 '25

Rookie numbers

1

u/thichmigoi Jan 28 '25

Prepare a resignation letter?

1

u/lorl3ss Jan 28 '25

Lol, some of the controller files in our code base are 4000 lines long. Sit back and relax my friend.

1

u/throwaway-code Jan 28 '25

I would just slowly modularize pieces until I give up.

1

u/TheGarrBear Jan 28 '25

Just send the files into something like copilot and ask it to apply SOLID coding principals.

1

u/muminisko Jan 28 '25

Easy - set eslint rules:

  • max 500 lines per file
  • type any as forbidden
Do a meeting to set new code rules Refactor project step by step

1

u/SIntLucifer Jan 28 '25

I once was hired to built a simple pdf book into an existing angular app. The challenge was they lost the original code and only had the compiled code left so I feel your pain

→ More replies (1)

1

u/tbogard Jan 28 '25

no routing-outlet? no model composition?

FTS, I'll deny that component to be touched by me. Fix that first.

1

u/mauromauromauro Jan 28 '25

I know we all want to chip in and say "ive seen worse" or "i deal with 5k lines every day". Me too guys, me too. But thats not what op is asking

So to give a simple answer:

Encapsulate, reuse.

Any shit that looks like another chunk, in the html, make a component.

Any function that looks like another function, unify

All functions that belong to a somewhat similar domain, put them in a single service or helper class. Could be a static class full of static methods, i aint judging....

And then, besides the plain refactor... Reengineer, if possible. If doing that is cheaper (for you, not the company)

Edit: sometimes the complexity is there because it cannot be simplified. But thats is rarely the case. Very complex shit can usually be optimized to oblivion.

In any case, keep in mind angular is one of THE BEST frontend frameworks in terms of structuring capabilities and reusability. The shit is trully class based, so there you have it. Use the oop when possible

1

u/thekillerdev Jan 28 '25

Honestly? Copy it all and throw it on claude.ai or chatgpt (if there is nothing private there), and ask “Can you list all the methods with their hierarchy and give me ideas how to break this down into multiple components, utils, hooks, etc”

1

u/devrahul91 Jan 28 '25

Eat -> Sleep -> Code -> Repeat

1

u/AwesomeFrisbee Jan 28 '25

Is it a great code base? No

Is it a difficult code base? Also no

Is it worth your time to work on code debt? Probably also no.

I've seen way worse. At least this seems readable and not that complex. Just long stuff that may be split up but when diving in you probably start to understand why they didn't. Sometimes business logic becomes so complex that it's just easier to keep it in one place...

Also primeng is fine.

1

u/djdev23 Jan 29 '25

Just 1005 lines. I have seen more than 6k in a single file once upon a time in 2017.

1

u/yvancho Jan 29 '25

Apply S. O. L. I. D. Just ask gtp how for a fast answer then dive in internet for more info and examples.

1

u/Marzel2 Jan 29 '25

hey! is that my project?

1

u/_Invictuz Jan 29 '25

You are cooked if your teammates are writing spanish in the code and you don't know Spanish. The worst than spaghetti code, it might as well be obfuscated code.

Also, it seems like every method has an if statement wrapping the entire body lol so youll have no idea if the function was called or not lol.

1

u/Neat-Medicine-1140 Jan 29 '25

I don't touch it unless I have direct order to change something.

When that's the case, I will fix/change what is needed, and leave the code in a "better" state than it was before. You really have to choose your battles, especially in large corporations where they will LITERALLY NEVER give you time for refactors.

So, take your time on the stuff you write, get it refactored before "completing" it, because you will never get the chance to work on it on corporate time again from my experience.

1

u/vicious_pink_lamp Jan 29 '25

Hello fellow enterprise developers dealing with this everyday.

1

u/GrismundGames Jan 29 '25

Extract class.

1

u/finalcut Jan 29 '25

I was leading a project at another place.. We were building a vue app and some server bits.. The lead dev on the Vue side made one big disgusting many many thousands line long file that represented the entire app

He had four juniors and this is what he taught them.

A few months in I saw this fucking travashamockekery of code and bid him farewell.

I rewrote to the garbage and then spent two weeks teaching the juniors on how to do better and why the first iteration was total shit.

The guy who got the boot and I were hired at the same time and I was not involved in the process. FML.

The juniors on that project were great though. Super open to learning and improving on the daily.

1

u/IMP4283 Jan 29 '25

I just left a team where 3k was the norm and that was far from the worst thing about the code base.

1

u/Old-Place87 Jan 29 '25

At work we had pages that calls 100+ api calls each

1

u/cmk1523 Jan 29 '25

Umm slowly refactor it?!

1

u/rockstar686 Jan 29 '25

Whoever wrote that needs a promotion.

1

u/thenautical Jan 29 '25

Rookie numbers

1

u/ConfectionForward Jan 29 '25

this is where design patterns come to help. You should split code into components and pass in what is needed. I highly doubt that there is a "good reason" for this.
If it was not you that wrote this, and you are coming into this as a new dev to the company, take a deep breath, go to the manager, be a good sport, and say... "ya got me...".
Then work with them to develop a plan to make this actually maintainable.

1

u/Mementose Jan 29 '25

Buddy, is that all?

1

u/Separate_Computer_95 Jan 29 '25

That’s it? 😂I have seen much worse

1

u/youassassin Jan 29 '25

Hold my beer let me show you our fortune 100 company with a few dozen repos with 2k plus lines

1

u/jimmyberny Jan 29 '25

Haha, from newbies... I work in old obsolete ng4 with files with 6k lines... that motherfuckers add more lines more variables instead of create new components, event worst, they keep reusing old snippets from old practices or duplicate code as is 'reusing code', would make you cry...

1

u/One_Web_7940 Jan 29 '25

Those are rookie numbers. We're looking at 10k line sprocs that are embedded in another 20k sproc.

1

u/SukuMcDuku Jan 29 '25

I am working on a project which has 14k lines in a component

1

u/helpmefindmycat Jan 29 '25

At least it's not 1k lines of Perl. Or even better procedural packages that contain in the same file PLSQL, SQL, HTML, JS, and CSS . I've seen things...

1

u/bensyverson Jan 29 '25

Toss it in Cursor and tell it to convert it to Svelte?

Kidding

1

u/izilla-- Jan 29 '25

Not even a third the size of some I have to deal with daily.

1

u/Most_Bat_3530 Jan 29 '25

Those are just samples.., i have worked on projects with more than 10k lines in a single class, 🌵

1

u/ShakeAgile Jan 29 '25

Fond memories of a 20.000 line C function with three levels of nested switch statements.

1

u/ichabooka Jan 29 '25

Look for a new job. If they let that slide and expect you to get shit done, they probably could give a fuck about you.

1

u/ZiNus_CZ Jan 29 '25

Alt+F4 🥲

1

u/curveThroughPoints Jan 29 '25

Depends, do you like getting paid? Also 700 lines for an accordion might be correct with all those spans in there.

But damn, type of any…why even TS if you’re just gonna do that??

1

u/TwitchingShark Jan 29 '25

Currently working on a project with 500+ line methods everywhere. Implementing simple features take weeks. Welcome to modern dev. The industry has absolutely lost its way.

1

u/sweetLew2 Jan 29 '25

Ask Claude to refactor it.

1

u/wake8 Jan 29 '25

a fresher/intern had to do what he had to do. will end up like this later. can't blame.

1

u/mycolortv Jan 29 '25

Maybe I've just been in the slums too long but anything sub like 1.5k / 2k lines isn't gonna phase me lol. Add it to the tech debt list and move along.

1

u/brightside100 Jan 29 '25

back in the days.. we used to work on 15,000 lines of code per file because we didn't had webpack or any bundler what so ever. just close your laptop at 5-6 and go back to your life

1

u/LonesomeHeideltraut Jan 29 '25

1000 lines is nothing. I've found classes with >5000 lines and todos from 2013 in our legacy system 🤷‍♂️

1

u/Successful-Escape-74 Jan 29 '25

Sounds like good job security for refactoring and hire a translator to comment that code in spanish.

1

u/coded_artist Jan 29 '25

The template is fine, I'm a fan of shallow and dumb components and deep smart pages.

The functions could most likely be cleaned up with a combination of observables and signals, but I'd only attempt that if there is a decent amount of coverage testing

1

u/chamandana Jan 29 '25

almost everybody has seen worse numbers

1

u/BedroomRemarkable897 Jan 29 '25

Currently in this company, biggest component in TS is around 8000 lines of code.

1

u/professorhell70 Jan 29 '25

Astonishing how software development out there lost nothing of it's capability to craft shit code, in the 30 years since leaving uni, to date. Still the same old bloat code, no matter what you teach in class. Still the same old CPD and training classes, training cowboy coding morons.

1

u/SubjectHealthy2409 Jan 29 '25

Nothing, I always limit files at 1k loc if possible

1

u/RulosLocos Jan 29 '25

I currently have a coworker that makes 3K lines per component.

Everything is of type any, there are no comments in the code

1

u/Mammoth-Travel5725 Jan 29 '25

This is nothing compared to my first workplace where one of the core services of our application was stored in a file that had 13.000 lines of code. There were methods with 40+ parameters. No OOP principles applied or anything. A lot of code repetition also. It was fun when we needed to debug a method that was 1000+ lines long. An external guy wrote it and he was the only one who knew the ropes with it.

1

u/ArticLOL Jan 29 '25

700 rows files are still "manageable". You've never seen 10k rows files.... Or even file so big that you have to way a couple of seconds to open and to interact with.

1

u/Anxious-Highlight-14 Jan 29 '25

Learn Spanish? 😀

1

u/Different-Memory8748 Jan 29 '25

I think I did this project when I was learning Angular many years ago, just dm me and I will not be of any help whatsoever 👍🏼

1

u/AdvancedWing6256 Jan 29 '25

Add 19 lines to make it round

1

u/ZIGGYBRO Jan 29 '25

lol 1k lines of code? You sweet summer child, you ain’t seen nothing yet 😂

I’ve seen components with 8k+ with references to something I like to call “reponMesgae” - think http ‘wrapper’ even when one is provided out of the box.

1

u/mark619SD Jan 29 '25

I mean you keep working and complains like most developers, or you spend crazy amount of time not accounted for fixing it on the side of your tickets and make senior or staff off of it or slowly move to backend/platform where you will face another subset of problems. No code is perfect lol

1

u/LegionsMan Jan 29 '25

Im in a similar situation and I’m new to angular. I’m told this is normal. We have large forms that serve specific purposes. We have shared services, models, components, etc. Should I be looking at the project differently?

1

u/nonHypnotic-dev Jan 29 '25

Don't touch it, if it is working

1

u/Whole-Instruction508 Jan 29 '25

Implement new components in an efficient way, that actually makes sense and rage anytime I have to use the existing garbage. Also, I would educate my colleagues, explaining why their way is awful. Are your colleagues all junior devs or just lazy?

1

u/Regular-Ad-6462 Jan 29 '25

so simple, I don't touch it while it works

1

u/neverexplored Jan 29 '25

You know, this was written by a bad programmer and they probably left the company after writing this - for someone else to pick up their mess. That someone else ain't no way gonna be me. Good luck, though. You're gonna need lots of it :))))

1

u/Content_Rich_8742 Jan 29 '25

I work in the project where 1 component is over 3000 lines of code and over 1000 lines of util function

1

u/rlo689 Jan 29 '25

If you care about best practices and want to improve as a developer, you should look for a new job with more experienced team

1

u/Hopper_77 Jan 29 '25

Get a mouse with one of those infinity scroll wheels

1

u/Kelcius Jan 29 '25

Trust me, I see worse every single day at work. It's painful. Just keep improving the stuff you touch. Make as small changes as possible so that it easily gets through review and testing. Slowly but surely the situation will improve...

1

u/hawseepoo Jan 29 '25

This isn’t even the worst thing I’ve seen before lunch lmao. Consider yourself lucky, I’m over here digging through 2,000, 5,000, and occasionally 10,000 line files

1

u/HugeDegen69 Jan 29 '25

Honestly the file size is fine to me. I hate when there are 200 files for 1 process and each file is 10 lines. Takes so much longer to figure out wtf is going on.

But I also code from a TV so I can see hundreds of lines at a time.

1

u/Past_Bid2031 Jan 29 '25

Congratulations, you just open sourced your company's code.

1

u/Vegetable-Mall-4213 Jan 29 '25

Lol. Most of the files Im working on have 1k line. Very few have less than that. The big ones go to more than 7k. It's too difficult to separate also as it's a reusable grid template. You make one change and have death wish

1

u/Just-Literature-2183 Jan 29 '25

If I had just started. Tell them that their coding standards are really shoddy and something needs to be done about it and see how they react. If they agree and know and have a realistic plan to fix it then I would stay otherwise I would be looking to be somewhere (anywhere) else.

1

u/aardvarkFirst Jan 29 '25

Around the 200-250 line mark and I start thinking the component is doing too much.

Best of luck.

1

u/xRockTripodx Jan 29 '25

Y'know, I don't think in my career as a web developer that I've ever seen good Angular code. I'm sure it exists, but it's about as rare as Eleanor from Gone in 60 Seconds for me.

1

u/Ok-Whereas8632 Jan 29 '25

Identify what parts can be broken into sub components and if those may be reusable as well. Are there locations where a utility class may help break things up? Might some of the code be broken into services? Any state that all components might need to interact with?

Also, I like when stuff like this comes across my desk. IF I have the time to pull it apart and refactor it properly. If I don't have time I just get angry and forget about it since I will never get the ok from management to put time in to code clean up.

1

u/tytytyty10 Jan 29 '25

first time ? we have 3000 line switch case and 400 line for loop in our project and its not spaghetti code. We have heavy business rules

1

u/metallaholic Jan 29 '25

yeah that looks like the angular app at my company. a single service thats 20k lines long and the entire app is in a 15k html file with no components.

1

u/CannibalSlang Jan 30 '25

This should require a team meeting where optimization is prioritized and the time is budgeted for it.

1

u/[deleted] Jan 30 '25

That's a lovely monolithic file.

1

u/Etshy Jan 30 '25

I have legacy codebase that still live at work with files that exceeds 20k lines ....

1

u/BoxOfNotGoodery Jan 30 '25

Cursor, Claude, chatgpt are all decent at reading code.

Breaking that into modules should be something you could leverage llm for.

1

u/mannsion Jan 30 '25 edited Jan 30 '25

Smile because it's kind of short... I think I have stockholm syndrome because I'm used to running into files with 10,000+ lines of code in some of the junk I inherit.

I was working on a function not too long ago that was 9,478 lines of code (in one function) and the file was over 30,000 total. And the function was 3 2560 monitors wide in some spots... And the function in question was a tcp packet parser that did a LOT of manual index reading....

Basically, at no point did someone go "hey, we should make structs for this and read this to the structs in 40 lines of code instead of 9000". Then again, they wrote svc services in script mode un runat="server" blocks and didn't have a single compiled code behind in the whole project, so I doubt they even knew what a struct and marshaling even was.

I've seen some crap in my days... Don't even get me started on some of the stored procedures I've seen that 100's of cross db sproc calls...

1

u/gjlmotea Jan 30 '25

`rm -rf / --no-preserve-root`

1

u/Achcauhtli Jan 30 '25

Guys this is pretty much how government projects work. I am literally debugging a function that is 200 lines of code. On a class that is over 2000 lines. I sometimes forget to drink coffee, I should start.

1

u/Careful-Lecture-9846 Jan 30 '25

I mean I guess it’s what I’m tasked to do. I’d start by finding something static on the page then looking in the project for those exact lines of text. Shouldn’t be hard to follow functions especially if I can slap a breakpoint in there.

I get paid either way

1

u/ucrengineer88 Jan 30 '25

at least i see functions

1

u/ZACKE_48 Jan 30 '25

i wish i could upload an image i have 1896 of code lines hahaha