Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm currently writing a developper documentation of a program I just wrote and which has to be continued by somebody else.
I'm documenting my code using Doxygen, but I'd like to show a more global view, using for instance flow charts filled with the name of the functions and the parameters they send to each other. But I also have to represent events, and it seems to me that flow charts are not the best for that, or a least I don't really see how to do it right and clear.
So Am I right? What would you need to catch on with a development of an already started application? Is there a better alternative than flow charts and UML?
From a general familiarisation perspective, I like seeing clear and detailed requirements specifications. This is lacking in the majority of cases in my experience.
From a design perspective, I like seeing state diagrams for state transitions, UML diagrams for general code structure and relationships and communication diagrams for information about data flows.
The more documentation you can give, the better it'll be for the next guy. But bear in mind that documentation can go out-of-date very quickly, so your (good) code comments and doxygen output are likely (but not necessarily so) to be more up-to-date than anything else you write.
As someone who picked up a 35,000 line Java project with 3 comments 2 of which were "this is gross" and "yeesh" I can say that I want to know what the abstract base classes are, what the flow of the program is, and any namespaces or global variables defined.
What's really helpful to me is a paragraph or two that says something along the lines of "main creates a driver of some base class which then reads in the xml file using some file reader and sets up an output object of type DefaultOutput before it executes the driver.run() function which ostreams the std:out to a file called output.txt and std::err to log.txt.
That paragraph would save me hours of picking through your code to figure out what gets used all the time.
It's also really helpful to have a "this depends on this so don't change it or you'll ruin literally everything" for any finicky code that might be present.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
as title says, i want to know what is logic behind visual programming and how is it being converted into code?
Use for example unreal engine 4 blueprints, how it all works behind scenes?
I somehow think everything is made using linked structures with pointers... For example:" if " statement needs link of statement and to output links, wether that statement is true or false... But if we do all like that, programming every keyword seperatly, i think it would take too much time.
I hope you understand what im thinking.
I would from the point of view of c++ explaination if possible..
Usually data flow graphs are not converted into C, C++ or similar before being compiled. A visual representation of a data flow graph is much closer to an Abstract Syntax Tree (AST) than written programming language code.
In fact, for most programming language compilers among the first steps carried out is the translation of a the written code into an AST, and it's a trivial task to feed such a AST into a program like graphviz to generate a call graph or similar from it.
So in a sense, that data flow graph of Unreal, or LabVIEW or similar programming environments is already one step closer to the executable code. Hence regarding your questions it's better suited to reformulate it as "how is written programming language parsed and translated into a data flow graph – like you can draw in Unreal engine – or an AST?".
Unfortunately the answer to this would go vastly beyond the scope of StackOverflow, and I'll simply refer you to the standard literature on compiler development.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to provide tests statistics of TDD usage in a company, so I need to identify which projects are using only TDD, or if there are tests code written after coding. I thought using time stamp file change info, but Does anybody have a better solution for this?
A pretty broad question, but I think there is actually a fact based answer.
That answer is: you can't solve social problems on the technical layer.
In other words: already your goal/requirement is flawed: you will not be able to generate those clear statistics. You might be able to apply some heuristics; but unless you get access to all information from all developer systems, timestamps wont help you. You see: the normal approach is to do some coding; and at some point release all of that into the version control system.
So, sometimes it might be clear from timestamps that X was written before XTest; but very often, X and XTest will be released into the library within one commit. Now - which one was written first?
Thus: start thinking on the "social" level first. Meaning: talk to the development teams. Ask them about their practices. And when they claim to do TDD; then look into their specific commit history and see if that tells you anything.
Usually following the Test Driven Development practice implies continuous repeating of small Red-Green-Refactor cycles. As #GhostCat stated, looking into the commit history is is an excellent point to check if the devs follow TDD principles. Every change in the production code should be reflected in a corresponding unit test.
You may also check the code coverage. The high coverage is not the goal but it can be a good indication if the TDD practices are followed.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
First off, my company is into power grid, not IT, so software is kinda a secondary role here.
I work on a power system simulation software, very old code base in C++ with MFC, like 15 years old. What we do is take large amounts of data, ~100,000 floating point values then format and write to a text file (most of the code actually uses the C FILE structure to do this). Then, it's read by a separate engine exe which computes the electrical algorithm (Electrical algorithms are mostly numeric solutions of system of diffn equations) and then writes back huge amount of data to another text file, which we read and update the UI.
My question is, is this how it should be done? It there a way to skip writing into the text file and directly pass the data to the exes?
exes are called using CreateProcess() MFC function.
EDIT::
Sorry, site won't let me comment.
#Vlad Feinstein Well, yes, it's like a Ladder. A thing called load flow solves power flow through the lines, which in turn will be used to find stability of the systems, which in turn for overvoltage ect. It's huge, the UI is million+ lines of code, engine exes another million maybe.
Doesn't MFC already implement IPC using Dynamic Data Exchange? I can pass strings to another process's PreTranslateMessage() func. A scaled up version of that?
There is no such a thing as "should be done as ..." there are multiple methods to do IPC and while the method you describe might not be the fastest, it is a viable solution nevertheless. If the performance doesn't bother you in this particular case you should not bother with modifying it. It is exactly the case where the phrase "if it ain't broke, don't fix it" applies.
Probably, you would not want to make any new IPC in the application that way, though.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
So, in the process of taking a data-structures class (in C++), my professor wanted us to manipulate a linked list of playing cards. That doesn't matter however, what I am interested in is why she did not use an enumerator to represent the suites.
In her code, she used strings to hold the suite of a card. This seemed inefficient because she wanted us to sort them based on suite, under the circumstances, it would have been considerably easier if she had used an enumerated type instead of a string. The string did not offer any help either, because in printing the suite, she output a Unicode character, roughly doubling the length of her function, simply because she did not use an enum.
Is there any reason for her to have done this, or does she simply have strange preferences when it comes to code style?
If you really want to know what your professor's reasoning is, you have to ask your professor. I can only speculate.
But if I were to speculate, I would guess that there are two possible reasons why your professor chose to use strings as descriptors for these attributes.
She is trying to keep the code simple and easy for newbie C++ programmers to understand. Whether the means meet the goal is debateable.
(Personal bias alert) Professors and others in academia, with no real-world experience, often do and teach things that I would consider to be highly sub-optimal.
My guess would be that she either had not considered that approach or that she wanted to test your ability to work with sorting strings.
Code examples might help in that they might clarify what she did and what you think she should have done.
The likely answer is that she just didn't think about the problem she was using to demonstrate whatever she is trying to teach you. That is, she wanted you to focus on sorting (for example), and probably took some code written by someone else and just adapted it to that purpose without much thought.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I was fascinated by the "press Tab to search site" feature in chromium, so naturally I wanted to see how exactly it was implemented in code.
A little background for anybody who aren't familiar with this. After navigating to some site, say wikipedia, and doing a search, chromium remembers the name of the query variable and will let you press tab and search the site directly from the address bar. Neat!
Problem is the codebase for chromium is huge and I've had no luck in finding the method/function that handles this.
How do you approach a large codebase when you are looking for the implementation of a particular piece of functionality? Any tricks for narrowing it down? Preferably it should not require building the software with debug symbols and following the flow through the program.
There is no one size fits all approach to this sort of problem. But for this one I would try these:
If there are any unique messages associated with the operation, grep all the source files for that string. A common pitfall of this technique is that messages might be assembled from pieces within the application, so it is often helpful to grep for a unique short phrase—or even a single word—to identify the source of the message. Once the text is found, then finding what references it often requires more text searches.
Trace execution from an easy-to-find point, like the command processing and dispatch loop. I'd look for a Tab key case and follow where it leads.
Look at source code directory and filenames for hints. Software is often constructed rationally, with good engineers dividing and conquering in a sensible way.
A test coverage tool is a good way to do this. They tell you what part of an application
is exercised by a test.
Instrument the application to collect test coverage. Execute the functionality you care about. Record what is executed. Execute something similar, but not the same as the functionality you want. Record this. Take the set difference over the coverage. The diff selects code involved in the functionality of interest, excluding code which is common to similar functionality.
Ask the Chromium team. They don't give points or bronze pixels but they're definitely the authority and right people to ask this sort of questions.