Author Topic: [solved] Smart Searching and Replacing Text  (Read 4252 times)

0 Members and 1 Guest are viewing this topic.

Offline harerod

  • Frequent Contributor
  • **
  • Posts: 449
  • Country: de
  • ee - digital & analog
    • My services:
Re: [solved] Smart Searching and Replacing Text
« Reply #25 on: October 30, 2021, 05:36:38 pm »
I haven't seen Eclipse mentioned, so far. I am not familiar with pure Eclipse, but CubeIDE has "refactoring" tools, which include variable renaming.

That being said - seeing those code snippets catapulted me back some forty years, when single letter variable names were a thing. Thanks for sharing, I envy you not.
 
The following users thanked this post: DiTBho

Offline cfbsoftware

  • Regular Contributor
  • *
  • Posts: 117
  • Country: au
    • Astrobe: Oberon IDE for Cortex-M and FPGA Development
Re: [solved] Smart Searching and Replacing Text
« Reply #26 on: October 30, 2021, 09:25:23 pm »
There are also 2193 "labels", and 911 "goto"  :o :o :o
This can be fixed by no tool, I can't, you can't, nobody can ...

Certain parts of the source look a dump from tools like "IDA", I wonder is it a kind of reverse engineering from assembly-to-C? Who knows  :-//
Why don't you try poking your eye with a sharp stick? It should be a more pleasurable way of spending your time ;)
Chris Burrows
CFB Software
https://www.astrobe.com
 
The following users thanked this post: DiTBho

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6266
  • Country: fi
    • My home page and email address
Re: [solved] Smart Searching and Replacing Text
« Reply #27 on: October 30, 2021, 10:09:10 pm »
Why don't you try poking your eye with a sharp stick? It should be a more pleasurable way of spending your time ;)
I'm not DiTBho, but I have this horribly annoying flaw that I tend to say "No problem!" when I mean "I can't give any guarantees, but heck, I'll have a go at it!".
More than once, this has lead me to do stuff that was less fun than sanding my eyeballs with sharp shards of glass.

What I have learned, is how useful documentation describing the overall purpose and algorithms implemented is.
Instead of killing oneself slowly by trying to work with such codebases, one can just rewrite the whole mess, preferably fixing any inefficient/unwanted behaviour at the same time.

My own code, I've learned to write in modules, mostly so that I can replace/rewrite/reuse the useful bits, without doing everything from scratch.  By "modules", I mean in adaptable units, as compared to "fixed" libraries.  Nowadays, I experiment with a lot of algorithms and possible approaches to answering interesting questions by writing the core part in such a module, then a set of unit tests to verify its behaviour.. and only if successful, move the module into library form for others to play with.  I often do 2-3 before I find the approach whose efficiency and behaviour I'm happy with.  I find it fun; I'd love to do that as a job.
 
The following users thanked this post: Ed.Kloonk, cfbsoftware, DiTBho

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3915
  • Country: gb
Re: [solved] Smart Searching and Replacing Text
« Reply #28 on: October 30, 2021, 10:18:52 pm »
I'm not DiTBho, but I have this horribly annoying flaw that I tend to say "No problem!" when I mean "I can't give any guarantees, but heck, I'll have a go at it!".

Yup, that's the point. It's not my code, the customer asked for a refactoring, that's what I am paid for.

Personally I would rewrite the whole code, but there is a problem: there is no documentation at all, the code itself is the documentation, and ... even it somehow works, even if nobody knows *how* and *why*.

So, let's acquire the documentation, and let's the customer understand what to ask next: rewrite? Ok, let's talk about business.

It looks like a fair plan. I don't want to force anyone.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 
The following users thanked this post: Ed.Kloonk

Offline DiTBhoTopic starter

  • Super Contributor
  • ***
  • Posts: 3915
  • Country: gb
Re: [solved] Smart Searching and Replacing Text
« Reply #29 on: October 30, 2021, 10:23:48 pm »
I haven't seen Eclipse mentioned

Yes, I have a virtual machine prepared by Wind River. Has Eclipse loaded and pre configured. As soon as I have an x86 laptop, I'll give it a try. Judging by its "readme.txt" it looks very powerful and reach of features.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Offline rsjsouza

  • Super Contributor
  • ***
  • Posts: 5988
  • Country: us
  • Eternally curious
    • Vbe - vídeo blog eletrônico
Re: [solved] Smart Searching and Replacing Text
« Reply #30 on: October 30, 2021, 11:05:40 pm »
Quote
I don't even get how anyone could write a 25 kLOC project with such a poor coding style?

Perhaps it wasn't like that originally but got obfuscated deliberately.
Job security. I have seen this before. Quite a few times.

I haven't seen Eclipse mentioned, so far. I am not familiar with pure Eclipse, but CubeIDE has "refactoring" tools, which include variable renaming.
I was going to mention Eclipse as well, since it has good refactoring tools, OSS and it is multi plataform, however DitBho' lib ssems to have solved the issue already. :clap: :-+
Vbe - vídeo blog eletrônico http://videos.vbeletronico.com

Oh, the "whys" of the datasheets... The information is there not to be an axiomatic truth, but instead each speck of data must be slowly inhaled while carefully performing a deep search inside oneself to find the true metaphysical sense...
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14490
  • Country: fr
Re: [solved] Smart Searching and Replacing Text
« Reply #31 on: October 31, 2021, 02:35:02 am »
Perhaps it wasn't like that originally but got obfuscated deliberately.
You. Probably, or auto-generated by other tools and merged together  :-//

Don't underestimate how nasty some developers can be... :-DD

But yeah, it might just be auto-generated code. If it is, then refactoring it to make it suitable for maintenance by humans is likely a very painful task, with not necessarily a gigantic benefit for future maintenance in the end...
 
The following users thanked this post: DiTBho


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf