[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Code quality
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 21
Thread images: 3
File: Drakon-Generate-JavaScript-fs8.png (19 KB, 535x693) Image search: [Google]
Drakon-Generate-JavaScript-fs8.png
19 KB, 535x693
Are you proud of your code, /g/?
>>
>>54459001
sometimes.
>>
File: 1389985592148.png (91 KB, 720x404) Image search: [Google]
1389985592148.png
91 KB, 720x404
>>54459001
>memescript
>>
>>54459001

MA WHAS FO DINNA?
SPAGHETTI SON SPAGHETTI!

>>54459009
He doesn't even use it to its full extent.
>>
>>54459001
>var length = array.length;

OAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
>>
>>54459001
Not exactly but it works atleast
>>
>>54459001
If it works and you save a bunch of time then who gives a fuck. Unless it's a big project then you fuck every one over including future you.
>>
>>54459019
>var length = array.length;
I do this to avoid calling the length function a gorillion times in a loop.
Never checked if there was actually any difference in performance.
>>
>>54459001
Some of it. Maybe.
>>
>>54459019
bait? bait
>>
>>54459021
Please put your opening bracket on the same line as do.
t. K&R
>>
>>54459001
>Are you proud of your code, /g/?
Never.
>>
No but I usually write quick and dirty because I have so many things to do

Always revise it later
>>
>>54459001
Very

sed :: [String] -> String -> Memory (Message String)
sed _ ('s':x:xs) = do
let f :: (Bool, (Int, ((String, String), String)))
-> Char
-> (Bool, (Int, ((String, String), String)))
f (True, (n, ((a, b), c))) x'
| n == 1 && x' == x = (False, (n, ((a ++ [x'], b), c)))
| n == 1 = (False, (n, ((a ++ ['\\', x'], b), c)))
| n == 2 && x' == x = (False, (n, ((a, b ++ [x']), c)))
| n == 2 = (False, (n, ((a, b ++ ['\\', x']), c)))
| otherwise = (False, (n, ((a, b), c ++ ['\\', x'])))
f (False, (n, ((a, b), c))) x'
| n == 1 && x' == x = (False, (2, ((a, b), c)))
| n == 1 && x' == '\\' = (True, (n, ((a, b), c)))
| n == 1 = (False, (n, ((a ++ [x'], b), c)))
| n == 2 && x' == x = (False, (3, ((a, b), c)))
| n == 2 && x == '\\' = (True, (n, ((a, b), c)))
| n == 2 = (False, (n, ((a, b ++ [x']), c)))
| otherwise = (False, (n, ((a, b), c ++ [x'])))
(_, (_, ((match, replacement), string))) = foldl f (False, (1, (("", ""), ""))) xs
(ins, _:string') = break (== ' ') string
insensitive = ins /= "i"
regex = mkRegexWithOpts match False insensitive
liftIO $ print insensitive
e <- liftIO $ try (return $! subRegex regex string' replacement) :: Memory (Either SomeException String)
case e of
Right a -> return $ ChannelMsg a
Left e -> return EmptyMsg
sed _ _ = return EmptyMsg
>>
It works and that is enough.
>>
>>54459271
For some reason I never looked back to my older code and noticed that I improved anything or that it sucked in the first place. Probably because it was trivial, but still. I've only been doing this for the past year or so.

The only absolutely disgusting thing I did was when I wrote some small web scraper in python and didn't bother learning how to make a proper global, so I just passed one variable from function to function kek. I don't even know...

How can I see when I am improving the code anyway?
>>
>>54459376
Ignore the quote from another thread. I'm a mobileposter.
>>
>>54459001
I always make an effort to make my code as high quality as possible.
Re-factoring is one of my favourite things to do.
>>
>>54459065
There is
>>
>>54459354
8/10 job security theyll keep you around for decades to maintain that pile o shit.
>>
>>54459412
it's true
if you can convince companies to use functional programming, you can keep your job

jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/

look at this
import scalaz._
import scalaz.std.list._
import scalaz.syntax.monad._
import scalaz.syntax.monoid._
import scalaz.syntax.traverse.{ToFunctorOps => _, _}

class Foo[F[+_] : Monad, A, B](val execute: Foo.Request[A] => F[B], val joins: Foo.Request[A] => B => List[Foo.Request[A]])(implicit J: Foo.Join[A, B]) {

def bar: Foo[({type l[+a]=WriterT[F, Log[A, B], a]})#l, A, B] = {
type TraceW[FF[+_], +AA] = WriterT[FF, Log[A, B], AA]
def execute(request: Request[A]): WriterT[F, Log[A, B], B] =
self.execute(request).liftM[TraceW] :++>> (repr => List(request -> request.response(repr, self.joins(request)(repr))))
----- REDACTED -------
Thread replies: 21
Thread images: 3

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.