Billy ᛭
That's good news, I've finished reading Clean Code recently. I won't probably even wait until the second edition of the book is translated to my native language and read it in English.
Danya🔥
Thanks. So again, hi there fellow C/C++ developers. You guys are generally the smartest out of all developers out there so I hope for your help. I've recently read Clean architecture by Robert Martin (a great book and it is worth attention because the author is obviously very smart and experienced, and everyone who bashes his book does not know what they are talking about). In the book, we have this: NOT ALL COMPONENTS SHOULD BE STABLE If all the components in a system were maximally stable, the system would be unchangeable. This is not a desirable situation. Indeed, we want to design our component structure so that some components are unstable and some are stable. The diagram in Figure 14.8 shows an ideal configuration for a system with three components. The changeable components are on top and depend on the stable component at the bottom. Putting the unstable components at the top of the diagram is a useful convention because any arrow that points up is violating the SDP (and, as we shall see later, the ADP). The diagram in Figure 14.9 shows how the SDP can be violated. Flexible is a component that we have designed to be easy to change. We want Flexible to be unstable. However, some developer, working in the component named Stable, has hung a dependency on Flexible. This violates the SDP because the I metric for Stable is much smaller than the I metric for Flexible. As a result, Flexible will no longer be easy to change. A change to Flexible will force us to deal with Stable and all its dependents. To fix this problem, we somehow have to break the dependence of Stable on Flexible. Why does this dependency exist? Let’s assume that there is a class C within Flexible that another class U within Stable needs to use (Figure 14.10). We can fix this by employing the DIP. We create an interface class called US and put it in a component named UServer. We make sure that this interface declares all the methods that U needs to use. We then make C implement this interface as shown in Figure 14.11. This breaks the dependency of Stable on Flexible, and forces both components to depend on UServer. UServer is very stable (I = 0), and Flexible retains its necessary instability (I = 1). All the dependencies now flow in the direction of decreasing I. Abstract Components You may find it strange that we would create a component—in this example, UService—that contains nothing but an interface. Such a component contains no executable code! It turns out, however, that this is a very common, and necessary, tactic when using statically typed languages like Java and C#. These abstract components are very stable and, therefore, are ideal targets for less stable components to depend on. When using dynamically typed languages like Ruby and Python, these abstract components don’t exist at all, nor do the dependencies that would have targeted them. Dependency structures in these languages are much simpler because dependency inversion does not require either the declaration or the inheritance of interfaces. Illustrations are as follows: i . imgur . com / GgWawn3 . png i . imgur . com / MVPqSrr . png
So Robert Martin wrote a whole chapter explaining incaplusation and polymorphism What a waste of resources
Billy ᛭
So Robert Martin wrote a whole chapter explaining incaplusation and polymorphism What a waste of resources
I am convinced that we should force lock up people like you in online mental asylums like r/cognitivetesting to crush your ego and self confidence with some silly numbers displayed on the screen.
Billy ᛭
Howdyaknow?
Because this is the among the first things I usually hear about Uncle bob, and I learnt to wait for the worst every time someone mentions him. T_T
Danya🔥
I am convinced that we should force lock up people like you in online mental asylums like r/cognitivetesting to crush your ego and self confidence with some silly numbers displayed on the screen.
If you're stupid to understand that Martin just fucking poored a water to sell you a book, you probably shouldn't even be trying to read it
Danya🔥
Appealing to authority is just a logical mistake and a bad one
Danya🔥
It tells you that you're stupid
Danya🔥
If you can think with your head, why are you even coding?
Danya🔥
If you weren't so brazen, you'd gotten your answer for not-so-smart question much earlier
Danya🔥
But now only thing you get is ban
Rose
Another one bites the dust...! Banned Fox. Reason: rude, stupid & offtop
Danya🔥
Why be so toxic when you're trying to get an answer to your question?
Billy ᛭
I am blown away
Billy ᛭
Thanks. So again, hi there fellow C/C++ developers. You guys are generally the smartest out of all developers out there so I hope for your help. I've recently read Clean architecture by Robert Martin (a great book and it is worth attention because the author is obviously very smart and experienced, and everyone who bashes his book does not know what they are talking about). In the book, we have this: NOT ALL COMPONENTS SHOULD BE STABLE If all the components in a system were maximally stable, the system would be unchangeable. This is not a desirable situation. Indeed, we want to design our component structure so that some components are unstable and some are stable. The diagram in Figure 14.8 shows an ideal configuration for a system with three components. The changeable components are on top and depend on the stable component at the bottom. Putting the unstable components at the top of the diagram is a useful convention because any arrow that points up is violating the SDP (and, as we shall see later, the ADP). The diagram in Figure 14.9 shows how the SDP can be violated. Flexible is a component that we have designed to be easy to change. We want Flexible to be unstable. However, some developer, working in the component named Stable, has hung a dependency on Flexible. This violates the SDP because the I metric for Stable is much smaller than the I metric for Flexible. As a result, Flexible will no longer be easy to change. A change to Flexible will force us to deal with Stable and all its dependents. To fix this problem, we somehow have to break the dependence of Stable on Flexible. Why does this dependency exist? Let’s assume that there is a class C within Flexible that another class U within Stable needs to use (Figure 14.10). We can fix this by employing the DIP. We create an interface class called US and put it in a component named UServer. We make sure that this interface declares all the methods that U needs to use. We then make C implement this interface as shown in Figure 14.11. This breaks the dependency of Stable on Flexible, and forces both components to depend on UServer. UServer is very stable (I = 0), and Flexible retains its necessary instability (I = 1). All the dependencies now flow in the direction of decreasing I. Abstract Components You may find it strange that we would create a component—in this example, UService—that contains nothing but an interface. Such a component contains no executable code! It turns out, however, that this is a very common, and necessary, tactic when using statically typed languages like Java and C#. These abstract components are very stable and, therefore, are ideal targets for less stable components to depend on. When using dynamically typed languages like Ruby and Python, these abstract components don’t exist at all, nor do the dependencies that would have targeted them. Dependency structures in these languages are much simpler because dependency inversion does not require either the declaration or the inheritance of interfaces. Illustrations are as follows: i . imgur . com / GgWawn3 . png i . imgur . com / MVPqSrr . png
So whatever again, here's the question. I still haven't found an adequate answer which would not make me doubt myself so... t_t
Yahboy
any pdf
klimi
any pdf
https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/pdfreference1.0.pdf
Anonymous
Today's weather is very good and my mood is also very good
Rose
Today's weather is very good and my mood is also very good
Offtopic discussions should be done in the C/C++ Offtopic group. Please take your discussion/questions there.
Rose
User Good Bye World has 1/2 warnings; be careful! Reason: don't click every blue text you see 😐
Rose
User M has 1/2 warnings; be careful! Reason: spam
M
NEED FRESHERS WHO COMPLETED THE DEGREE AFTER 2018 FOR LEADING MNC , WE CAN DO BACK DOOR PROCESS ALSO .INTERESTED PING ME DIRECTLY
harmony5 🇺🇳 ⌤
NEED FRESHERS WHO COMPLETED THE DEGREE AFTER 2018 FOR LEADING MNC , WE CAN DO BACK DOOR PROCESS ALSO .INTERESTED PING ME DIRECTLY
You were warned because of spam and right after you send the same message… nevermind, it's a bot.
👙👗🍅nude chat free.....link in bio
I m noob
Ziky
I m noob
@K11M1 kill this too...
Tronald
Im trying to take a sentence a sentence as input and store each word in separate array, How can I achieve that in C?
klimi
I m noob
/ban crypto bot
Rose
/ban crypto bot
Another one bites the dust...! Banned $100 need? .​.​.​.​check bio. Reason: crypto bot
Ziky
Im trying to take a sentence a sentence as input and store each word in separate array, How can I achieve that in C?
What do you have do far? If you don't mind having hard limit of maximal word length and word count I would create an array of char arrays and then just go char by char copy it into (inner) array and whe you find space just put \0 into current array and start copying chars to the next (inner) array
\Device\NUL
Some for loop scanf with format specifier shenanigans?
\Device\NUL
Did you guys prefer proactor or reactor? what's the rationale?
Anonymous
#res
Rose
#res
Please check out this channel - @Resources for information on learning sources for C and C++ (books and videos) and Frequently Asked Questions.
Anakin
Since when does GCC accept extra semicolons on function calls?
Rose
User sala has 1/2 warnings; be careful! Reason: advertising business
mohamed
Hello
klimi
Hello
nohello.com
🏳️‍🌈GNU/Линуксяша-libre🏳️‍🌈
/warns
Rose
/warns
User GNU/Линуксяша-libre has no warnings!
Rose
User Muni has no warnings!
harmony5 🇺🇳 ⌤
Since when does GCC accept extra semicolons on function calls?
Semicolons are used to end statements. An empty semicolon is a null expression, in other words, nothing. You can add multiple empty semicolons wherever you can use a semicolon to end an statement, as it does nothing. https://en.cppreference.com/w/cpp/language/statements
harmony5 🇺🇳 ⌤
No
Anakin
At first place, why are null expressions acceptable
Anakin
I mean it's not even GCC only, even clang does. safe to say this is from C
Anakin
oh wait nvm, I found an answer on stackoverflow
Ludovic 'Archivist'
so it's not a bug?
It is intended behaviour, it is also the reason why you can omit statements in your for-loops for example
Ludovic 'Archivist'
For example, for(;;); is well defined as an infinite loop that does nothing (keep in mind that infinite loops themselves are undefined behaviour)
Billy ᛭
A quick brown fox jumped over the lazy dog. Anyway I came here to say that I've likely found an answer to my question.
Billy ᛭
Apparently this retarded robot will not let me share a piece of my knowledge with you guys.
Billy ᛭
I am sorry.
Nana
Can anyone help build Beamer presentation using LaTex
Spirit
Use strtok
Spirit
There is many ways to do the same thing it really depends on how much info you want to access the data, if you want any meta data stored, thread safety, POSIX compliance, what libraries you want to use, technically you could do it without cstdlib. Do you want error handling, etc … How far down the rabbit hole do you want to go.
Spirit
The simplest way is probably just tokenizing a cstring with strtok.
Spirit
Absolute dead simple code Something a noob would write
Then I’d just use basic data structures and do the array char copying method. Or strtok standard library function. They are both really really “n00b” level
Spirit
If it’s like the beginning of college c programming class they probably are just expecting you to assign variables data and use loops all contained inside a main() function and probably not use calling functions or passing many pointers or anything more abstract.
Spirit
So yeah for loop through a null terminated char * array until you find a ‘\0’, copy one char at a time, compare current char with ‘ ‘ character if you find that, move on to assigning the next word. If you’re using dynamic arrays though, are you allocating memory with malloc?
Spirit
Did they already show you examples using buffers?
Spirit
The longest English word is 45 characters so your max buffer could be say 46 * sizeof(char) in length giving you space for the null.
Spirit
It’s a waste of memory to allocate each chunk of memory to 46bytes though especially since most words are around 5 characters long, you could count the length of the word then allocate memory to fit the size of that word plus a null
Spirit
You’d need an index variable and probably a word count variable and a current word length variable so you can index through the string.
Spirit
Hopefully that gives you some ideas
Tronald
Did they already show you examples using buffers?
Nope If you code give a pseudocode if you have the time thatd be great
Spirit
Uh yeah do you have example data?
Spirit
programming is pretty specific. so id need to actually know specifially what data im handling or else id have to write something for general use case which would have to cover alot of unknowns.