• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 23:09
CEST 05:09
KST 12:09
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy18ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book20
Community News
[BSL22] RO32 Group Stage1Weekly Cups (March 23-29): herO takes triple6Aligulac acquired by REPLAYMAN.com/Stego Research8Weekly Cups (March 16-22): herO doubles, Cure surprises3Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool51
StarCraft 2
General
Rongyi Cup S3 - Preview & Info Team Liquid Map Contest #22 - Presented by Monster Energy Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool What mix of new & old maps do you want in the next ladder pool? (SC2) Aligulac acquired by REPLAYMAN.com/Stego Research
Tourneys
RSL Season 4 announced for March-April Sparkling Tuna Cup - Weekly Open Tournament StarCraft Evolution League (SC Evo Biweekly) WardiTV Mondays World University TeamLeague (500$+) | Signups Open
Strategy
Custom Maps
[M] (2) Frigid Storage Publishing has been re-enabled! [Feb 24th 2026]
External Content
The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power Mutation # 518 Radiation Zone
Brood War
General
ASL21 General Discussion [BSL22] RO32 Group Stage so ive been playing broodwar for a week straight. Gypsy to Korea Pros React To: JaeDong vs Queen
Tourneys
[ASL21] Ro24 Group F Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues [ASL21] Ro24 Group E
Strategy
What's the deal with APM & what's its true value Fighting Spirit mining rates Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game Nintendo Switch Thread General RTS Discussion Thread Darkest Dungeon
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread The Chess Thread Russo-Ukrainian War Thread NASA and the Private Sector Things Aren’t Peaceful in Palestine
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Broowar part 2
qwaykee
China Uses Video Games to Sh…
TrAiDoS
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
ASL S21 English Commentary…
namkraft
Electronics
mantequilla
Customize Sidebar...

Website Feedback

Closed Threads



Active: 11335 users

The Big Programming Thread - Page 347

Forum Index > General Forum
Post a Reply
Prev 1 345 346 347 348 349 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Mordanis
Profile Blog Joined January 2011
United States893 Posts
Last Edited: 2013-08-23 20:49:22
August 23 2013 20:45 GMT
#6921
On August 24 2013 05:31 Yoshi- wrote:
That seems to be way too hard and is pretty much useless tbh, you should maybe focus on something that not that "impossible"

I was thinking of writing each line to a file (dummy file?) that looks like this on startup:
#include <stdio.h>
int main()
{
/* lines from scanf go here */
return 0;
}

and then after each line, I can have a decision on what to/ if to print something. Then run a shell script to compile and run the "dummy program", and run the output to the main program. Is it that much more difficult than it seems? BTW this would only be for linux.

EDIT: guess this was all basically said already...
But for the usability part, it seems to me to be a slightly easier way to learn operations and pointers. Would this be helpful for someone just starting or coming back to C? or would this be a waste of time :D
I love the smell of napalm in the morning... it smells like... victory. -_^ Favorite SC2 match ->Liquid`HerO vs. SlayerS CranK g.1 @MLG Summer Championship
Yoshi-
Profile Joined October 2008
Germany10227 Posts
August 23 2013 20:52 GMT
#6922
Well, normally how I would assume such an REPL system, is that it works like the one at codeacademy: www.codecademy.com

e.g. you write something like 5+5;(without print or something like that) and it would give you the result, so dunno if you can actually catch this properly
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2013-08-23 20:54:50
August 23 2013 20:53 GMT
#6923
I did this for Java back when I was learning how to program, so its certainly not impossible, though still really difficult. You're effectively writing a virtual machine (which is great practice!).

Here's a short list of problems I had, and you would likely run into:

Variables are tough. I used a map, in Java, and you would have to make your own map or something similar using C, which isn't too tough. Figuring out the data structure was the easy part, the parsing and evaluating is the difficult part, as you have to decide something is a variable. Luckily, C is loosely typed, so that part is easy. Implementing structures is particularly a pain.

Allocation is really, really hard. You will have to manage your own heap.

Functions. Hard. You will have to manage your own stack as well.

Program control is nearly impossible without writing your own virtual machine to decide which line to run next. You're already effectively doing this if you implement your own heap and stack and I/O, so adding on PC control ain't so bad comparatively.

Plus, you have to be able to parse and evaluate calculations. <---- I would start with this step, then add variables, then add arrays, then add if()/else+while/for.

This is all assuming you want your REPL to have memory, etc...
Any sufficiently advanced technology is indistinguishable from magic
KainiT
Profile Joined July 2011
Austria392 Posts
August 26 2013 10:00 GMT
#6924
Hey, maybe you guys have a better solution for the following task than me:

Names in brackets are for explanatory reasons.
I have a cpp std::map that maps a struct containing a std::string("first1") and an unsigned int("first2") to another unsigned int("second"). Now I have to find out for every entry if there is another entry(and how many) that has the same "first2" and also the same "second".
Note that the map contains several thousand entries but only very few of them will share "first2" and "second", maybe even none.
My idea would be to iterate over the std::map and create another map while doing it. This map would map a struct containing "first2" and "second" to "first1".
I guess this is a fairly tolerable solution, but I already grumbled about the excessive use of std::maps(most of the code leading to this problem was not written by me) so using another one to solve the problem is a little problematic :D

Maybe one of you knows some awesome way to do this. Btw, everyting of the boost library can be used
With great power comes great responsibility.
gedatsu
Profile Joined December 2011
1286 Posts
August 26 2013 12:27 GMT
#6925
On August 26 2013 19:00 KainiT wrote:
Hey, maybe you guys have a better solution for the following task than me:

Names in brackets are for explanatory reasons.
I have a cpp std::map that maps a struct containing a std::string("first1") and an unsigned int("first2") to another unsigned int("second"). Now I have to find out for every entry if there is another entry(and how many) that has the same "first2" and also the same "second".
Note that the map contains several thousand entries but only very few of them will share "first2" and "second", maybe even none.
My idea would be to iterate over the std::map and create another map while doing it. This map would map a struct containing "first2" and "second" to "first1".
I guess this is a fairly tolerable solution, but I already grumbled about the excessive use of std::maps(most of the code leading to this problem was not written by me) so using another one to solve the problem is a little problematic :D

Maybe one of you knows some awesome way to do this. Btw, everyting of the boost library can be used

Since you want the answer for every string, you're going to need to use a dictionary of some sort. A map is good. You're only going to need two maps in total, and you're only going to need one iteration through the first map. A well implemented map will be able to do this in O(n) time. Insertion into your new map will require O(nlogn) if it's a BST which normal maps usually are, but O(n) if it's a hashmap.
Promises
Profile Joined February 2004
Netherlands1821 Posts
August 26 2013 15:01 GMT
#6926
Hey guys, I might be desperate for help =) I just received a programming assignment for Logical Programming, SWIPL Prolog. There is a LOT riding on this assignment for me, and I'm about to get started. Is there anyone here who happens to be familiar with Prolog? I understand that this is a fairly desperate bid, but I guess that's sort of what I am =)
I'm a man of my word, and that word is "unreliable".
Utini
Profile Joined July 2012
5 Posts
August 26 2013 15:20 GMT
#6927
Hello. Im trying to make program using C#, windows forms, ms server, entity framework. Here is a problem.. I have quite complicated data structure (List of dictionaries with another lists inside and so on..), user fills this structure by completing multiple forms and press submit in the end. At that time i need to take this structure and write it into database which spreads all this information into around 10 tables. If some errors happens (like foreign key problems) while inserting data, all previously written data must be deleted, in other words, all 10 tables must be filled correctly on none at all.

Currently i fill all data into entity model and call saveChanges() method ONCE, which puts data from model into DB afaik.
Problem is that this makes dubugging almost impossible, because all crashes comes from calling saveChanges() and it's hard to say which part of filling my entity model is responsible for this error.

How should i deal with this? Im thinking about remaking it, so it would call saveChanges() by inserting small chunks of data into single tables and if, lets say it crashes on 10th table (10th saveChanges() call), some other code whould delete inserted data from another 9 already filled tables. What do you think about this idea? Or maybe there is some better way?
bleda
Profile Joined January 2011
United States27 Posts
August 26 2013 15:29 GMT
#6928
On August 27 2013 00:20 Utini wrote:
Hello. Im trying to make program using C#, windows forms, ms server, entity framework. Here is a problem.. I have quite complicated data structure (List of dictionaries with another lists inside and so on..), user fills this structure by completing multiple forms and press submit in the end. At that time i need to take this structure and write it into database which spreads all this information into around 10 tables. If some errors happens (like foreign key problems) while inserting data, all previously written data must be deleted, in other words, all 10 tables must be filled correctly on none at all.

Currently i fill all data into entity model and call saveChanges() method ONCE, which puts data from model into DB afaik.
Problem is that this makes dubugging almost impossible, because all crashes comes from calling saveChanges() and it's hard to say which part of filling my entity model is responsible for this error.

How should i deal with this? Im thinking about remaking it, so it would call saveChanges() by inserting small chunks of data into single tables and if, lets say it crashes on 10th table (10th saveChanges() call), some other code whould delete inserted data from another 9 already filled tables. What do you think about this idea? Or maybe there is some better way?


That is one way of doing it, but I think an easier way is to call a stored procedure and let it do all of that work for you. Handling FK errors is a lot easier on the SQL side of things. Also, if there could potentially be an error when inserting, it really your job to handle the validation of the information before you try to insert. So have a call that validates, and if that is successful, then insert it into the DB.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2013-08-26 15:45:24
August 26 2013 15:42 GMT
#6929
First of all, if you have a "quite complicated data structure" you might want to try and make it less complicated. This isn't really related to obtaining debugging information, but if you find your own code complicated, debugging will always be hard.

I'm currently working on a program with a somewhat similar setup (C#, WPF, SQLCE, ADO.NET). I too am inserting a large chunck of complex (but not all that complicated) data at once. The last time I worked on the database part of the program is a bit ago already though, and I'm not terribly experienced with databases yet.
Anyways, as far as I can remember, there usually was a decent hint in the stack trace whenever SaveChanges failed. It pretty much always was either a duplicate key or me failing to correctly update the data model after changing the database.
(my memory about that is a bit hazy already; I'm busy with finite state machines now)
If you have a good reason to disagree with the above, please tell me. Thank you.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
Last Edited: 2013-08-26 16:07:49
August 26 2013 15:59 GMT
#6930
On August 27 2013 00:20 Utini wrote:
Hello. Im trying to make program using C#, windows forms, ms server, entity framework. Here is a problem.. I have quite complicated data structure (List of dictionaries with another lists inside and so on..), user fills this structure by completing multiple forms and press submit in the end. At that time i need to take this structure and write it into database which spreads all this information into around 10 tables. If some errors happens (like foreign key problems) while inserting data, all previously written data must be deleted, in other words, all 10 tables must be filled correctly on none at all.

Currently i fill all data into entity model and call saveChanges() method ONCE, which puts data from model into DB afaik.
Problem is that this makes dubugging almost impossible, because all crashes comes from calling saveChanges() and it's hard to say which part of filling my entity model is responsible for this error.

How should i deal with this? Im thinking about remaking it, so it would call saveChanges() by inserting small chunks of data into single tables and if, lets say it crashes on 10th table (10th saveChanges() call), some other code whould delete inserted data from another 9 already filled tables. What do you think about this idea? Or maybe there is some better way?

One way to make this easier would be to put in as much validation handling as you can. If you can predict when an error will happen before making any commits and inform the user, that will go a long way towards solving any problems caused by user error.

For debugging purposes, are you wrapping your entire data commit in a transaction? I would highly recommend it, as it will save you the effort of having to build code to go back and undo what was done. After all, what would happen when the undo code fails? A transaction will take care of that for you.

I'm guessing saveChanges() is one single function that performs all the save work. What I have done in the past in cases like this is create a status string that I change during the workload depending on what work I'm doing, and if there is an error, I return the status. Here's an example:
string updateMessage;

Try

// Workload One
updateMessage = "Workload One";
group of work

// Workload Two
updateMessage = "Workload Two";
group of work

// Workload Three
updateMessage = "Workload Three";
group of work

Catch ex as exception
Message.Show("An error occurred during " + updateMessage);

End Try

Obviously what you do with the error will be different, but hopefully you get the idea. The nice part about this is although you can't control what an error message looks like (a divide by zero error will always look the same no matter where in your code it happens), you can customize the updateMessage to look however you want at any stage during the work, so it will always be easy to know exactly where the error occurred (ctrl+f, baby!).

Of course, if you change it so that you are wrapping your entire data commit in one transaction, and the errors you anticipate will always be database errors, you'll have to approach it a bit differently. I would recommend logging the error along with the SQL that caused the error, and providing some means of getting that from the user to you so you can debug it.
Warri
Profile Joined May 2010
Germany3208 Posts
Last Edited: 2013-08-26 16:54:58
August 26 2013 16:54 GMT
#6931
for (Object o:oList) {
o.do();
if (!o.enabled)
oList.iterator().remove();
}

Why is this throwing an IllegalStateException?
tapuchi
Profile Joined November 2010
Greece7 Posts
August 26 2013 17:28 GMT
#6932
Hello , i'm currently re-writing an image processing program i created using vc++ and matlab in c# and trying to implement the object-oriented paradigms correctly . My previous implementation was my first real and big programming experience and after spending the summer reading Design Patterns , Code Complete and Object Roles and Responsibilites i realized how bad my code structure/design/implementation was and decided to go at it again whilst using what i hopefully learnt.

The thing is i just cant decide how to do things properly even after spending alot of time at stack overflow or just googling stuff.
For example , i got some algorithms doing the same work on the images and thought of implementing the strategy pattern but then again i figured why complicate it and not just make a static class with each algorithm as a different method ( System.Math style ) .

Another problem is how to pass each algorithms settings to it while at the same time avoiding a huge parameter list . A Parameter Object just moves the parameter list from the algorithm to the structure constructor , a builder pattern seems abit too much for it because the object needs to be bound to a control that changes the settings values .

How does a novice actually make these decisions ? Even the simple creation of the settings control is driving me mad , do i give the settings object a .ToControl() method ( is it its Responsibility to make a view of itself or not? ) or do i pass the object
as an argument to the SettingsControl constructor ( does the control need to know about the settings object implementation ? ).All in all i think i just mashed up all that knowledge without really understanding it im afraid . Thanks for any help/opinion/advice beforehand .
taguchi?
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
August 26 2013 17:35 GMT
#6933
On August 27 2013 01:54 Warri wrote:
for (Object o:oList) {
o.do();
if (!o.enabled)
oList.iterator().remove();
}

Why is this throwing an IllegalStateException?

I'm not quite familiar with this language, but it might be because you're removing an object from a collection as you're enumerating through the collection.
Warri
Profile Joined May 2010
Germany3208 Posts
August 26 2013 17:55 GMT
#6934
On August 27 2013 02:35 enigmaticcam wrote:
Show nested quote +
On August 27 2013 01:54 Warri wrote:
for (Object o:oList) {
o.do();
if (!o.enabled)
oList.iterator().remove();
}

Why is this throwing an IllegalStateException?

I'm not quite familiar with this language, but it might be because you're removing an object from a collection as you're enumerating through the collection.

If you try to remove the object direclty with oList.remove(o); you would get ConcurrentModificationException, which is exactly because of what you said. Removing by using the iterator is supposed to work apparently.
Zocat
Profile Joined April 2010
Germany2229 Posts
Last Edited: 2013-08-26 18:07:32
August 26 2013 18:05 GMT
#6935
remove:
Removes from the list the last element that was returned by next() or previous()
IllegalStateException - if neither next nor previous have been called, or remove or add have been called after the last call to next or previous

Dump the foreach loop and do a normal one with the iterator
gedatsu
Profile Joined December 2011
1286 Posts
August 26 2013 18:20 GMT
#6936
On August 27 2013 01:54 Warri wrote:
for (Object o:oList) {
o.do();
if (!o.enabled)
oList.iterator().remove();
}

Why is this throwing an IllegalStateException?

You need to call next() before you can do a remove(). But you will run into errors still: you're using two different iterators for the same collection (the for loop and the explicit iterator()) and the for loop will crash if you modify the collection. Instead use only the explicit iterator(), and loop using while(iterator.hasNext()).
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2013-08-26 18:25:12
August 26 2013 18:22 GMT
#6937
On August 27 2013 02:28 tapuchi wrote:
Hello , i'm currently re-writing an image processing program i created using vc++ and matlab in c# and trying to implement the object-oriented paradigms correctly . My previous implementation was my first real and big programming experience and after spending the summer reading Design Patterns , Code Complete and Object Roles and Responsibilites i realized how bad my code structure/design/implementation was and decided to go at it again whilst using what i hopefully learnt.

The thing is i just cant decide how to do things properly even after spending alot of time at stack overflow or just googling stuff.
For example , i got some algorithms doing the same work on the images and thought of implementing the strategy pattern but then again i figured why complicate it and not just make a static class with each algorithm as a different method ( System.Math style ) .

Another problem is how to pass each algorithms settings to it while at the same time avoiding a huge parameter list . A Parameter Object just moves the parameter list from the algorithm to the structure constructor , a builder pattern seems abit too much for it because the object needs to be bound to a control that changes the settings values .

How does a novice actually make these decisions ? Even the simple creation of the settings control is driving me mad , do i give the settings object a .ToControl() method ( is it its Responsibility to make a view of itself or not? ) or do i pass the object
as an argument to the SettingsControl constructor ( does the control need to know about the settings object implementation ? ).All in all i think i just mashed up all that knowledge without really understanding it im afraid . Thanks for any help/opinion/advice beforehand .

I am making a lot of assumptions, since your description of the problem isn't very specific.
It sounds like a situation where I would create an IAlgorithm interface which you can apply to the image (or the image can apply to itself) without knowing what it does or how it is done. Then each algorithm gets its own class. Since you seem to have a lot of settings for each algorithm (and those probably are different from algorithm to algorithm), I would probably use a fluent interface to apply those settings.
Implementation like this:
class Algo
{
Algo SettingA(value)
{
...
return this;
}
}

Usage like this:
algo.SettingA(value_a).SettingB(value_b);

Applying settings like is very readable and it's much harder to mix up different settings of the same type. Of course you can and likely should group several closely related values into the same settings method.

The "is it its Responsibility to make a view of itself or not?" and "does the control need to know about the settings object implementation ?" sound like things that should be answered with a straight up no.

You might want to read about test driven development. It deals mainly with good class design. You don't have to actually apply TDD, but it should provide some insight if you have trouble designing systems.

Also: Try to avoid static anything.


On August 27 2013 01:54 Warri wrote:
for (Object o:oList) {
o.do();
if (!o.enabled)
oList.iterator().remove();
}

Why is this throwing an IllegalStateException?

Usually you are not meant to make changes to the collection in a foreach loop, which this seems to be.
What language is this, anyways?
If you have a good reason to disagree with the above, please tell me. Thank you.
Kambing
Profile Joined May 2010
United States1176 Posts
August 26 2013 18:26 GMT
#6938
On August 24 2013 05:45 Mordanis wrote:
Show nested quote +
On August 24 2013 05:31 Yoshi- wrote:
That seems to be way too hard and is pretty much useless tbh, you should maybe focus on something that not that "impossible"

I was thinking of writing each line to a file (dummy file?) that looks like this on startup:
#include <stdio.h>
int main()
{
/* lines from scanf go here */
return 0;
}

and then after each line, I can have a decision on what to/ if to print something. Then run a shell script to compile and run the "dummy program", and run the output to the main program. Is it that much more difficult than it seems? BTW this would only be for linux.

EDIT: guess this was all basically said already...
But for the usability part, it seems to me to be a slightly easier way to learn operations and pointers. Would this be helpful for someone just starting or coming back to C? or would this be a waste of time :D


Scaling it down to a simple REPL for a command-line calculator, perhaps in reverse polish notation, i.e., something like:



$ ./rpn

> 3 4 +
7
> 1 2 + 3 *
9
> quit



Exercises most of the functionality you want without having to delve into the details of properly implementing an actual programming language (as RoyGBiv_13 describes).
Warri
Profile Joined May 2010
Germany3208 Posts
August 26 2013 18:42 GMT
#6939
On August 27 2013 03:20 gedatsu wrote:
Show nested quote +
On August 27 2013 01:54 Warri wrote:
for (Object o:oList) {
o.do();
if (!o.enabled)
oList.iterator().remove();
}

Why is this throwing an IllegalStateException?

You need to call next() before you can do a remove(). But you will run into errors still: you're using two different iterators for the same collection (the for loop and the explicit iterator()) and the for loop will crash if you modify the collection. Instead use only the explicit iterator(), and loop using while(iterator.hasNext()).

thanks, using the iterator for the loop works.
On August 27 2013 03:22 spinesheath wrote:
What language is this, anyways?

Java
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
August 26 2013 18:49 GMT
#6940
On August 27 2013 03:22 spinesheath wrote:
Show nested quote +
On August 27 2013 02:28 tapuchi wrote:
Hello , i'm currently re-writing an image processing program i created using vc++ and matlab in c# and trying to implement the object-oriented paradigms correctly . My previous implementation was my first real and big programming experience and after spending the summer reading Design Patterns , Code Complete and Object Roles and Responsibilites i realized how bad my code structure/design/implementation was and decided to go at it again whilst using what i hopefully learnt.

The thing is i just cant decide how to do things properly even after spending alot of time at stack overflow or just googling stuff.
For example , i got some algorithms doing the same work on the images and thought of implementing the strategy pattern but then again i figured why complicate it and not just make a static class with each algorithm as a different method ( System.Math style ) .

Another problem is how to pass each algorithms settings to it while at the same time avoiding a huge parameter list . A Parameter Object just moves the parameter list from the algorithm to the structure constructor , a builder pattern seems abit too much for it because the object needs to be bound to a control that changes the settings values .

How does a novice actually make these decisions ? Even the simple creation of the settings control is driving me mad , do i give the settings object a .ToControl() method ( is it its Responsibility to make a view of itself or not? ) or do i pass the object
as an argument to the SettingsControl constructor ( does the control need to know about the settings object implementation ? ).All in all i think i just mashed up all that knowledge without really understanding it im afraid . Thanks for any help/opinion/advice beforehand .

I am making a lot of assumptions, since your description of the problem isn't very specific.
It sounds like a situation where I would create an IAlgorithm interface which you can apply to the image (or the image can apply to itself) without knowing what it does or how it is done. Then each algorithm gets its own class. Since you seem to have a lot of settings for each algorithm (and those probably are different from algorithm to algorithm), I would probably use a fluent interface to apply those settings.
Implementation like this:
class Algo
{
Algo SettingA(value)
{
...
return this;
}
}

Usage like this:
algo.SettingA(value_a).SettingB(value_b);

Applying settings like is very readable and it's much harder to mix up different settings of the same type. Of course you can and likely should group several closely related values into the same settings method.

The "is it its Responsibility to make a view of itself or not?" and "does the control need to know about the settings object implementation ?" sound like things that should be answered with a straight up no.

You might want to read about test driven development. It deals mainly with good class design. You don't have to actually apply TDD, but it should provide some insight if you have trouble designing systems.

Also: Try to avoid static anything.
?


C# has initialization lists, so the .SettingA() thing is usually (arguably) less readable.


Class X
{
public String A {get;set;}
public Int32 B {get;set;}
public Double C {get;set;}
}

X x = new X()
{
A = "foo",
B = 42,
C = 3.1415926
}


I'm currently in the middle of a Planetside 2 platoon op so i don't have time to write a good solution for the problem in question but if noone else gives a satisfactory solution, i'll might remember to write it later.
Prev 1 345 346 347 348 349 1032 Next
Please log in or register to reply.
Live Events Refresh
CranKy Ducklings
00:00
TLMC #22: Map Judging #1
CranKy Ducklings62
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 233
ROOTCatZ 78
StarCraft: Brood War
GuemChi 5876
Sea 38
Noble 27
Dota 2
monkeys_forever926
NeuroSwarm157
League of Legends
JimRising 734
Counter-Strike
taco 659
C9.Mang0325
Super Smash Bros
hungrybox505
Mew2King64
Heroes of the Storm
Khaldor64
Other Games
summit1g10651
tarik_tv5085
Organizations
Other Games
gamesdonequick1078
BasetradeTV122
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• CranKy Ducklings SOOP5
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo563
• Stunt103
Other Games
• Scarra761
Upcoming Events
Sparkling Tuna Cup
6h 51m
PiGosaur Cup
20h 51m
Replay Cast
1d 5h
Kung Fu Cup
1d 8h
Replay Cast
1d 20h
The PondCast
2 days
CranKy Ducklings
2 days
WardiTV Team League
3 days
Replay Cast
3 days
CranKy Ducklings
4 days
[ Show More ]
WardiTV Team League
4 days
uThermal 2v2 Circuit
4 days
BSL
4 days
Sparkling Tuna Cup
5 days
WardiTV Team League
5 days
BSL
5 days
Replay Cast
5 days
Replay Cast
6 days
Wardi Open
6 days
Liquipedia Results

Completed

CSL Elite League 2026
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
StarCraft2 Community Team League 2026 Spring
Nations Cup 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026

Upcoming

Escore Tournament S2: W2
IPSL Spring 2026
Escore Tournament S2: W3
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
uThermal 2v2 Last Chance Qualifiers 2026
RSL Revival: Season 5
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.